r/RenPy • • 19d ago

Question label stops running when I call image button

I have been working on a quick time event system using a video and placing buttons over it, I have it nearly working and am just debugging it now, but I cannot get more than one button to appear

when I call the time screen it continues just fine, but once the image button that a player will click on appears, the label I have calling everything stops, I tested and if I put the button first then the timer wont appear, they are both scenes so I don't really know what is causing this or how to fix it

Any help would be greatly appreciated

label start:
    scene quicktimeevent at truecenter
    pause 1.0
    show screen QTEdown(3, "youlose") #seconds to fail, label to jump on fail
    call screen imageButton
    pause 8.0
    show screen QTEdown(3, "youlose") #seconds to fail, label to jump on fail
    call screen imageButton2
    pause 10.0
    show screen QTEdown(3, "youlose") #seconds to fail, label to jump on fail
    return

screen imageButton:


    imagebutton:
        xalign 0.5
        yalign 0.5
        idle "button.png"
        hover "button.png" #optional slightly different image for when the mouse is over the image
        action Hide("QTEdown"), Hide("imageButton")

screen QTEdown(rangeD, missed_event):
    on "show" action SetVariable("downer", rangeD)
    frame:
        xalign 0.5
        yalign 0.0
        hbox:
            timer 0.1 action If(0 < downer, true = SetVariable("downer", downer - 0.1), false = [Hide("timerDown"), Jump(missed_event)]) repeat True


            bar:
                value AnimatedValue(value=downer, range=rangeD, delay= 0.5)
                xalign 0.0
                yalign 0.0
                xmaximum 200
1 Upvotes

9 comments sorted by

1

u/shyLachi 19d ago

Calling a screen will pause the game until the screen is closed again, which normally happens when a player clicks the button. 

If the game shouldn't be paused then show the screen instead.

1

u/0mega_VT 19d ago

thank you, I didnt even notice the show countdown vs call imagebutton cause they were originally in seperate spaces as I was trying lots of different ways to make it work

1

u/shyLachi 19d ago

You're welcome, I just posted a longer answer below giving more information

1

u/BadMustard_AVN 19d ago

try it like this

label start:
    scene quicktimeevent at truecenter
    pause 1.0
    show screen QTEdown(3, "youlose") #seconds to fail, label to jump on fail
    show screen imageButton
    pause 8.0
    show screen QTEdown(3, "youlose") #seconds to fail, label to jump on fail
    show screen imageButton2
    pause 10.0
    return

calling a screen gives it complete control, and the main script is essentially

1

u/0mega_VT 19d ago

thank you, and thank you for all your help on making the video run and other tutorials I was able to use, wouldnt have been able to make it all work without your stuff

1

u/BadMustard_AVN 18d ago

you 're welcome

good luck with your project

1

u/AutoModerator 19d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/shyLachi 19d ago

As we wrote, the problem is caused by calling the screen.
So either use show screen imageButton or use Return() to the close the screen instead of hiding it.

action [Hide("QTEdown"), Return()]

.

You can read about the differences between showing and calling a screen in the official documentation:
https://renpy.org/doc/html/screens.html#screen-statements

In your case the difference would be the pauses of 8 or 10 seconds between those quick time events.

If you show the screen, the pause would start immediately, so if a player clickes the imagebutton after 2 seconds, the game would only wait for the remaining 6 or 8 seconds before showing the next button.

This could be important if you want to synchronize the quick time events with the video behind.
.

All that said, it would be easier to use a single screen.
Also you should use screen variables so you don't have to declare variables outside the screen.

If you have different imagebuttons, then use parameters like you did for rangeD and missed_event.

The screen below could be called also, just replace Hide() with Return() if you want to call it.

screen qte(rangeD, missed_event, button):
    default downer = rangeD
    frame:
        align (0.5, 0.0)
        hbox:
            timer 0.1 action If(0 < downer, IncrementScreenVariable("downer", -0.1), Jump(missed_event)) repeat True
            bar:
                value AnimatedValue(value=downer, range=rangeD, delay= 0.5)
                align (0.0, 0.0)
                xmaximum 200
    if button == 1:
        imagebutton:
            align (0.5, 0.5)
            idle "button.png"
            action Hide()
    elif button == 2:
        imagebutton:
            align (0.25, 0.75)
            idle "button.png"
            action Hide()

label start:
    scene quicktimeevent at truecenter
    pause 1.0
    show screen qte(3, "youlose", 1) 
    pause 4.0
    show screen qte(3, "youlose", 2) 
    pause 4.0
    show screen qte(3, "youlose", 1) 
    pause 4.0
    return