Page 1 of 1

Menu syntax

Posted: Tue Mar 08, 2022 7:49 am
by infructescence
Hello! This is maybe a silly question, but I haven't found the answer anywhere so I thought I'd ask here.

Basically, when I look up tutorials and things about creating a menu, most examples I see are formatted like this:

Code: Select all

label menuexample:

    menu:

        "Choice 1":

            jump choice1

        "Choice 2":

            jump choice2

label choice1:

    "This is what happens here."

    jump nextlabel

label choice2:

    "Something else happens here."

    jump nextlabel

label nextlabel:

    "The game continues here."
My question is, is there any reason why it shouldn't be formatted like this?:

Code: Select all

label menuexample:

    menu:

        "Choice 1":

            "This is what happens here."

            jump nextlabel

        "Choice 2":

            "Something else happens here."

            jump nextlabel

label nextlabel:

    "The game continues here."
Is it one of these things where it is personal preference or is the first way more "correct" and if so, why?

Re: Menu syntax

Posted: Tue Mar 08, 2022 7:57 am
by Ocelot
You don't even need nextlabel:

Code: Select all

label menuexample:
    menu:
        "Choice 1":
            "This is what happens here."
        "Choice 2":
            "Something else happens here."
    "The game continues here."
Generally it is a matter of preference. However:
1) If you move choice actions in their own label, you can jump to it from somewhere else. It helps, if you have something which should be called from several places.
2) If your action is big, it is harder to reason about menu as a whole: imagine each choice having over 100 lines, you wouldn't be able to see all possible choices on same screen when editing.

Re: Menu syntax

Posted: Tue Mar 08, 2022 7:59 am
by infructescence
Thank you so much! You answered exactly what I was wondering about.