ATL pausing on triggered scene change

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
cskin
Newbie
Posts: 5
Joined: Mon Jul 12, 2021 9:51 am
Contact:

ATL pausing on triggered scene change

#1 Post by cskin »

Ok. So first some code. I have...

Code: Select all

screen Nbutton(coords,buttontimer):
    button:
        keysym ["K_RETURN", "K_v", "K_h", "K_m", "K_f", "mousedown_4", "mouseup_4", "mousedown_2", "mouseup_2"]
        action NullAction()
    imagebutton:
        idle "n"
        pos coords
        action SetVariable("keypress",keypress+1),If(strkey > 3, SetVariable("strkey",  1),  SetVariable("strkey", strkey + 1)), If(keypress >= 100, Jump("strtime.win"))
        keysym "K_n", "mouseup_1"
    timer buttontimer action Return(True)
later on:

Code: Select all

image n:
    "n.png"
    yanchor 0.5
    xanchor 0.5
    zoom 0.75
    pause .15
    zoom 1
    pause .15
    repeat
default strkey = 1

image testbg = ConditionSwitch (
    "strkey == 1","testbg.png",
    "strkey == 2","testbg2.png",
    "True","testbg3.png"
    )
and right before I call the screen:

Code: Select all

scene testbg
So what's happening: An animated image button appears on the screen for a number of seconds (passed to the screen, via buttontimer). Every press of the button increments a value, jumps to a label if the value hits 100, and also cycles through the testbg value.

Effectively, every time you press the button, the background changes, and a variable is incremented until it hits 100, then you jump to another part of the script.


The problem: Every time the background is changed, the ATL pauses. If I don't have the background changing, then the ATL works fine, but as soon as I add that, the ATL will pause on every button press.

My goal here is to be able to swap the background on every button press, and preserve the button animation. So far I've tried about 50 different things and none have worked. I'll prolly try another 50, but who knows how much luck I'll have there!

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

Re: ATL pausing on triggered scene change

#2 Post by Alex »

cskin wrote: Wed Jul 28, 2021 12:48 am ...My goal here is to be able to swap the background on every button press, and preserve the button animation. So far I've tried about 50 different things and none have worked. I'll prolly try another 50, but who knows how much luck I'll have there!
Try it like

Code: Select all

    button:
        add "n"
        pos coords
        action SetVariable("keypress",keypress+1),If(strkey > 3, SetVariable("strkey",  1),  SetVariable("strkey", strkey + 1)), If(keypress >= 100, Jump("strtime.win"))
        keysym "K_n", "mouseup_1"

cskin
Newbie
Posts: 5
Joined: Mon Jul 12, 2021 9:51 am
Contact:

Re: ATL pausing on triggered scene change

#3 Post by cskin »

Alex, I love you. I also feel dumb. The first thing I did was tried using add, except in the wrong way, and way more complex.

I think i did....

Code: Select all

add testbg zpos -1 zzoom True
in every screen. I think my next try was going to be to build a frame for everything, and add a background to it, and try it that way. No clue how that would have turned out but now I don't need to.

That works, thank you.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]