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.
How do you make a delay between displayables in a screen? I'm attempting to add an animation (ships_log_opening_anim_1) for my stats screen - it's a book opening - and delay any screen actions that come after it. As it is, the text buttons that come after load at the same time (obviously).
While you could use a timer I don't recommend that as it seems timer's are quite intensive.
Why not split the two? either have it on two screens, so on one screen you have the animation and then the other has buttons and you call it like:
show screen animation
pause 5#duration of animation
hide screen animation #this is so that if a player clicks he can skip the animation
call screen mainthingy
Or you can even avoid the screen for the animation and simply use an image but the same method as above:
show ships_log_opening_anim_1
pause 5
hide ships_log_opening_anim_1
call screen mainthingy
screen test_scr():
default flag_var = False # default value of screen variable
add 'ships_log_opening_anim_1' # show your animation
if not flag_var:
timer 5.0 action SetScreenVariable("flag_var", True) repeat False
else: # show some buttons
vbox:
textbutton "Test!" action NullAction()
Alex wrote: ↑Thu Jul 02, 2020 1:21 pm
You could make a variable to check if buttons should be shown or not, and a timer that will set the proper value to this variable.
screen test_scr():
default flag_var = False # default value of screen variable
add 'ships_log_opening_anim_1' # show your animation
if not flag_var:
timer 5.0 action SetScreenVariable("flag_var", True) repeat False
else: # show some buttons
vbox:
textbutton "Test!" action NullAction()
Thank you all. So far I've only tried Alex's approach, and it works great with one exception. The close button does not delay. Originally the close button had its own screen, but to try to make it delay with the other buttons I added it to the same screen. I'm including some screenshots and a larger section of code so I hopefully don't miss what's making this happen.
...
Edit: I forgot about the hud screen(s) I had made to call in these screens after adding open world gameplay. Removed the line to call close hud screen and that fixed it.
nananame wrote: ↑Thu Jul 02, 2020 2:20 am
While you could use a timer I don't recommend that as it seems timer's are quite intensive.
Why not split the two? either have it on two screens, so on one screen you have the animation and then the other has buttons and you call it like:
show screen animation
pause 5#duration of animation
hide screen animation #this is so that if a player clicks he can skip the animation
call screen mainthingy
Or you can even avoid the screen for the animation and simply use an image but the same method as above:
show ships_log_opening_anim_1
pause 5
hide ships_log_opening_anim_1
call screen mainthingy
So what happens here? Basically when you want to open the stat screen you go to the label. The label first shows the screen which has nothing but the animation and pauses for the duration of the animation. Once the animation is done (or the player clicks to interrupt it - you can put a hard pause too, but I suggest letting players skip it) the screen with the animation is hidden and the stat screen is called. This works fine but there's no real reason to have one screen just for the animation. So you can do the animation without a screen:
label open_stat_screen:
show ships_log_opening_anim_1 ###this is the animation you define with atl
pause 5
hide ships_log_opening_anim_1
call screen statpage
nananame wrote: ↑Tue Jul 07, 2020 3:42 am
Exactly what I wrote?
So, if you want to have it on two screens then when a button is clicked to open the stats screen you go to label open_stat_screen:
If I use jump to label in the stats screen the navigation screens (maybe even dialogue box) disappear and I end stuck on that screen without being able to do anything when I close the book.
And is there a way to include Alex's solution as one of the actions for a button? I'm trying to show one animation when flipping forward and another flipping backward upon return without having to duplicate the screens involved.