add variable every minute [SOLVED]
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.
-
de_nederlander
- Newbie
- Posts: 21
- Joined: Thu Aug 04, 2016 8:26 am
- Contact:
add variable every minute [SOLVED]
I wanted to make a script that would add a variable to another variable every minute.
for example I have variable "money" and I want to add variable "income" to it every 60 seconds, no matter on which label/screen the player currently is.
thanks for your help.
for example I have variable "money" and I want to add variable "income" to it every 60 seconds, no matter on which label/screen the player currently is.
thanks for your help.
Last edited by de_nederlander on Wed Aug 10, 2016 5:47 pm, edited 1 time in total.
Re: add variable every minute
I think timer is the way to do it:
https://www.renpy.org/doc/html/screens.html#timer
I think the code may look something like this:
https://www.renpy.org/doc/html/screens.html#timer
I think the code may look something like this:
Code: Select all
timer 60.0 repeat action SetVariable('money', money + income)-
de_nederlander
- Newbie
- Posts: 21
- Joined: Thu Aug 04, 2016 8:26 am
- Contact:
Re: add variable every minute
does this work no matter what screen you're on?kivik wrote:I think timer is the way to do it:
https://www.renpy.org/doc/html/screens.html#timer
I think the code may look something like this:
Code: Select all
timer 60.0 repeat action SetVariable('money', money + income)
-
de_nederlander
- Newbie
- Posts: 21
- Joined: Thu Aug 04, 2016 8:26 am
- Contact:
Re: add variable every minute
Code: Select all
timer 60.0 repeat action SetVariable('money', money + income)Re: add variable every minute
I'm afraid you'll have to test it yourself. I suspect what you can do is just add an invisible screen that's always showing but doesn't conflict with anything.de_nederlander wrote:does this work no matter what screen you're on?kivik wrote:I think timer is the way to do it:
https://www.renpy.org/doc/html/screens.html#timer
I think the code may look something like this:
Code: Select all
timer 60.0 repeat action SetVariable('money', money + income)
-
de_nederlander
- Newbie
- Posts: 21
- Joined: Thu Aug 04, 2016 8:26 am
- Contact:
Re: add variable every minute
and how does an invisible screen work?I'm afraid you'll have to test it yourself. I suspect what you can do is just add an invisible screen that's always showing but doesn't conflict with anything.
Re: add variable every minute
Basically have nothing but the timer in it. This is test code that worked for me:
Code: Select all
label start:
$ test_var = 0
show screen invi
pause
"[test_var]"
screen invi:
timer 1.0 repeat True action SetVariable("test_var", test_var+10)
-
de_nederlander
- Newbie
- Posts: 21
- Joined: Thu Aug 04, 2016 8:26 am
- Contact:
Re: add variable every minute
I think I can make it work with that, thanks.kivik wrote:Basically have nothing but the timer in it. This is test code that worked for me:
Code: Select all
label start: $ test_var = 0 show screen invi pause "[test_var]" screen invi: timer 1.0 repeat True action SetVariable("test_var", test_var+10)
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], span4ev