adhd1357
adhd1357

Reputation: 1

I'm completely new to coding and renpy is testing me in ways I've never been tested

ok so I'm trying to give the player the option to pick multiple choices and the ones they choose I'll flag to use later in the game. But I don't want them picking the same option multiple times so I'm trying to say if it's flagged as true don't show the option again but idk it's not working. help?

Ive also tried flagging the original menu items as false but I just cant figure it out

Here's the code menu:

"a soda cap themed bottle opener": $ bottle_open = True jump boo

"fidget cube": $ fidget = True jump boo

"A bedazzled pepper spray can": $ pepper = True jump boo

"A tactical pocket knife (the knife part is broken)": $ knife = True jump boo

"A mini-figure of your favorite psychologist": $ freud = True jump boo

label boo: "and"

label keys: menu:

"A soda cap themed bottle opener" if bottle_open = False: $ bottle_open1 = True jump leave

"fidget cube" if fidget = False: $ fidget1 = True jump leave

"A bedazzled pepper spray can" if pepper = False: $ pepper1 = True jump leave

"A tactical pocket knife (the knife part is broken)" if knife = False: $ knife1 = True jump leave

"A mini-figure of your favorite psychologist" if freud = False: $ freud1 = True jump leave

label leave:

Upvotes: 0

Views: 74

Answers (1)

SilentStares
SilentStares

Reputation: 1

Hm it looks like there might be a few issues, I don't know if things are sending funny thanks to copy pasting to here, this is my first time posting here but...

here is a menu from one of my test games

menu :

    "What would you like to make?"
    "Go Collect Materials":
        jump materialcollect

    "Spear" if "Rock" and "Stick" in items:
        $ items.append("Spear")
        "You've made a spear!"
        $ items.remove("Rock")
        $ items.remove("Stick")

    "Axe" if "Rock" and "Stick" in items:
        $ items.append("Axe")
        "you've made an Axe!"
        $ items.remove("Rock")
        $ items.remove("Stick")
    "hammer" if "Rock" and "Stick" in items:
        $ items.append("Hammer")
        "you've made a Hammer!"
        $ items.remove("Rock")
        $ items.remove("Stick")

    "HammerAxe" if "Axe" and "Hammer" in items:
        $ items.append("HammerAxe")
        $ items.remove("Hammer")
        $ items.remove("Axe")
        "youve made the Hammer Axe! you sucessfully combined two items!"

now look at this

notice first that the ":" is at the very end after your variable and that you have to make sure its indented properly

also you could define it as this if youre checking whats in a list BUT in your case you'd probably write it a bit differently so heres my code

    "Axe" if "Rock" and "Stick" in items:
        $ items.append("Axe")
        "you've made an Axe!"
        $ items.remove("Rock")
        $ items.remove("Stick")

and heres how i'd write yours

menu:

"a soda cap themed bottle opener" if bottle_open == True: jump boo (note: the double equal sign is used for checking if something is equal!) (Singular is for changing the variable! if i remember correctly)

Which by the way means you can do things like if bottle_open != True: it will read it as "if bottle_open ISINT True" (the exclamation mark next to the equal sign is checking if its NOT equal) that's why its important that the double equal sign is used, so you can define it more freely

on that note you can also do >= and <= to ask is it greater than or equal to a number when using numbers!

Also it looks to me like you might be trying to make a sort of inventory like thing in which case you might want to make a list by using

default items = []

then using $ items.append("Spear") and $ items.remove("Stick") (as examples) to add and remove things from your inventory (like i showed here) so that you can check if something is in the inventory (you can see how to do that by looking at my code above) or not when you need to use the items.

Also the option will only show up if the conditions are fulfilled

Upvotes: 0

Related Questions