solved - Fourth variable not setting

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
AlienDucky
Newbie
Posts: 3
Joined: Sun Jul 26, 2020 12:58 pm
Contact:

solved - Fourth variable not setting

#1 Post by AlienDucky »

I have four paths a player could take in my game in any order, and the player is only going to get to do three of them before something different happens on the fourth day.

I'm able to set three of the paths as variables using:

Code: Select all

label forest:
    if days == 1:
        $ choice_1 = 'forest'
    if days == 2:
        $ choice_2 = 'forest'
    if days == 3:
        $ choice_3 = 'forest'
    
    scene bg_forest
    show player at left
    $ forest -= 1
    $ daypts += 11'
on each of the four paths, but when I then try to set choice 4 at the end of the third day using:

Code: Select all

label end_of_day_three:
    scene bg_inside_house
    
    $ day3pts = daypts
    
    if 'forest' == 1:
        $ choice_4 = 'forest'
    elif 'waterfall' == 1:
        $ choice_4 = 'waterfall'
    elif 'castle' == 1:
        $ choice_4 = 'castle'
    elif 'caves' == 1:
        $ choice_4 = 'caves'
    
    n "Oooooh! My feet hurt after looking around [choice_3] all day."
    n "But I've still got the [choice_4] left to explore, so it's time for me to turn the lights off..."
    jump day_four
I get nothing
20200806 variables.PNG
I made that screen in the corner to help me keep track, so I can see caves = 1 and so should be turning into choice_4. Right?
All other inserted variables are showing up as they should
Last edited by AlienDucky on Thu Aug 06, 2020 9:38 am, edited 1 time in total.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Fourth variable not setting

#2 Post by IrinaLazareva »

It's not quite clear, but..

Code: Select all

if 'forest' == 1:
if 'forest' ('waterfall' / 'castle' / 'caves' ) is variable, it should be unquoted:

Code: Select all

   if forest == 1:
if 'forest' is a value of another variable, for example, choice_0, it should be:

Code: Select all

if choice_0 == 'forest':

AlienDucky
Newbie
Posts: 3
Joined: Sun Jul 26, 2020 12:58 pm
Contact:

Re: Fourth variable not setting

#3 Post by AlienDucky »

It was the first one thank you!!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], jadeon12