Page 1 of 1

[SOLVED!] Looping Back to the same menu with variable text

Posted: Sun Jun 17, 2018 10:37 pm
by sasquatchii
Hi, I'm working on a game about Laika the Soviet space dog, in which you play from Laika's point of view.

I have this menu that they player runs through in which they have to go through each menu choice before they can progress with the rest of the story. Here is what it looks like coded so far:

Code: Select all

menu think:
    laikasc "[thinking_text]"
    "Home" if home_action_done == False:
            $ home_action_done = True
            $ thinking_text = "I should think about something else right now."
            jump home
    "The trip out" if trip_action_done == False:
            $ trip_action_done = True
            $ thinking_text = "I should think about something else right now."
            jump trip
    "The Big Noise" if noise_action_done == False:
            $ noise_action_done = True
            $ thinking_text = "I should think about something else right now."
            jump noise
My question is, each time the player comes back to the menu - I want there to be a bit of text describing Laika's health condition inside of Sputnik 2.

I would like to have this done 2 parts, with the player reading one part and then the other the first and second time they come back to this menu. They player can play through these choices in whatever order they want. I am wondering how to add the description text of Laika's condition for the first and second time that they revisit this menu?

Thank you for reading! Any ideas or insights would be much appreciated.

Re: Looping Back to the same menu with variable text

Posted: Sun Jun 17, 2018 11:13 pm
by PyTom
I love and hate this story.

So, the way I'd do this is to move the label outside the menu, and simply increment a number each time the player makes it through the loop.

First off, initialize a counter:

Code: Select all

default thought = 0

Then increment it by one each time you go through label think.

Code: Select all

label think:
    $ thought += 1

    if thought == 2:
        laikasc "-_-"
    elif thought == 3:
       laikasc ";_;"

menu:
    "Home" if home_action_done == False:
            $ home_action_done = True
            jump home
    "The trip out" if trip_action_done == False:
            $ trip_action_done = True
            jump trip
    "The Big Noise" if noise_action_done == False:
            $ noise_action_done = True
            jump noise

Re: Looping Back to the same menu with variable text

Posted: Mon Jun 18, 2018 9:32 pm
by sasquatchii
PyTom wrote: Sun Jun 17, 2018 11:13 pm I love and hate this story.

So, the way I'd do this is to move the label outside the menu, and simply increment a number each time the player makes it through the loop.

First off, initialize a counter:

Code: Select all

default thought = 0

Then increment it by one each time you go through label think.

Code: Select all

label think:
    $ thought += 1

    if thought == 2:
        laikasc "-_-"
    elif thought == 3:
       laikasc ";_;"

menu:
    "Home" if home_action_done == False:
            $ home_action_done = True
            jump home
    "The trip out" if trip_action_done == False:
            $ trip_action_done = True
            jump trip
    "The Big Noise" if noise_action_done == False:
            $ noise_action_done = True
            jump noise
That worked perfectly, thank you so much, PyTom!!!!

And I hope that if you do end up playing it once it's done that it does not disappoint :)