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

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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

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

#1 Post 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.
Last edited by sasquatchii on Mon Jun 18, 2018 9:31 pm, edited 1 time in total.
ImageImage

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Looping Back to the same menu with variable text

#2 Post 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
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Looping Back to the same menu with variable text

#3 Post 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 :)
ImageImage

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Kocker