How do I make a counting screen?

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.
Post Reply
Message
Author
Heisenraptor
Newbie
Posts: 9
Joined: Sun Jul 03, 2016 9:34 am
Contact:

How do I make a counting screen?

#1 Post by Heisenraptor »

Hey guys, I would like to make a screen that adds 1 to a variable every 1 second but I'm having some problems.
Here's what I did:
I created "$ number = 0"
I created "$ number_max = 60" so the maximum "number" can count to is 60

Then I created a counting screen:
screen counting:
if number < number_max:
timer 1.0 repeat True action SetVariable("number", +1)

And it doesn't work, I think it may be SetVariable's fault but screens don't accept "$ number += 1".
Can anyone help me?
Thank you!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How do I make a counting screen?

#2 Post by kivik »

What about:

Code: Select all

global number # not sure if you need this
timer 1.0 repeat True action SetVariable("number", number+1)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]