Getting the x/y position of the file slots button

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
15nick
Regular
Posts: 33
Joined: Thu Oct 17, 2013 2:46 am
Contact:

Getting the x/y position of the file slots button

#1 Post by 15nick »

Sorry to bother, but I feel like I’ve hit a bit of a wall. So I had my save screen set up so that when you hovered over the save button a new screen would appear with additional information. Something like:

Code: Select all

button:
    action FileAction(slot)
    hovered Show(“extra_info”,i=slot,empty=file_time)
    unhovered Hide(blahblah)
And it works hunky-dory. BUT to ensure the extra_info screen showed up in the right place (on top of the respective save slot) I had to mess around with the xpos and ypos decimal by decimal (aka if the slot in 1 or 3, xpos is .61235, otherwise it’s THIS). Is there a way to get the pos of the slot button on hover so I can pass it to the new screen without having to do all that magic-number guesswork?
I attempted Ren’py.get_widget_properties() but couldn’t get it to work. Same with focus_coordinates(). I know there’s a way to do it by creating your own displayable but I’m hesitant to change the slot_button code any more than absolutely needed.

Changing the hover action to setting a screenvariable to show the info on one screen also didn’t work as:

Code: Select all

hovered SetScreenVariable(“show_extra”,True)
...
if show_extra:
    add all the extra stuff
Shows the extra info for every used save slot, not just the currently hovered one.

Thank you for any help you’re able to offer, and I apologize if the answer is something simple that I haven’t grasped.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Getting the x/y position of the file slots button

#2 Post by namastaii »

can you try placing this hover variable within the for loop for the slots?

User avatar
15nick
Regular
Posts: 33
Joined: Thu Oct 17, 2013 2:46 am
Contact:

Re: Getting the x/y position of the file slots button

#3 Post by 15nick »

namastaii wrote: Fri Aug 23, 2019 3:55 pm can you try placing this hover variable within the for loop for the slots?
Unfortunately doing so means the screen never shows regardless of the value of the variable. Using the console I can see the variable updates correctly if I’m hovering the slot button or not, but the image never shows.
It looks like it only checks the “if show: add this” code once at the start and then never again if I include a default value of “False” anywhere in the file_slots screen.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]