Hi. So I know you can hide an entire screen but with the way some other code for my game works I need to keep the screen up at all times. However I do need to be able to hide and unhide imagebuttons on said screen frequently throughout the game (they are clickable characters that exist in a location and on each location I need to swap out which characters are there as you click to interact with them).
Any way I can do this? I was looking around and couldn't find any evidence of this being possible.
Hiding JUST ONE image button (not the screen)?
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.
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.
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Hiding JUST ONE image button (not the screen)?
this one way
Code: Select all
if button_on == False:
textbutton _("test") action [SetVariable("button_on", True), Show("test")]
else:
None or pass
Re: Hiding JUST ONE image button (not the screen)?
Hi there. Thanks for your help.rayminator wrote: ↑Thu Jan 27, 2022 10:44 pm this one way
Code: Select all
if button_on == False: textbutton _("test") action [SetVariable("button_on", True), Show("test")] else: None or pass
How would I co-opt this for image buttons? I declared my button like so:
Code: Select all
screen overlaycharacters():
imagebutton: #create clickable character on screen
xpos 0.5
ypos 0.28
idle "bun_map_auto.png" #image non hovered
hover "bun_map_hover.png" #image hovered
action Jump("chatwithbun") #jump to label with dialogue for scene
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Hiding JUST ONE image button (not the screen)?
Yes you can have two (or more) actions to one button [which is in rayminator's example, SetVariable and Show ]ChaiLatte wrote: ↑Fri Jan 28, 2022 1:12 amHi there. Thanks for your help.rayminator wrote: ↑Thu Jan 27, 2022 10:44 pm this one way
Code: Select all
if button_on == False: textbutton _("test") action [SetVariable("button_on", True), Show("test")] else: None or pass
How would I co-opt this for image buttons? I declared my button like so:
I'm assuming I can't just have two actions for one button, can I ?Code: Select all
You could use that example like this
Code: Select all
screen overlaycharacters():
if button_on == False:
imagebutton: #create clickable character on screen
xpos 0.5
ypos 0.28
idle "bun_map_auto.png" #image non hovered
hover "bun_map_hover.png" #image hovered
action [SetVariable("button_on", True), Jump("chatwithbun") ] #jump to label with dialogue for scene
Re: Hiding JUST ONE image button (not the screen)?
It worked-- thanks so much both of you
Re: Hiding JUST ONE image button (not the screen)?
Actually... I forgot something (sorry for double post). Is there a way to do this in an area besides the creation of the imagebutton itself? I need to hide the characters when you switch maps as well, so you can come back and click them later.
edit: NEVERMIND AGAIN! I found out that if I have multiple screens it works just fine <3
edit: NEVERMIND AGAIN! I found out that if I have multiple screens it works just fine <3
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Ocelot