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: 60
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Pausing Timers

#1 Post by CalixtheGreat » Tue Oct 09, 2018 3:41 am

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
Regular
Posts: 176
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Pausing Timers

#2 Post by Andredron » Tue Oct 09, 2018 9:15 am

import time
CurrentTime = time.time()
while 1:
....CurrentTime = time.time()-CurrentTime
....print(CurrentTime)
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

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

Re: Pausing Timers

#3 Post by CalixtheGreat » 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?
Image
FB PAGE:
CALIX THE GREAT

User avatar
Andredron
Regular
Posts: 176
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Pausing Timers

#4 Post by Andredron » 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
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

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

Re: Pausing Timers

#5 Post by CalixtheGreat » Mon Oct 15, 2018 11:37 pm

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: 60
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Pausing Timers

#6 Post by CalixtheGreat » Mon Oct 15, 2018 11:38 pm

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: 255
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy, Эра Тёмных Небес
Organization: IKG
Location: St.Petersburg, Russia
Contact:

Re: Pausing Timers

#7 Post by IrinaLazareva » Wed Oct 17, 2018 3:04 pm

'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
There is a light at the end of the tunnel, just pray it's not a train.

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

Re: Pausing Timers

#8 Post by CalixtheGreat » Sat Oct 20, 2018 10:16 am

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

Post Reply

Who is online

Users browsing this forum: CalixtheGreat