Showing a new Menu once a goal is reached

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
Dreamulex
Newbie
Posts: 18
Joined: Tue Mar 14, 2017 3:50 pm
Tumblr: brixujel
Deviantart: brixujel
Contact:

Showing a new Menu once a goal is reached

#1 Post by Dreamulex »

for my game, once you talk to three people I want a new menu will show up. This will be determined by points. I'm not sure about what I did wrong. If there's more than one way to do this then that would be more than appreciated.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 107, in script
    return
Exception: Could not find return label (u'/Users/Brixujel/Desktop/Visual Novals/Stranded/game/script.rpy', 1492537627, 33).

Code: Select all

label selection:
    
        if leave >= 3:
            menu:
            
                "Nadsarx":
                     jump food_Suppies
                         
                "Luna":   
                     jump machine_check
                        
                "Makiri (In development)":
                     jump plan_out_route
            
        if leave >= 3:
            menu:             
                "Leave the Island (In development)":
                     jump leave 

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

Re: Showing a new Menu once a goal is reached

#2 Post by Imperf3kt »

Why do you have two ifs for the same thing?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Dreamulex
Newbie
Posts: 18
Joined: Tue Mar 14, 2017 3:50 pm
Tumblr: brixujel
Deviantart: brixujel
Contact:

Re: Showing a new Menu once a goal is reached

#3 Post by Dreamulex »

There is one for when they have the first option then there is another for when they have all the options
~Your imagination is your only Limitation~

jw2pfd
Regular
Posts: 87
Joined: Tue Sep 18, 2012 9:55 pm
Location: DFW, TX, USA
Contact:

Re: Showing a new Menu once a goal is reached

#4 Post by jw2pfd »

I think he is trying to point out that they're the same conditional:

Code: Select all

        if leave >= 3:
This means they're checking for exact the same condition instead of different ones. This isn't causing any sort of syntax error though. When does the error occur while the program is running? Is it right when the menu is supposed to display or at a different time?

User avatar
Saltome
Veteran
Posts: 244
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Showing a new Menu once a goal is reached

#5 Post by Saltome »

How about this?

Code: Select all

default talkedto = []
label start:
    if len(talkedto) == 3:
        "Talked to everyone."
        return
    menu:
        "People to talk to:"
        "Nadsarx":
            $ if "Nadsarx" not in talkedto : talkedto += ["Nadsarx"]
            "Talked to Nadsarx."
            #jump food_Suppies
                         
        "Luna":
            $ if "Luna" not in talkedto : talkedto += ["Luna"]
            "Talked to Luna."
            #jump machine_check
               
        "Makiri (In development)":
            $ if "Makiri" not in talkedto : talkedto += ["Makiri"]
            "Talked to Makiri."
            #jump plan_out_route
    jump start
    return
Deviant Art: Image
Discord: saltome
Itch: Phoenix Start

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

Re: Showing a new Menu once a goal is reached

#6 Post by Ocelot »

There is no need to emulate something RenPy already does:

Code: Select all

default talkedto = []
label start:
    menu:
        set talkedto
        "People to talk to:"
        "Nadsarx":
            "Talked to Nadsarx."
            #jump food_Suppies
                         
        "Luna":
            $ if "Luna" not in talkedto : talkedto += ["Luna"]
            "Talked to Luna."
            #jump machine_check
               
        "Makiri (In development)":
            "Talked to Makiri."
            #jump plan_out_route
        
        "Leave the Island (In development)" if len(talkedto) >= 3:
            'Left the island'
            return
    jump start
< < insert Rick Cook quote here > >

User avatar
Saltome
Veteran
Posts: 244
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Showing a new Menu once a goal is reached

#7 Post by Saltome »

Wait, what the heck is set?
I don't believe I have ever seen it before.
Is it mentioned anywhere in the docimentation?

Also you forgot to remove the one line.

Code: Select all

default talkedto = []
label start:
    menu:
        set talkedto
        "People to talk to:"
        "Nadsarx":
            "Talked to Nadsarx."
            #jump food_Suppies
                         
        "Luna":
            "Talked to Luna."
            #jump machine_check
               
        "Makiri (In development)":
            "Talked to Makiri."
            #jump plan_out_route
        
        "Leave the Island (In development)" if len(talkedto) >= 3:
            'Left the island'
            return
    jump start
Deviant Art: Image
Discord: saltome
Itch: Phoenix Start

Post Reply

Who is online

Users browsing this forum: No registered users