How to stop labels from playing early?

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
hrodohaidis
Newbie
Posts: 3
Joined: Tue Mar 24, 2015 11:29 am
Tumblr: aevintyrlost
Deviantart: aevintyrlost
Contact:

How to stop labels from playing early?

#1 Post by hrodohaidis »

Apologies for lack of a better title, I have no idea exactly what you would call this.
Also, a disclaimer that I'm completely a noob when it comes to programming and ren'py. This explanation will be confusing and full of idiotic mistakes.

Anyways, I've been trying to make a mystery-type game where the player has to explore a house and find clues. I'm sure there's a way to do this, but I haven't found anything online yet, so I went to make something myself.

My basic idea was that every room would have arrows (text buttons for now) pointing to new 'areas' to explore. Right now, I'm using screens to create a menu of options for the player to choose. (I hope this isn't confusing!)

This is my code... (in the screens.rpy)

Code: Select all

screen living_1_options:
    hbox:
        xpos 650
        ypos 410
        textbutton "right" action Jump("living_2")
        textbutton "piano" action Jump("living_piano")
        textbutton "kitchen" action Jump("kitchen_1")

screen living_2_options:
    fixed:
        textbutton "stairs" xalign 0.33 yalign 0.5 action Jump("living_stairs")
        textbutton "nook" xalign 0.33 yalign .75 action Jump("living_nook")
        textbutton "left" xalign 0.33 yalign 1 action Jump("living_1")
        
screen living_stairs_options:
    fixed:
        textbutton "up" xalign 0.33 yalign 0.5 action Jump("hall_1")
        textbutton "right" xalign 0.33 yalign .75 action Jump("living_2")
        textbutton "left" xalign 0.33 yalign 1 action Jump("living_1")
        
screen hall_1_options:
    fixed:
        textbutton "down" xalign 0.33 yalign 0.5 action Jump("living_stairs")
ignore the fact I only used hbox once, I was trying to experiment there...
That's how I did the menus, and then I implemented them like so... (in script.rpy)

Code: Select all

label living_1:
    scene living_1 with fade
    show screen living_1_options
    
label living_2:
    scene living_2 with fade
    show screen living_2_options

label living_stairs:
    scene living_stairs with fade
    show screen living_stairs_options
So far, I haven't gotten any error messages, but my issue is that the label 'living_1' or such will play, and the choices will be shown and selectable, but the label 'living_2' will play after the choices are shown, and those choices are shown as well, and the cycle continues with 'living_stairs'. Is there anyway to make the label "pause" and allow the player to make a choice without playing the other labels or is this impossible? Also, is there any code that allows exploration of areas better than this? Thank you!

User avatar
Queex
Regular
Posts: 46
Joined: Sat Mar 14, 2015 9:47 am
Contact:

Re: How to stop labels from playing early?

#2 Post by Queex »

By default, when ren'py reaches the end of one label, it will carry straight onto the next one.

Screens are probably not the way to approach this problem, actually, at least as a novice. the menu command offers choices and handles different branching, with simpler syntax.

Code: Select all

living_1:
    menu:
        "right":
            jump living_2
        "piano":
            jump living_piano
        "kitchen":
            jump kitchen_1

living_2:
    menu:
        "stairs":
            jump living_stairs
        "nook":
            jump living_nook
        "left":
            jump living_1

living_stairs:
    menu:
        "up":
            jump hall_1
        "right":
            jump living_2
        "left"
            jump living_1
That gives you the flow you want, and you can put scene statements and show statements wherever you need them in before of after the choices are shown.

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to stop labels from playing early?

#3 Post by philat »

I agree with Queex, but when you do want to fiddle with screens, try studying the code here: http://lemmasoft.renai.us/forums/viewto ... 51&t=20541

Post Reply

Who is online

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