Timing commands withing the action statement?

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
Bartulisica
Regular
Posts: 93
Joined: Sun Aug 30, 2015 5:11 am
Organization: ArizonaIdentities
Location: Croatia
Discord: ArizonaIdentities
Contact:

Timing commands withing the action statement?

#1 Post by Bartulisica »

Hey,

I wonder if it is possible in ren'py to make multiple things within action statement, but not instantly.
For example, when I hit "A" i want to change the picture of item, wait for 1 sec and hide the item completely.
Can that be done?
- ArizonaIdentities

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Timing commands withing the action statement?

#2 Post by indoneko »

I'm not sure what you really want, but how about putting them inside a function/label that you can call whenever you need them?
My avatar is courtesy of Mellanthe

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Timing commands withing the action statement?

#3 Post by papiersam »

Can that be done?
Definitely:

Code: Select all

screen capture:
    
    if atime > 0:
        add im #image
        
    key "K_a" action [SetVariable('im', '#f00'), SetVariable('atime', 1)]
    
    if atime > 0:
        timer 1 repeat True action If('atime' > 0, true=SetVariable('atime', atime-1), false=NullAction())
            

label start:

    $im = "#fff"
    $atime = 0
    show screen capture
    
    "Press 'A' to change"
I don't know if that's how you're looking to do it, but it is very easily possible to do in many ways.

User avatar
Bartulisica
Regular
Posts: 93
Joined: Sun Aug 30, 2015 5:11 am
Organization: ArizonaIdentities
Location: Croatia
Discord: ArizonaIdentities
Contact:

Re: Timing commands withing the action statement?

#4 Post by Bartulisica »

Interesting, thanks this never crossed my mind. I made it with switching to label and then back to screen. It works now, only the script is a bit messy, but I'll keep your way in mind for next time :)
- ArizonaIdentities

Post Reply

Who is online

Users browsing this forum: Andredron, Donmai