Pausing Timers

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
User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Pausing Timers

#1 Post by CalixtheGreat »

Good day.

Just want to ask if there's a way to pause the timer then resume it again at certain point of the game?

I also have some problems when it comes on showing the screen (timer) and another screen(dialogue) with some hyperlinks on it. The countdown timer works perfectly but I can't press the hyperlinks from the dialogues.

A sample code will be much appreciated.

Sorry if my english is not that good. Haha
Thanks in advance.
Image
FB PAGE:
CALIX THE GREAT

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Pausing Timers

#2 Post by Andredron »

import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#3 Post by CalixtheGreat »

Andredron wrote: Tue Oct 09, 2018 9:15 am import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)
So, what code will I type everytime I want to pause or resume the timer?
Image
FB PAGE:
CALIX THE GREAT

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Pausing Timers

#4 Post by Andredron »

CalixtheGreat wrote: Sat Oct 13, 2018 11:29 pm
Andredron wrote: Tue Oct 09, 2018 9:15 am import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)
So, what code will I type everytime I want to pause or resume the timer?

Read viewtopic.php?f=51&t=47774

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#5 Post by CalixtheGreat »

Andredron wrote: Mon Oct 15, 2018 2:18 pm
CalixtheGreat wrote: Sat Oct 13, 2018 11:29 pm
Andredron wrote: Tue Oct 09, 2018 9:15 am import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)
So, what code will I type everytime I want to pause or resume the timer?

Read viewtopic.php?f=51&t=47774
Oh. I'm talking about the screen timer. Like those in QTE but I want to know if there's a way to pause and resume the timer. 😅
Image
FB PAGE:
CALIX THE GREAT

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#6 Post by CalixtheGreat »

Andredron wrote: Mon Oct 15, 2018 2:18 pm
CalixtheGreat wrote: Sat Oct 13, 2018 11:29 pm
Andredron wrote: Tue Oct 09, 2018 9:15 am import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)
So, what code will I type everytime I want to pause or resume the timer?

Read viewtopic.php?f=51&t=47774
Oh. I'm talking about the screen timer. Like those in QTE but I want to know if there's a way to pause and resume the timer. 😅
Image
FB PAGE:
CALIX THE GREAT

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Pausing Timers

#7 Post by IrinaLazareva »

'pseudo-timer'

Code: Select all

default mzt = 10
default mzton = True
screen countdown():
    if mzton and mzt>0:
        timer 1 repeat True action SetVariable('mzt', mzt-1)
        
    if mzt>0:
        text '[mzt]' size 150 at truecenter
        textbutton 'Pause' action ToggleVariable('mzton') at right
    else:
        text 'K A B O O M  ! ! !' size 100 at letboom
        textbutton 'Get Out' action Quit(False) at right
        
transform letboom:
    align(.5, .5) zoom .0 alpha .0
    easein_bounce .7 zoom 1.0 alpha 1.0
    
label start:
    $ quick_menu = False
    call screen countdown
    return

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#8 Post by CalixtheGreat »

So, my problem about the timer was finally fixed. The only problem left is that, when I show the timer screen and the other screen (dialogue with hyperlink), I can't press the hyperlink anymore.

Here's the sample code I used in creating the screem with hyperlinks: viewtopic.php?t=51748
Image
FB PAGE:
CALIX THE GREAT

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#9 Post by CalixtheGreat »

Bump
Image
FB PAGE:
CALIX THE GREAT

Post Reply

Who is online

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