[Solved] Add "click to continue" content warning screen to splashscreen?

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
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

[Solved] Add "click to continue" content warning screen to splashscreen?

#1 Post by yon » Tue Aug 30, 2022 5:24 pm

I want to display a screen within my splashscreen that displays once, and does not continue until you click a button to proceed. This is because I want to display a content warning, so that the player must agree that they're willing to see that content.

I have the splashscreen, and I have the content warning screen, and that all works just fine. The issue is that it isn't waiting for the screen's buttons to be clicked before continuing. If I add a pause, it essentially makes you click twice to continue, for some reason. If I include no pause, it just displays the screen for a little bit, then automatically continues to the main menu.

It's also been skipping over the text after the conditional block, for some reason.

Here is the splashscreen:

Code: Select all

label splashscreen:

    scene black

    $ persistent.shown_warning = False # This is just so I can see it every time it starts up for testing purposes

    if not persistent.shown_warning:
        # Show warning here
        $ persistent.shown_warning = True
        show screen content_warning with dissolve


    show text "A story by Tetra Yon" at truecenter with dissolve
    with Pause(2)

    hide text with dissolve
    with Pause(1)

    return
And here is the screen:

Code: Select all

screen content_warning:

    frame:
        xsize 1280 # The BG image takes up the entire screen
        ysize 720
        xpos 0
        ypos 0
        padding (0, 0) # Manually reset padding
        background Frame("gui/overlay/pause_bg.png")

        vbox:
            text '{size=33}(Content warnings here, asks if you want to proceed){/size=33}':
                pos (370, 40)
                xsize 540 # sets line length
                text_align 0.5 # align center

        imagebutton:
            auto "gui/button/pause_button_left_%s.png"
            # YES button
            focus_mask True
            pos (370,440)
            action Return(), With(dissolve)

        imagebutton:
            auto "gui/button/pause_button_right_%s.png"
            # NO button
            focus_mask True
            pos (650,440)
            action Quit()

        text "{size=35}Yes{/size}":
            pos (380, 455)
            min_width 240 # sets line length
            text_align 0.5 # align center

        text "{size=35}No{/size}":
            pos (660, 455)
            min_width 240 # sets line length
            text_align 0.5 # align center
Last edited by yon on Thu Sep 01, 2022 12:22 am, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Add "click to continue" content warning screen to splashscreen?

#2 Post by Imperf3kt » Tue Aug 30, 2022 5:59 pm

The splash screen isn't really designed for this. It's also somewhat of a misnomer, being a label rather than a screen.

Instead, I would use label before_main_menu to call your content warning.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

User avatar
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Re: Add "click to continue" content warning screen to splashscreen?

#3 Post by yon » Tue Aug 30, 2022 6:54 pm

I tried swapping it with that label. It's still skipping directly through the content warning screen without stopping. It displays it for a second, and then goes away.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Add "click to continue" content warning screen to splashscreen?

#4 Post by Ocelot » Tue Aug 30, 2022 7:15 pm

Call screen instead of showing it. Right now you have nothing stopping the flow of the game.
IN addition, you should make screen modal, this should stop other interactions too.
< < insert Rick Cook quote here > >

User avatar
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Re: Add "click to continue" content warning screen to splashscreen?

#5 Post by yon » Tue Aug 30, 2022 7:32 pm

Thank you, call made the screen stick around.

Now I just need to make it not skip over the other text once you click "Yes".

I tried swapping Return() for Hide("content_warning") as the Yes button's action, but that just showed a black screen instead of progressing to the text.

Should I have it call the before_main_menu instead, so it'll skip the content warning and go straight to the "splash screen" text?

User avatar
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Re: Add "click to continue" content warning screen to splashscreen?

#6 Post by yon » Tue Aug 30, 2022 8:39 pm

I decided to put the text before the screen, and that seems to work, but I still don't know why it did that to begin with.

Here's what I'm using now:

Code: Select all

label before_main_menu:

    scene black with Pause(1)

    show text "A story by Tetra Yon" at truecenter with dissolve
    with Pause(2)

    hide text with dissolve
    with Pause(1)

    $ persistent.shown_warning = False # For testing purposes

    if not persistent.shown_warning:
        # Show warning here
        $ persistent.shown_warning = True
        call screen content_warning with dissolve

    return

Code: Select all

screen content_warning:

    modal True

    frame:
        xsize 1280
        ysize 720
        xpos 0
        ypos 0
        padding (0, 0) # Manually reset padding
        background Frame("gui/overlay/pause_bg.png")

        vbox:
            text '{size=33}(Content Warning){/size=33}':
                pos (370, 40)
                xsize 540 # sets line length
                text_align 0.5 # align center

        imagebutton:
            auto "gui/button/pause_button_left_%s.png"
            # YES button
            focus_mask True
            pos (370,440)
            action Return(), With(dissolve)

        imagebutton:
            auto "gui/button/pause_button_right_%s.png"
            # NO button
            focus_mask True
            pos (650,440)
            action Quit()

        text "{size=35}Yes{/size}":
            pos (380, 455)
            min_width 240 # sets line length
            text_align 0.5 # align center

        text "{size=35}No{/size}":
            pos (660, 455)
            min_width 240 # sets line length
            text_align 0.5 # align center

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot]