Problem having variable reliant menu options appear[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
User avatar
KarmaLarma
Newbie
Posts: 23
Joined: Wed May 10, 2017 11:40 pm
Projects: Deadly Vice
Tumblr: karmalarma
Deviantart: karmalarma
itch: karmalarma
Contact:

Problem having variable reliant menu options appear[SOLVED]

#1 Post by KarmaLarma »

Been a while since I used this board! I'm currently working on an introductory scene for my VN to get all the features I'll need later in the game working. One feature that is very important to the game is having certain menu options hidden or showing based on the score of a particular variable that changes with certain decisions.
I currently have the variable up and working, but making the game acknowledge this is giving me some trouble.

The base number for the variable is 50 and in this scene you can lower it or raise it by five. So the decisions the vn makes from there would be based on whether the variable is higher or lower than 50 in particular. However, using the >= and <= didn't work for me and I wound up having to check for the exact number in order for a fork in the scene to work.

Code: Select all

    b "So, for example, if you were on the beach and saw what you thought was a shark in the water, would you alert everyone, or try to tell the lifeguard?"

    if brash ==55:
        jump brashshark

    elif brash ==45:
        jump subtleshark
While that works for this scene where there are only two possible number totals, later in the game it won't be possible to determine what the exact total will be for each combination of possible decisions. So I tried doing it the way I did before for this decision menu.

Code: Select all

    menu:
        "Point them out." if brash >= 50:
            mc "I point them out to security or the teller. It's their job to know what to do; not mine."
            jump predictable
        "Leave." if brash <= 50:
            mc "I leave the bank. If they go inside and I hear a commotion, I'll call the police then."
            jump predictable
        "Ignore them.":
            mc "I ignore them. Who knows why they're out there? No bank robber is stupid enough to just wait around in their car in their masks."
            jump ignorebank
        "I don't know.":
            mc "I would probably umm... I don't know. That's a weird, scary situation to be in."
            jump indecisive
However, even if I choose the options that give me 55 points before this menu comes up, the Leave option is the only special option to show. What am I doing wrong?
Last edited by KarmaLarma on Tue Mar 06, 2018 10:52 pm, edited 2 times in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Problem having variable reliant menu options appear

#2 Post by Milkymalk »

Are you sure brash is really set to 55? Maybe check with a dialogue line right before the menu:
mc "brash is [brash]"
Because obviously, it works in theory, it just chooses the wrong one to display. What is the script where you set it?
Last edited by Milkymalk on Tue Mar 06, 2018 10:54 pm, edited 1 time in total.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
KarmaLarma
Newbie
Posts: 23
Joined: Wed May 10, 2017 11:40 pm
Projects: Deadly Vice
Tumblr: karmalarma
Deviantart: karmalarma
itch: karmalarma
Contact:

Re: Problem having variable reliant menu options appear

#3 Post by KarmaLarma »

Oof, now I feel dumb! It turns out I had set the initial number to 50 in the main script file, but hadn't saved it. So it was still open and still said 50, but the game was still reading as 5 from the first time I wrote it in pff.
Thank you for suggesting that! I didn't know you could check the value of a variable that way so it's still very useful to know. I wouldn't have realized the problem without the character letting me know it was only adding up to 10. ^^;

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Problem having variable reliant menu options appear[SOLVED]

#4 Post by Milkymalk »

Never forget to save your progress ;)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: Google [Bot]