Button actions
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.
Button actions
Hi I'm a bit confused
Is the screen action the right way to make a button doing something on click?
I mean, I'm using an imagebutton so when I click on it I want a text to appear, do I have to call a screen with the text in it?
Is the screen action the right way to make a button doing something on click?
I mean, I'm using an imagebutton so when I click on it I want a text to appear, do I have to call a screen with the text in it?
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Button actions
Re: Button actions
I mean in order to make an imagebutton works is that below the right way?
Also I'm not understanding the difference between Call and Jump
Code: Select all
imagebutton:
action: Jump("text")
screen text():
text "Hello world!"
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Button actions
Jump is for labels, call screen is used for calling screen before you continue to the novel.
https://www.renpy.org/doc/html/label.ht ... -statement
https://www.renpy.org/doc/html/label.ht ... -statement
https://www.renpy.org/doc/html/label.ht ... -statement
https://www.renpy.org/doc/html/label.ht ... -statement
Code: Select all
screen textx():
imagebutton auto "button_&s.png" action Show("text") xpos 600
screen text:
text "Hello world"
Code: Select all
label start:
show screen textx
Re: Button actions
That depends of what you trying to achieve.
This might be
Code: Select all
screen button_scr():
imagebutton:
align (0.3, 0.5)
idle "idle_img.png"
hover "hover_img.png"
action ToggleScreen("my_scr")
imagebutton:
align (0.7, 0.5)
idle "another_idle_img.png"
hover "another_hover_img.png"
action Show("another_scr")
screen my_scr():
text "Hello world!" align (0.5, 0.1)
screen another_scr():
timer 1.0 action Hide("another_scr")
text "Hello world!" align (0.5, 0.15)
label start:
"..."
show screen button_scr
"... ..."
"?!"
https://www.renpy.org/doc/html/screen_a ... ggleScreen
https://www.renpy.org/doc/html/screen_actions.html#Hide
https://www.renpy.org/doc/html/screens.html#timer
Re: Button actions
Thank you guys! So can I do something like below?
So in my code I made a little inventory every item is an imagemap, I want that when I click on an item it gives for example +1 in thirsty
Code: Select all
screen button_1():
imagebutton:
action Jump("hello_world")
label start:
show screen button_1
label hello_world:
"Hello World"
Re: Button actions
While you can, take in mind that showing screen won't stop Ren'Py from executing your code farther. So, the exact code you've posted will show your button screen and immediately run the 'hello_world' label (the next line of code).
Check this thread - viewtopic.php?f=51&t=39572#p422964
Who is online
Users browsing this forum: apocolocyntose, DewyNebula