[SOLVED] how to make imagebuttons work?

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
felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

[SOLVED] how to make imagebuttons work?

#1 Post 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.
Last edited by felsenstern on Sat Oct 22, 2022 2:37 am, edited 1 time in total.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2420
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: how to make imagebuttons work?

#2 Post 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.
< < insert Rick Cook quote here > >

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: how to make imagebuttons work?

#3 Post 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 ;-)
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

Post Reply

Who is online

Users browsing this forum: Adabelitoo, Ahrefs [Bot], Google [Bot]