Ren'Py [SOLVED] Renpy - Make a screen skippable

dogcatbfg9000

DogCat
Game Developer
Jul 30, 2022
49
349
Hi everyone,

I hope that this is the right place to write this question.

I have a simple screen with an imagebutton and a dismiss displayable. My goal is to add it while a scene is called, and if the player doesn't press it, he will just continue with the story. Everything works OK thanks to the dismiss displayable, but if I return to this scene and click skip (ctrl), it won't continue, and I want it to continue.
Can I fix it somehow? Or is it a better way to do that?

The screen:

Python:
screen SomeScreen():

       dismiss action Return()

        imagebutton :
            idle "common/screens/gallery/gallery_images/someImage.png"
            action [Hide("SomeScreen", dissolve), Function(somefunction), Return()]
            xpos 15
            ypos 1320
The scene I want to call it:

Python:
scene SomeScene with dissolve
Some_character "There he is"
call screen SomeScreen
Thank you,
DogCat
 
Last edited:

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
You probably want to look into .
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,234
Everything works OK thanks to the dismiss displayable, but if I return to this scene and click skip (ctrl), it won't continue, and I want it to continue.
Hmm, what do you mean ? It continue skipping, it's just that by showing the screen with a dismiss, you explicitly ask the player for an input, and therefore Ren'Py stop, waiting for the said player input. But it will resume skipping once it got the said input.

By the way, you haven't tested what happen if the player effectively dismiss the screen...
Else you would have seen the obvious error in dismiss action Return(), since the screen would stay displayed.
Also, you don't need to call the screen, just showing it works as well.


You probably want to look into .
Effectively, this would probably bypass the "it's a choice, stop skipping" behavior. But what value to use ?
I mean, the player need to have the time to make his choice without pressure, without being stuck too long on the screen.

I think that the most appropriated answer would be to use neither dismiss nor timer:

Python:
screen SomeScreen():

    imagebutton:
        idle Solid( "#00000000" )
        xpos 0 ypos 0
        xsize config.screen_width
        ysize config.screen_height
        action Return()

    imagebutton :
        idle "common/screens/gallery/gallery_images/someImage.png"
        action [Function(somefunction), Return()]
        xpos 15
        ypos 1320

label whatever:
    show screen SomeScreen
    "blablabla"
    hide screen SomeScreen
This way, when not skipping, the player will have the choice between clicking on the imagebutton, what will trigger the action, or clicking outside, what will make the story progress.
But if Ren'Py is skipping, it will pass over the screen without stopping. What is the reason why the screen is hidden in the label, and not in the action properties, because none of them are performed.


This being said, it's an interesting way to hide bonus images in the game. But for any other use I highly advocate against this approach.
The skipping always need to be stopped when there's a choice to make, it's a question of respect for them. If they have to restart, or have more than one playthrough at a time, you don't force them to have to choice between skipping the whole content already and missing the optional actions.
 
  • Like
Reactions: dogcatbfg9000

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
Can you please elaborate? How will a timer help me?

Seems I read the easy bits of your post and my brain skipped past the difficult bit you were asking.

Let me see...

My goal is to add it while a scene is called...
Python:
    screen AutoDismissScreen():

        dismiss action Return()

        imagebutton :
            idle "common/screens/gallery/gallery_images/click1.png"
            action Function(somefunction)
            pos 15, 100

        imagebutton :
            idle "common/screens/gallery/gallery_images/dismiss.png"
            action Return()
            pos 15, 1320

... and if the player doesn't press it [within 5 seconds], he will just continue with the story.
Python:
    screen AutoDismissScreen():

        dismiss action Return()

        imagebutton :
            idle "common/screens/gallery/gallery_images/click1.png"
            action Function(somefunction)
            pos 15, 100

        imagebutton :
            idle "common/screens/gallery/gallery_images/dismiss.png"
            action Return()
            pos 15, 1320


        timer 5.0 action Return()

timer will do any action after the timer expires. The timer starts when the screen is displayed.

[...] if I return to this scene and click skip (ctrl), it won't continue, and I want it to continue.

