Returning to Screen from Called Label

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
MrRogerSmith
Regular
Posts: 42
Joined: Fri Jan 21, 2022 8:58 pm
Projects: Leaving DNA
itch: impiousmonk
Contact:

Returning to Screen from Called Label

#1 Post by MrRogerSmith »

I've created a "Dreams" screen accessible from the Main Menu which allows the player to access one of nine bonus scenes, each unlockable through progressing in the game. Please note these are bonus scenes, not replayed scenes.

In order to access each bonus scene from the Dreams screen, I use "call" to move to the corresponding label. From what I've read, simply adding "return" to the end of the scene should take me back to the Dreams screen. But instead, "return" takes me to the "Start" label for the game.

I've also tried, in lieu of "return," using "show screen dreams." This does show the Dreams screen, but it also shows the text from the next bonus scene, and then clicking through takes the player again to the Start label. Here's my code for the Dreams screen:

Code: Select all

screen dreams:

    tag menu

    add gui.game_menu_background

    hbox:
        xalign 0.5
        yalign 0.5
        spacing 30
        grid 3 3:
            if persistent.unlock_1:
                imagebutton auto "unlocked1_%s" action Call("bonus_scene_1")
            else:
                image "lock1"
                pass
            if persistent.unlock_2:
                imagebutton auto "unlocked2_%s" action Call("bonus_scene_2")
            else:
                image "lock2"
                pass
            if persistent.unlock_3:
                imagebutton auto "unlocked3_%s" action Call("bonus_scene_3")
            else:
                image "lock3"
                pass
            if persistent.unlock_4:
                imagebutton auto "unlocked4_%s" action Call("bonus_scene_4")
            else:
                image "lock4"
                pass
            if persistent.unlock_5:
                imagebutton auto "unlocked5_%s" action Call("bonus_scene_5")
            else:
                image "lock5"
                pass
            if persistent.unlock_6:
                imagebutton auto "unlocked6_%s" action Call("bonus_scene61")
            else:
                image "lock6"
                pass
            if persistent.unlock_7:
                imagebutton auto "unlocked7_%s" action Call("bonus_scene_7")
            else:
                image "lock7"
                pass
            if persistent.unlock_8:
                imagebutton auto "unlocked8_%s" action Call("bonus_scene_8")
            else:
                image "lock8"
                pass
            if persistent.unlock_9:
                imagebutton auto "unlocked9_%s" action Call("bonus_scene_9")
            else:
                image "lock9"
                pass
            spacing 15
        textbutton "Return" action Return()
And for the bonus scenes:

Code: Select all

 label bonus_scene_1:

    xx "This is the beginning of the bonus scene."
    xx "This is the end of the bonus scene."
    $ renpy.pause()
    scene black
    return

label bonus_scene_2:

    xx "testing"
    return

label bonus_scene_3:

    xx "testing"
    return

label bonus_scene_4:

    xx "testing"
    return

label bonus_scene_5:

    xx "testing"
    return

label bonus_scene_6:

    xx "testing"
    return

label bonus_scene_7:

    xx "testing"
    return

label bonus_scene_8:

    xx "testing"
    return

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Returning to Screen from Called Label

#2 Post by enaielei »

Try using Start instead of Call.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Returning to Screen from Called Label

#3 Post by m_from_space »

MrRogerSmith wrote: Thu Sep 01, 2022 1:59 am

Code: Select all

            else:
                image "lock1"
                pass
Unrelated to your question I suggest doing:

Code: Select all

            else:
                add "lock1"

MrRogerSmith
Regular
Posts: 42
Joined: Fri Jan 21, 2022 8:58 pm
Projects: Leaving DNA
itch: impiousmonk
Contact:

Re: Returning to Screen from Called Label

#4 Post by MrRogerSmith »

enaielei wrote: Thu Sep 01, 2022 3:49 am Try using Start instead of Call.
Worked like a charm, thank you!

MrRogerSmith
Regular
Posts: 42
Joined: Fri Jan 21, 2022 8:58 pm
Projects: Leaving DNA
itch: impiousmonk
Contact:

Re: Returning to Screen from Called Label

#5 Post by MrRogerSmith »

m_from_space wrote: Thu Sep 01, 2022 2:27 pm
MrRogerSmith wrote: Thu Sep 01, 2022 1:59 am

Code: Select all

            else:
                image "lock1"
                pass
Unrelated to your question I suggest doing:

Code: Select all

            else:
                add "lock1"
Thank you, I changed it!

Post Reply

Who is online

Users browsing this forum: No registered users