How would I make a time delay?

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
Savage Bananas
Newbie
Posts: 3
Joined: Wed Mar 06, 2019 6:08 pm
Projects: project yinGod
Contact:

How would I make a time delay?

#1 Post by Savage Bananas »

Is there a way to make a time delay in renpy? How would I like make it so that after a character's dialouge shows up, a given amount of seconds later maybe the screen or something would change? Renpy is very based around the user having to click for changes to happen, but a time delay would be great. I've been using something like:

( A is some character btw)

----------------------------------------

A "hi"

python:
import time
time.sleep(5)

A "This is after 5 seconds"

---------------------------------------

So, what would happen here is that A would say hi, and 5 seconds later A would say "This is after 5 seconds". All good right? no, because if I click during any of those 5 seconds, it would think I have already clicked for the "this is after 5 seconds" and it would move on to other later dialouge. Is there any better way to do this?
Pls halppppp me

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: How would I make a time delay?

#2 Post by Per K Grok »

Savage Bananas wrote: Mon Mar 18, 2019 5:43 pm Is there a way to make a time delay in renpy? How would I like make it so that after a character's dialouge shows up, a given amount of seconds later maybe the screen or something would change? Renpy is very based around the user having to click for changes to happen, but a time delay would be great. I've been using something like:

( A is some character btw)

----------------------------------------

A "hi"

python:
import time
time.sleep(5)

A "This is after 5 seconds"

---------------------------------------

So, what would happen here is that A would say hi, and 5 seconds later A would say "This is after 5 seconds". All good right? no, because if I click during any of those 5 seconds, it would think I have already clicked for the "this is after 5 seconds" and it would move on to other later dialouge. Is there any better way to do this?
Pls halppppp me
You could do something like this

Code: Select all

    python:
        renpy.say(A, "Hi", interact=False)
        renpy.pause(delay=5.0, hard=True)
        renpy.say(A, "This is 5 seconds later.", interact=True)
more on renpy.say here
https://www.renpy.org/doc/html/statemen ... #renpy.say

more on renpy.pause here
https://www.renpy.org/doc/html/other.ht ... enpy.pause
and why hard pause is not encouraged.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How would I make a time delay?

#3 Post by Remix »

Or use {w=5.0} tag to make it wait 5 seconds then {nw} tag to make the dialogue not need interaction:

Code: Select all

label start:

    e "Hi{w=2.0}{nw}"
    e "There{w=2.0}{nw}"
    e "Stranger"
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Google [Bot]