I want to have a counter that can still be shown when I transition from one scene to another.
What I'm using right now is this script:
viewtopic.php?f=8&t=13381
Unfortunately in this script my counter is seen as an image, a DynamicDisplayable that is faded when I transition from one scene to another.
I need to find a way to make that displayable persist through scene transitions
Any help?
[solved]persistent Counter
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.
-
- Regular
- Posts: 33
- Joined: Sat Mar 04, 2017 8:19 am
- Contact:
[solved]persistent Counter
Last edited by Cristiander on Sun Apr 02, 2017 2:29 pm, edited 1 time in total.
Re: persistent Counter
How about using a screen with zorder value set to 1000 ?
My avatar is courtesy of Mellanthe
-
- Regular
- Posts: 33
- Joined: Sat Mar 04, 2017 8:19 am
- Contact:
Re: persistent Counter
That might work, but how do I make the timer go down?indoneko wrote:How about using a screen with zorder value set to 1000 ?
I made this for the screen script:
Code: Select all
#This screen adds a counter that persist through scene transitions
screen countdown():
zorder 100
fixed:
if timer_remaining > 45:
text ("%.1f" % timer_remaining) color "#FFFFFF" size 72 xalign 0.5 yalign 0.6
elif timer_remaining > 0:
text Text("%.1f" % timer_remaining) color "#FF0000" size 72 xalign 0.5 yalign 0.6
Re: persistent Counter
Use timer in your screen. Here's an example :
Then, assuming that you give 10 seconds to the player, here's how you use it in script.rpy :
Code: Select all
screen counterdisplay():
zorder 100
timer .1 repeat True action [If(time_remaining <= 0,
true=SetVariable("time_remaining", 0),
false=SetVariable("time_remaining", time_remaining -.1))]
if time_remaining >= 5:
text ("%.1f" % time_remaining) color "#00FF00" size 72 xalign 0.1 yalign 0.1
else:
text ("%.1f" % time_remaining) color "#FF0000" size 72 xalign 0.1 yalign 0.1
Code: Select all
default time_remaining = 0
label start:
"You reached the market district, and you decide to..."
$time_remaining = 10
show screen counterdisplay()
$ ui.timer(10.0, ui.jumps("tooslow"))
menu:
"Follow Cristiander":
jump cristiander
"Follow Indoneko":
jump indoneko
label tooslow:
hide screen counterdisplay
"You're too slow and you lost both of them!"
return
label cristiander:
hide screen counterdisplay
"You follow cristiander to the church..."
return
label indoneko:
hide screen counterdisplay
"You follow indoneko to the pet shop..."
return
My avatar is courtesy of Mellanthe
-
- Regular
- Posts: 33
- Joined: Sat Mar 04, 2017 8:19 am
- Contact:
Re: persistent Counter
indoneko wrote:Use timer in your screen. Here's an example :Then, assuming that you give 10 seconds to the player, here's how you use it in script.rpy :Code: Select all
screen counterdisplay(): zorder 100 timer .1 repeat True action [If(time_remaining <= 0, true=SetVariable("time_remaining", 0), false=SetVariable("time_remaining", time_remaining -.1))] if time_remaining >= 5: text ("%.1f" % time_remaining) color "#00FF00" size 72 xalign 0.1 yalign 0.1 else: text ("%.1f" % time_remaining) color "#FF0000" size 72 xalign 0.1 yalign 0.1
Code: Select all
default time_remaining = 0 label start: "You reached the market district, and you decide to..." $time_remaining = 10 show screen counterdisplay() $ ui.timer(10.0, ui.jumps("tooslow")) menu: "Follow Cristiander": jump cristiander "Follow Indoneko": jump indoneko label tooslow: hide screen counterdisplay "You're too slow and you lost both of them!" return label cristiander: hide screen counterdisplay "You follow cristiander to the church..." return label indoneko: hide screen counterdisplay "You follow indoneko to the pet shop..." return
That should work perfectly! Thank you! ^_^
[Edit] Yup, it works! Thank you ^_^
Who is online
Users browsing this forum: Google [Bot]