Looping menu decisions. (SOLVED)

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
Teluna
Newbie
Posts: 12
Joined: Tue Apr 07, 2009 2:46 am
Contact:

Looping menu decisions. (SOLVED)

#1 Post by Teluna »

How do I make a decision take you back to the same list? I want it so that you can keep choosing to stand in place like an goofball. The decision below would be "Continue standing".

Any help would be greatly appreciated.
menu first_choice:
mrn "(So...what should I do now?)"
"Take a seat near Kyle.":
k "“Hee hee, you smell funny, Mr.Nobody!”"
r "“Kyle.”"
k "“O-oh...s-sorry, daddy.”"
narrator "Kyle seems pleased, but his dad looks like he's ready to kill us both. For real."
p "“As I was saying...”"
narrator "The service continued for a solid hour. That's all you get for being a cop."
"Take the seat closest to you.":
narrator "I must smell terrible, because the man next to me looks like he's ready to puke."
narrator "Kyle also looks a little disappointed, but it would come on as kind of creepy of me to sit next to him, anyway."
nvl clear
"Continue standing.":
mrn "(The audience is continuing to stare my way menacingly.)"
p "“Is something wrong, Mr.Nobody?”"
jump menu first_choice
Last edited by Teluna on Wed Apr 22, 2009 7:44 pm, edited 1 time in total.

Dusty
Regular
Posts: 126
Joined: Fri Jul 25, 2008 11:51 pm
Contact:

Re: Looping menu decisions.

#2 Post by Dusty »

Code: Select all

label first_choice:
    menu:
        mrn "(So...what should I do now?)"
        "Take a seat near Kyle.":
            k "“Hee hee, you smell funny, Mr.Nobody!”"
            r "“Kyle.”"
            k "“O-oh...s-sorry, daddy.”"
            narrator "Kyle seems pleased, but his dad looks like he's ready to kill us both. For real."
            p "“As I was saying...”"
            narrator "The service continued for a solid hour. That's all you get for being a cop."
        "Take the seat closest to you.":
            narrator "I must smell terrible, because the man next to me looks like he's ready to puke."
            narrator "Kyle also looks a little disappointed, but it would come on as kind of creepy of me to sit next to him, anyway."
            nvl clear
        "Continue standing.":
            mrn "(The audience is continuing to stare my way menacingly.)"
            p "“Is something wrong, Mr.Nobody?”"
            jump first_choice
If you were doing what I think you were trying to do, try putting in a label: before the menu, and then jump to that label.

You can't name a menu and then jump to it; that doesn't work. You can only jump to a "label:"

p.s. next time, put your code in a

Code: Select all

[code]code block
[/code]not a
quote block
because it makes it easier to see the spacing. :)

Teluna
Newbie
Posts: 12
Joined: Tue Apr 07, 2009 2:46 am
Contact:

Re: Looping menu decisions.

#3 Post by Teluna »

Thank you, but now it's saying that:

'On line 99 of C:\Documents and Settings\Teagan\Blanket/game/script.rpy: choice menuitem expects a non-empty block.
"Take a seat near Kyle.":'

What does that mean? Also, here's how everything is set up for that scene.

Code: Select all

label first_choice:
    menu:
            mrn "(So...what should I do now?)"
            "Take a seat near Kyle.":
            k "“Hee hee, you smell funny, Mr.Nobody!”"
            r "“Kyle.”"
            k "“O-oh...s-sorry, daddy.”"
            narrator "Kyle seems pleased, but his dad looks like he's ready to kill us both. For real."
            nvl clear
            p "“As I was saying...”"
            narrator "The service continued for a solid hour. That's all you get for being a cop."
            nvl clear
            pass
            "Take the seat closest to you.":
            narrator "I must smell terrible, because the man next to me looks like he's ready to puke."
            narrator "Kyle also looks a little disappointed, but it would come on as kind of creepy of me to sit next to him, anyway."
            nvl clear
            pass
            "Continue standing.":
            mrn "(The audience is continuing to stare my way menacingly.)"
            p "“Is something wrong, Mr.Nobody?”"
            jump label first_choice:

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Looping menu decisions.

#4 Post by killdream »

You have to indent it properly. It is, commands for "Take a seat near kyle." must have more leading spaces than "Take a seat near kyle."

Also, you don't need that pass this command is just used when you have a block that don't have any commands, like:

Code: Select all

menu:
    "You see a cup of coffee on the table."
    "Take the cup of coffee":
        "You take the cup of coffe and drink it."
        "The taste is really good, somewhat bitter than what you're used too, but that fullfils you need of cafeine for the time being."
    "Bear that, I need to stop drinking so much coffee.":
        pass

# now we're out of the menu
"Someone calls you from the living room..."

Teluna
Newbie
Posts: 12
Joined: Tue Apr 07, 2009 2:46 am
Contact:

Re: Looping menu decisions.

#5 Post by Teluna »

It's still a no go, KD. Now it's giving me troubles with the jump command again. It seems as though I can't have one without the other. I'll post the error.txt and stuff, but I don't know how much that's going to help.

On the plus side, I think I have it indented properly this time. Let me know so I can continue to correct any unnecessary errors.

Code: Select all

label first_choice:
    menu:
        mrn "(So...what should I do now?)"
        "Take a seat near Kyle.":
                k "“Hee hee, you smell funny, Mr.Nobody!”"
                r "“Kyle.”"
                k "“O-oh...s-sorry, daddy.”"
                narrator "Kyle seems pleased, but his dad looks like he's ready to kill us both. For real."
                nvl clear
                p "“As I was saying...”"
                narrator "The service continued for a solid hour. That's all you get for being a cop."
                nvl clear
        "Take the seat closest to you.":
                narrator "I must smell terrible, because the man next to me looks like he's ready to puke."
                narrator "Kyle also looks a little disappointed, but it would come on as kind of creepy of me to sit next to him, anyway."
                nvl clear
        "Continue standing.":
                mrn "(The audience is continuing to stare my way menacingly.)"
                p "“Is something wrong, Mr.Nobody?”"
                jump first_choice:
Attachments
errors.txt
(283 Bytes) Downloaded 131 times

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Looping menu decisions.

#6 Post by killdream »

Yep, identation is properly.

The error is, "jump first_choice" doesn't have a ":" after it. The ":" is usually used to start a new block in python, and it's just accepted in block commands (it's not the case of jump, that is a in-line command)

And usually, the "^" indicates where's the error.

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Looping menu decisions.

#7 Post by Jake »

Teluna wrote:

Code: Select all

                jump first_choice:
You shouldn't have the colon on the end of the line with a 'jump'. Just "jump first_choice".

The colon says "a block of code is dependent on this line and follows immediately afterward". So there's a colon on a label statement, because there's a block of code that sits 'inside' that label; there's a colon on an if, because there's a block of code which only gets executed if the 'if' condition is true; there's a colon on a menu choice, because there's a block of code which only gets executed when that menu choice is selected... but the jump executes fine on its own, it doesn't need a block of code because that's found at the label you're jumping to, so you don't need the colon.
Server error: user 'Jake' not found

Teluna
Newbie
Posts: 12
Joined: Tue Apr 07, 2009 2:46 am
Contact:

Re: Looping menu decisions.

#8 Post by Teluna »

Works like a charm now. And now I know how to correct this problem if it happens again.

Thanks, guys. : D

Post Reply

Who is online

Users browsing this forum: No registered users