so my menu flag isnt working [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
birdybirdnerd
Newbie
Posts: 7
Joined: Sun Jun 17, 2018 10:46 am
Tumblr: birdybirdnerd
Contact:

so my menu flag isnt working [SOLVED]

#1 Post by birdybirdnerd »

im messing around with menu flags, and so far theyve been working just fine, but this one for some reason isnt working like the others. i went through and checked and wrote it out the same as previous ones that were working, but this one is being stubborn and crashing the game

heres the code for reference

Code: Select all

menu:
    "Should I accept?"
    
    "Yes.":
        jump choice_dance
        
    "No.":
        jump choice_alone
        
label choice_dance:
    $ dance = True
    
    "I smile and take her hand."
    
    mc "I'd be honored." 
    
    "She leads me into the throng of things, where my friends and the other fauns are hooting and hollering, having a blast."
    
    jump choice10_done
    
label choice_alone:
    
    "I smile and shake my head."
    
    mc "Thanks, but I'm good here."
    
    f "Suit yourself. Come hit me up if you want to party!" 
    
    "She flashes a double thumbs up and wanders back into the throng of things, where my friends and the other fauns are hooting and hollering, having a blast."
    
    jump choice10_done
    
label choice10_done:
    
    "There's a live band performing, a collection of fauns with various woody instruments standing on a scattering of crates."
    "At one point, Domrick brings out his lute and joins them, to uproarious applause."
    "He's in his element, and it shows." 
    "The twins are away, showing off their magic tricks to a group of awed younger fauns."
    "Ghorza is being passed from partner to partner, everyone who dances with her doing so with stars in their eyes."
    "Sasha is leaning against a tree, a drink in her hand as she watches the group and nods her head to the music." 
    
if dance:
    "I'm having the time of my life."
    
    jump continue_party

else:
    "I've followed her example and found myself some snacks."
    
    jump continue_party
    
label continue_party:
    "Eventually there's a lull in the party and some people break away from the group to raid the snack table."
so yeah, it says 'dance' isnt defined, but i defined it right up there so im confused. i did the same exact thing with previous menu flags and it defined them just fine, but this ones being a butt. i can provide code for previous ones that have worked if yall wanna see what i mean, just let me know
Last edited by birdybirdnerd on Mon Jul 23, 2018 11:00 pm, edited 1 time in total.

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

Re: so my menu flag isnt working

#2 Post by Imperf3kt »

If you are only using $ dance=True, then that isn't actually defining the variable, but rather setting it to a value.
The fact that it works like this for other things, is just coincidental.

Add this before your start label

Code: Select all

default dance = False
You may wish to repeat the process for other variables you use. They may not pose an issue as is, but they will cause issues with loading a saved game.
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

birdybirdnerd
Newbie
Posts: 7
Joined: Sun Jun 17, 2018 10:46 am
Tumblr: birdybirdnerd
Contact:

Re: so my menu flag isnt working

#3 Post by birdybirdnerd »

alright so that worked and its working just fine now. i guess im just confused bc the tutorial that comes with the program didnt say anything about having to define the default like that. thanks though! ill go back and add in that for the others as well, since when playtesting after editing it did the same thing for a later-defined variable

i swear, this program is so weird sometimes

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

Re: so my menu flag isnt working

#4 Post by Imperf3kt »

Are you using the latest Ren'Py?
The tutorial should cover defaults and defining, but if infact it doesn't, then it may require editing.
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

birdybirdnerd
Newbie
Posts: 7
Joined: Sun Jun 17, 2018 10:46 am
Tumblr: birdybirdnerd
Contact:

Re: so my menu flag isnt working

#5 Post by birdybirdnerd »

thats a good point. not sure if they updated it since i downloaded it a few months ago, but the tutorial im using is labeled version 7.0.0.196.

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

Re: so my menu flag isnt working

#6 Post by Imperf3kt »

It should be included since about halfway through 6.99 IIRC.
When I'm at a computer eith Ren'Py installed, I'll take a look and mention it to Pytom if its not there or hard to find.
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

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: so my menu flag isnt working

#7 Post by Showsni »

So long as you define it at some point you should be fine. I think your code would have issues because on the "alone" branch you've skipped past defining it, so it never gets defined if they make that option. You can either set it to something at the start (like with default), or make sure it gets defined on every branch that ends up calling it.

Post Reply

Who is online

Users browsing this forum: DewyNebula, Google [Bot], juliaa__