Page 1 of 1

[SOLVED] how to make imagebuttons work?

Posted: Fri Oct 21, 2022 12:37 am
by felsenstern
Hiya,

1. I want to use the auto function for imagebuttons.
What are all the names for the placeholder I have to use here? (i.e.: Idle, Hover,...)

2. I want make use of 'selected' imagebutton.
What do I have to do to make an imagebutton show the selected version instead of the unselected one? (i.e.: ...Selected_Idle..., ...Selected_Hover...) in a single screen without subscreens or embedded screens.

3. I'd like to know where that can be found in the RenPy documentation, so a link would be appreciated if possible.

4. I used Google Search and Forum Search and tried to find it in the documentation but failed after wasting several hours.

Re: how to make imagebuttons work?

Posted: Fri Oct 21, 2022 5:43 am
by Ocelot
1. In documentation for imagebutton ( https://www.renpy.org/doc/html/screens.html#imagebutton )
auto
Used to automatically define the images used by this button. This should be a string that contains %s in it. If it is, and one of the image properties is omitted, %s is replaced with the name of that property, and the value is used as the default for that property.
Next 5 entries describes valid image properties:
insensitive
idle
hover
selected_idle
selected_hover

2. In documentation for imagebutton:
selected
An expression that determines whether the button is selected or not. This expression is evaluated at least once per interaction. If not provided, the action will be used to determine selectedness.
You use it like imagebutton <...> selected x >= 4

Alternatively, as documentation tells some actions themselves can determine selectedness in absense of selected property. For example, if your button uses SetVariable action, it will be selected if variable already has the value you are trying to set. For list of actions every action in the list should be in "selected" state for button to be selected.


3. https://www.renpy.org/doc/html/screens. ... magebutton


4. Searching for imagebutton in documentation did the trick for me.

Re: how to make imagebuttons work?

Posted: Fri Oct 21, 2022 10:27 am
by felsenstern
Yeah, it seems sometimes you can't figure it out even when it's in front of you the whole time... I even had a working example inside my game from 1 year ago in front of me and couldn't figure out how and why a button got the selected state... but "For example, if your button uses SetVariable action..." made it clear... and I even found the link to the config.imagemap_auto_function... lol...

Thanks a lot ;-)