Can't go back to the previous videos

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
Adrian_DVL
Regular
Posts: 114
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Can't go back to the previous videos

#1 Post by Adrian_DVL » Wed Sep 01, 2021 12:33 pm

Hi!

Okay, here's the thing. I have a video based on several clips, each of them is triggered with a button that is unlocked by waiting a number of seconds after the start of the previous one. For that, I have a screen with timers, variables and buttons (maybe not the most efficient way to do this):

Code: Select all

screen op1sce1():
    zorder 1
    modal True

    timer 4.00 action If(time > 0, true=SetVariable('time', time - 0.01), false=[SetField(o1, "f1", True)])
    if o1.f2:
        timer 10.00 action If(time > 0, true=SetVariable('time', time - 0.01), false=[SetField(o1, "f3", True)])
    if o1.f4:
        timer 7.00 action If(time > 0, true=SetVariable('time', time - 0.01), false=[SetField(o1, "f5", True)])
...

    if o1.f1:
        imagebutton:
            at hp
            idle "but/licktip.png"
            hover "but/licktiph.png"
            pos (30, 90)
            action [Play("sound", "audio/clic.mp3"), SetField(o1, "f2", True), Show("op1sce1b")]

    if o1.f3:
        imagebutton:
            at hp
            idle "but/bothands.png"
            hover "but/bothandsh.png"
            pos (215, 90)
            action [Play("sound", "audio/clic.mp3"), SetField(o1, "f4", True), Show("op1sce1c")]

    if o1.f5:
        imagebutton:
            at hp
            idle "but/deeper.png"
            hover "but/deeperh.png"
            pos (400, 55)
            action [Play("sound", "audio/clic.mp3"), SetField(o1, "f6", True), Show("op1sce1d1")]
...
And then I have one screen for each clip, like this:

Code: Select all

screen op1sce1a():
    zorder 0
    modal False
    add Movie(size=(1600, 900))
    on "show" action Play("movie", "vid/op1s1a.webm", loop=True)
    on "hide" action Stop("movie")

screen op1sce1b():
    zorder 0
    modal False
    add Movie(size=(1600, 900))
    on "show" action Play("movie", "vid/op1s1b.webm", loop=True)
    on "hide" action Stop("movie")

screen op1sce1c():
    zorder 0
    modal False
    add Movie(size=(1600, 900))
    on "show" action Play("movie", "vid/op1s1c.webm", loop=True)
    on "hide" action Stop("movie")

screen op1sce1d1():
    zorder 0
    modal False
    add Movie(size=(1600, 900))
    on "show" action Play("movie", "vid/op1s1d1.webm", loop=True)
    on "hide" action Stop("movie")
    
...
And what I do is show the screen with the first clip and also call the screen with the timers and buttons, like this:

Code: Select all

show screen op1sce1a
call screen op1sce1
Now, everything seemed to work well, the first clip is showed properly, each timer works perfectly and the buttons too. Except I can't go back to the clips that I've already seen. Every time I click on a button whose screen I've already seen, nothing happens. Only the new buttons whose clips I've not seen seem to work. Why could this be?

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Can't go back to the previous videos

#2 Post by Alex » Wed Sep 01, 2021 2:27 pm

It looks like your screens with clips nether been hidden, so when you click button second time the screen still stands behind other screens.
Try to add the same tag for all screens with clips (like tag menu for all menus) - https://www.renpy.org/doc/html/screens. ... -statement

User avatar
Adrian_DVL
Regular
Posts: 114
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Re: Can't go back to the previous videos

#3 Post by Adrian_DVL » Wed Sep 01, 2021 2:40 pm

Alex wrote:
Wed Sep 01, 2021 2:27 pm
It looks like your screens with clips nether been hidden, so when you click button second time the screen still stands behind other screens.
Try to add the same tag for all screens with clips (like tag menu for all menus) - https://www.renpy.org/doc/html/screens. ... -statement
Yep, that's what happened. I created a function with renpy.hide_screen for each screen and call it inside the action of every button. Thanks Alex!

Post Reply

Who is online

Users browsing this forum: Google [Bot]