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.
-
Glazed Donuts
- Regular
- Posts: 121
- Joined: Thu Aug 12, 2010 11:47 am
-
Contact:
#1
Post
by Glazed Donuts » Sun Jun 12, 2011 4:18 pm
I'm getting an 'Expected Screen Language Statement' error with this block of code. Why can't I hide a screen within a Screen block of code?
Code: Select all
screen show_tooltip:
if buttonAppears == False:
timer 100.0 action Show("tooltip_button")
$buttonAppears = True
else
hide screen tooltip_button # <--- The error occurs here when I use 'Hide screen'
hide screen function_tooltipButton # <--- The error also occurs here
$buttonAppears = False
screen tooltip_button:
mousearea:
area (690, 575, 1.0, 1.0) #xpos, ypos, width, height
hovered Show("function_tooltipButton", transition=dissolve)
unhovered Hide("function_tooltipButton", transition=dissolve)
screen function_tooltipButton:
imagebutton:
idle "sozai/ui/load1.png"
hover "sozai/ui/load2.png"
xpos 700 ypos 560
clicked ShowMenu("save")
EDIT: Also, I have one other question. How do you assign a value to a variable after clicking an button? For example I wanted to do something like this:
Code: Select all
screen function_tooltipButton:
imagebutton:
idle "sozai/ui/load1.png"
hover "sozai/ui/load2.png"
xpos 700 ypos 560
clicked $userClickedTheButton = True # <------- How do I do this for Screen language statements?
-
Alex
- Lemma-Class Veteran
- Posts: 2981
- Joined: Fri Dec 11, 2009 5:25 pm
-
Contact:
#2
Post
by Alex » Sun Jun 12, 2011 5:31 pm
Well, I don't know how to do it "right", but you can try to do it like
Code: Select all
else:
timer 0.001 action Hide ("tooltip_button")
If you need to change the value of some variable by clicking a button, then
Code: Select all
screen function_tooltipButton:
imagebutton:
idle "sozai/ui/load1.png"
hover "sozai/ui/load2.png"
xpos 700 ypos 560
clicked SetVariable ("userClickedTheButton", "True")
http://www.renpy.org/doc/html/screen_ac ... ta-actions
EDIT: uh... why do you made "show_tooltip" at all? Don't you have everything you need in "tooltip_button" screen?
Users browsing this forum: Bing [Bot], Google [Bot], Hojoo