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.
Luckstar
Newbie
Posts: 3 Joined: Sun Jan 18, 2015 9:09 pm
Contact:
#1
Post
by Luckstar » Sun Jan 18, 2015 9:27 pm
Howdy,
I'm trying to use a clickable button to change a variable from true to false
Code: Select all
$ show_stat_box=False
screen stat_button():
imagebutton auto "ui/stat_button_%s.png" xpos 0.01 ypos 0.01 focus_mask True action SetVariable(show_stat_box=True)
This seems to actually crash ren'py and cause an error report
I've tried multiple functions like ToggleVariable, set, even had a go just trying $ show_stat_box=True
It's been a few hours, at this stage any clickable that changes a variable would be a fine solution
SundownKid
Lemma-Class Veteran
Posts: 2299 Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:
#2
Post
by SundownKid » Sun Jan 18, 2015 9:52 pm
Here is the correct syntax:
Code: Select all
screen stat_button():
imagebutton auto "ui/stat_button_%s.png" action SetVariable('show_stat_box',True) xpos 0.01 ypos 0.01 focus_mask True
If you are trying to show and hide a screen however, may I suggest:
Code: Select all
screen stat_button():
imagebutton auto "ui/stat_button_%s.png" action Show('stat_box') xpos 0.01 ypos 0.01 focus_mask True
(Where "stat_box" is the name of the screen?)
Luckstar
Newbie
Posts: 3 Joined: Sun Jan 18, 2015 9:09 pm
Contact:
#3
Post
by Luckstar » Sun Jan 18, 2015 10:02 pm
Glorious, thank you!
That is crazy helpful!
Users browsing this forum: Bing [Bot]