And this is the bit I missed when I first read it. My bad.

There is also something called , which may be what you are looking for.
The documentation for it seems to imply you can use in addition to the physical key names. So skip as an alternative to ctrl.

Python:
    screen AutoDismissScreen():

        dismiss action Return()
        key "skip" action Return()

        imagebutton :
            idle "common/screens/gallery/gallery_images/click1.png"
            action Function(somefunction)
            pos 15, 100

        imagebutton :
            idle "common/screens/gallery/gallery_images/dismiss.png"
            action Return()
            pos 15, 1320


        timer 5.0 action Return()

What isn't clear to me, is what happens if the SKIP button is already in the "down" position when the screen is displayed. That is, if you're skipping past a load of things already - will it require you to release and re-press the button to trigger the action?
Maybe. (sorry, not able to test this code right now).
 
Last edited:

dogcatbfg9000

DogCat
Game Developer
Jul 30, 2022
49
349
Thank you for your answer Aon.

This being said, it's an interesting way to hide bonus images in the game. But for any other use I highly advocate against this approach.
The skipping always need to be stopped when there's a choice to make, it's a question of respect for them. If they have to restart, or have more than one playthrough at a time, you don't force them to have to choice between skipping the whole content already and missing the optional actions.
I wasn't clear enough. This is what I am trying to achieve. I want to hide bonus images.
It works. Thank you!
 
Last edited:

dogcatbfg9000

DogCat
Game Developer
Jul 30, 2022
49
349
Thank you for your answer 79flavors.

Python:
    screen AutoDismissScreen():

        dismiss action Return()
        key "skip" action Return()

        imagebutton :
            idle "common/screens/gallery/gallery_images/click1.png"
            action Function(somefunction)
            pos 15, 100

        imagebutton :
            idle "common/screens/gallery/gallery_images/dismiss.png"
            action Return()
            pos 15, 1320


        timer 5.0 action Return()

What isn't clear to me, is what happens if the SKIP button is already in the "down" position when the screen is displayed. That is, if you're skipping past a load of things already - will it require you to release and re-press the button to trigger the action?
Maybe. (sorry, not able to test this code right now).
I tested this code. It works if you press the skip button when the screen is shown/called. But when the skip button is already pressed while skipping a lot of content, it won't skip it. Only when you click on skip again. And I want it to skip if the skip button is already pressed.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
I was thinking perhaps you could swap call screen {screenname} for show screen {screenname}. Then have a hide screen {screenname} not long afterward.

But that doesn't really work either.
I'm not saying it's impossible. Perhaps Anne can think of something more exotic.

But... I think you're trying to work around what is "normal" for RenPy - which is that if you do a call screen {screenname}, then it waits for the user to interact with that screen.

The more I think about it, the more I think you'd be better spending time on the what a normal player would normally do (playing the game at a normal pace, reading and interacting slowly) - rather than the edge case of a developer testing and wanting to skip through content as quick as possible.

Hopefully someone else will think of something else I haven't.

Although you talk about a "bonus" image. If you're talking about some sort of "bonus popup" shown in the corner of the screen - that does fit with the whole show screen, with the screen being hidden on a timer or through a transition. But for that, you don't need a screen as such - just a displayable or image shown/hidden with a transition. Though the "popup" type display would work better with a screen, since it will persist past the next scene statement.
 
  • Like
Reactions: dogcatbfg9000

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,234
What isn't clear to me, is what happens if the SKIP button is already in the "down" position when the screen is displayed. [...]
If the screen have a dismiss statement, Ren'Py will react like when it encounter an input. Therefore the control is momentarily passed to the screen, and Ren'Py will resume skipping once it return at "label level".


Perhaps Anne can think of something more exotic.
Normally the trick I shown (the two imagebutton) should works. But I was still at work when writing it, so I don't guaranty it.
With a called screen, Ren'Py would stop skipping, but with a shown one it should behave like if there were no screen at all. Letting the player click on the imagebutton triggering the bonus, but also skipping through the screen if skip is enabled.