imagebuttons with timer element [SOLVED]

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.
Message
Author
User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: imagebuttons with timer element

#16 Post by xela »

DannyGMaster wrote: Mon Sep 18, 2017 4:06 pm I know this, that's why I had to use a global variable in my previous implementation, I forgot to change the code in that post too, that should be an If with SetVariable action. Anyway that one is too completely wrong.
As a general rule, keeping stuff local (if possible) is a better bet in 99.9% of all cases. Something along the lines of:

Code: Select all

SetScreenVariable("time_left", max(time_left-1, .001))
is something to consider before going global. It's a good setup as well, definitely with less interaction restarts, it doesn't feel like an issue here, but with loads of stuff on the screen, my example may cause lag, yours, if done properly will not (or at the very least less so).
Like what we're doing? Support us at:
Image

timdonehy200
Newbie
Posts: 20
Joined: Sun Mar 12, 2017 6:15 am
Deviantart: timdonehy200
Contact:

Re: imagebuttons with timer element

#17 Post by timdonehy200 »

Alright, thanks guys for taking the time to look into this issue, however I am quite confused as to which code to use right now, DannyGMaster's edited initial code or xela's code???
All the best

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: imagebuttons with timer element

#18 Post by xela »

Use my variant. Danny's approach is likely (likely because I have no idea if Ren'Py will recreate timers as it expects, never looked into that or tried doing it that way) workable as well, but it's unfinished. Mine version is ready to use, you should also be able to add to the value if some special button is clicked.
Like what we're doing? Support us at:
Image

timdonehy200
Newbie
Posts: 20
Joined: Sun Mar 12, 2017 6:15 am
Deviantart: timdonehy200
Contact:

Re: imagebuttons with timer element

#19 Post by timdonehy200 »

OK, thanks for your reply xela!
Tim

timdonehy200
Newbie
Posts: 20
Joined: Sun Mar 12, 2017 6:15 am
Deviantart: timdonehy200
Contact:

Re: imagebuttons with timer element

#20 Post by timdonehy200 »

Everything fell into place, thanks to you guys. I guess this topic could be marked as "solved" but I don't know to do that myself.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: imagebuttons with timer element

#21 Post by RicharDann »

timdonehy200 wrote: Wed Sep 20, 2017 8:40 am Everything fell into place, thanks to you guys. I guess this topic could be marked as "solved" but I don't know to do that myself.
I was troubled by that too. To do that go to your first post, edit it and change the title. Simply put "[SOLVED]"
or wathever you want before of after it and save it, that should do the trick. :wink:
The most important step is always the next one.

Post Reply

Who is online

Users browsing this forum: DewyNebula, Google [Bot]