(FIXED; thank you all!) Newbie looking for help with menu options

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
QtPaTT
Newbie
Posts: 9
Joined: Sun Dec 30, 2018 3:03 pm
Contact:

(FIXED; thank you all!) Newbie looking for help with menu options

#1 Post by QtPaTT »

Hello! So, I am really new to coding and I have been having a lot of trouble with my menu stuff.

In simple terms, I have a menu with 2 options.
And I want to be able to pick one of the options, but automatically after that option is finished, it starts what would be the next option.
So, if you pick option one, you would go to option two automatically.
If you pick option two, you would go to option one automatically.
After both are done, there is one last option that only happens when you finished both of the options.

Do you know how I would code this?

You might have to really explain it to me because I am having a very hard time figuring this out :C

Thanks so much <3
Last edited by QtPaTT on Thu Oct 31, 2019 5:45 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Newbie looking for help with menu options

#2 Post by Per K Grok »

QtPaTT wrote: Wed Oct 30, 2019 5:57 pm Hello! So, I am really new to coding and I have been having a lot of trouble with my menu stuff.

In simple terms, I have a menu with 2 options.
And I want to be able to pick one of the options, but automatically after that option is finished, it starts what would be the next option.
So, if you pick option one, you would go to option two automatically.
If you pick option two, you would go to option one automatically.
After both are done, there is one last option that only happens when you finished both of the options.

Do you know how I would code this?

You might have to really explain it to me because I am having a very hard time figuring this out :C

Thanks so much <3
This should do what you are asking for.

Code: Select all

default goThree=0

label start:
   menu:
        "option one":
           jump onelabel
        "option two":
           jump twolabel

label onelabel:

    "This is option one"

    if goThree==0:
        $ goThree=1
        jump twolabel
    else:
        jump threelabel

label twolabel:

    "This is option two"

    if goThree==0:
        $ goThree=1
        jump onelabel
    else:
        jump threelabel

label threelabel:
    "this is the last label."
    $ goThree=0
    jump start
    

User avatar
Robitron
Newbie
Posts: 14
Joined: Thu Oct 24, 2019 11:53 am
Projects: Working on a VN called " Learning to Fly"
Organization: Just the author and myself so far
Tumblr: niftytron
Deviantart: Rob1tron
Github: Niftytron
itch: Rob1tron
Location: Florida for now...
Contact:

Re: Newbie looking for help with menu options

#3 Post by Robitron »

The really, really (I surprised myself by not overthinking this) simple answer is from the Ren'Py Launcher window select The Question, then open the script.rpy file. Your really simple explanation on how menus work is right there!

By the way, I'm new to Ren'Py as well!

8)
My Career and the first CGI movie comprise my name... Robitron 8)
Robi MUST remember to slow his brain down and actually READ his display fully!
Robi NEEDS to remember to post coding issues in the correct thread :oops:

User avatar
LexBit
Newbie
Posts: 5
Joined: Tue Oct 28, 2014 11:04 am
Projects: Celestial Navigator [WIP]
Location: Pennsylvania, USA
Contact:

Re: Newbie looking for help with menu options

#4 Post by LexBit »

Hello! I was looking for something similar that might be helpful if you wish to have more than two options. It's how to hide a choice after it is selected, so a user would go to a menu with 2+ options, select an option, and go back to the menu with the option they selected removed.

I found this answer on this thread.

Here is an example that is partially copied from that thread:

Code: Select all

default fruit_set = [ ] # This defines the array with nothing stored in it.

label fruit_menu_options:
    $ fruit_set = [ ]    
    menu fruits:    
        "What fruit should I eat?" # This line is placed after the menu is declared so it will show up with the options instead of before them.
        set fruit_set # This starts storing the options after they are selected, which will hide the options stored in the array when the user returns to this menu.

        "Apple":
            "Apples are good. I eat the apple."
            jump fruits

        "Pear":
            "Pears are tasty. I eat the pear."
            jump fruits

        "Orange":
            "Orange is okay. I eat the orange."
            jump fruits

# The following option only appears after all the other ones have been chosen. This is defined by 3, because there are 3 options to choose from. Change this number to the number of options if more/less options are added/removed.
        "No more fruit is left!" if len(fruit_set) >= 3:
            "I've eaten all the fruit. Oh well."
            return
I hope this helps, and good luck!

QtPaTT
Newbie
Posts: 9
Joined: Sun Dec 30, 2018 3:03 pm
Contact:

Re: Newbie looking for help with menu options

#5 Post by QtPaTT »

Per K Grok wrote: Wed Oct 30, 2019 6:26 pm
Thank you so very much <3

Post Reply

Who is online

Users browsing this forum: tim640