[SOLVED]Making Text Auto Forward With 1 Second 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
Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

[SOLVED]Making Text Auto Forward With 1 Second Delay

#1 Post by Nero »

So I'm trying to do something basic I'm not quite sure how to do it. So in Function I need to make text to appear 1 after another with 1 second delay and disabled clicking in meantime.

Here is the example so you get the idea. What I'm trying to do is when player turn is over I want AI mode to be active for few second until computer is finished with his move.

Code: Select all

        def ENEMY_ATTACK_AI(self):       
            renpy.say(narrator,"First Attack! Wait 1 second disable clicking now automatically proceed to Second Attack!")
            renpy.say(narrator,"Second Attack! Wait 1 seconds disable clicking now automatically proceed to Third Attack!")
            renpy.say(narrator,"Third Attack! Wait 1 seconds disable clicking now automatically end turn or whatever...")  
Last edited by Nero on Sun Aug 13, 2017 12:38 pm, edited 1 time in total.

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: Making Text Auto Forward With 1 Second Delay

#2 Post by Nero »

Ok I figured out how to implement 1 second wait. Now only question is how do I make text to automatically go forward after 1 second of sleep:

Code: Select all

        def ENEMY_ATTACK_AI(self):       
            from time import sleep
            sleep(1.0)
            renpy.say(narrator,"First Attack! Wait 1 second disable clicking now automatically proceed to Second Attack!")
            sleep(1.0)
            renpy.say(narrator,"Second Attack! Wait 1 seconds disable clicking now automatically proceed to Third Attack!")
            sleep(1.0)
            renpy.say(narrator,"Third Attack! Wait 1 seconds disable clicking now automatically end turn or whatever...")  

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: Making Text Auto Forward With 1 Second Delay

#3 Post by Nero »

Ok this is exact thing I want but in python function and non breakable when you click it... I haven't found a single post that explains how to make this...

Code: Select all

label start:
   
"Line 1{w=1.0}{nw}"
"Line 2{w=1.0}{nw}"
"Line 3 is much longer, so let's give it more time.{w=4.0}{nw}"

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: Making Text Auto Forward With 1 Second Delay

#4 Post by Nero »

Anyone? Really need help on this one no guides no tips can't figure it out... Advice at least anything?

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: Making Text Auto Forward With 1 Second Delay

#5 Post by Remix »

Try interact=False in the calls

renpy.say(narrator,"First Attack! Wait 1 second disable clicking now automatically proceed to Second Attack!", interact=False)
... perhaps with
renpy.pause(1.0, hard=True)
rather than importing time

If that doesn't work, have you tried {nw} etc within the strings in the calls?
Frameworks & Scriptlets:

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: Making Text Auto Forward With 1 Second Delay

#6 Post by Nero »

That's the exact thing I wanted works flawless! Thanks a lot I'm so happy now though I would get stuck with this problem forever! :D

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: [SOLVED]Making Text Auto Forward With 1 Second Delay

#7 Post by Remix »

On an aside, I think you can even define a character with the interact keyword arg, so you *could* save time by defining a new narrator...

define attack_narrator = Character(None, kind=adv, what_style='say_thought', interact=False) # etc
init python:
....renpy.pure('attack_narrator')

Glad it worked anyway :)
Frameworks & Scriptlets:

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: [SOLVED]Making Text Auto Forward With 1 Second Delay

#8 Post by Nero »

Even better! That's a good tip im going to do that instead

Post Reply

Who is online

Users browsing this forum: Google [Bot]