Help? Can't add to values more than once in a scene..

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
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Help? Can't add to values more than once in a scene..

#1 Post by namastaii » Tue Feb 03, 2015 9:11 pm

I hope this makes sense but in my story, the character can go back to their room and choose from a list of things to do until the time for the day is up or they're out of energy. etc.
Once they complete a task, it adds the new values, to their energy or their money or intelligence or whatever it may be, but then it jumps back to the room again to give them the choices again (i want it this way) but when i tell them to do another task, no matter what the task is... none of the values will change like they are supposed to.

for example.. lets say she did her chores. she gained 3 dollars of allowance and 2 hours have gone by.
jump back to room scene for more options
she chooses to do her chores again. money stays the same and hours are at the same and wont change.
so i try to choose something else like study. which should add intelligence points and take away more time...but it doesnt. Does anyone know what I'm doing wrong to solve this issue?

Thanks

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Help? Can't add to values more than once in a scene..

#2 Post by philat » Tue Feb 03, 2015 9:12 pm

It would probably help if you post your script.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Help? Can't add to values more than once in a scene..

#3 Post by namastaii » Tue Feb 03, 2015 9:36 pm

Code: Select all

label room:
    
    if energy <= 0:
        jump sleep
    
    scene bg mybedroom
    with dissolve
    
    #after first day:
    $ hours += 16
    show screen day_and_time_screen
    
    
    "What would you like to do?"
    
    if job is "unemployed":
        menu:
            "Study":
                $ energy -= 3
                $ hours += 3
                $ intelligence += 5
                
                "You studied."
                jump room
                
            "Find a Job":
                
                menu:
                    
                    "Apply at Bakery Store":
                        $ energy -= 1
                        $ hours += 1
                        $ job = "Bakery"
                        "Your application was sent in!"
                        jump room
                    
                    "Apply at Library":
                        $ energy -= 1
                        $ hours += 1
                        $ job = "Library"
                        "Your application was sent in!"
                        jump room
                    
            "Go to the Store":
                jump store
                    
            "Do your Chores - allowance $3":
                
                $ energy -= 3
                $ money += 3
                show screen inv_screen
                "You parents have given you your allowance."
                jump room
                    
            "Sleep":
                jump sleep
                
    if job is "Bakery":
        menu:
            "Study":
                $ energy -= 3
                $ hours += 3
                $ intelligence += 5
                
                "You studied."
                jump room
                
            "Go to work":
                $ energy -= 3
                $ hours += 5
                $ money += 11
                "You went to work."
                jump room
                
            "Go to the Store":
                jump store
                    
            "Do your Chores - allowance $3":
                
                $ energy -= 3
                $ money += 3
                show screen inv_screen
                "You parents have given you your allowance."
                jump room
                    
            "Sleep":
                jump sleep
    
    if job is "Library":
        menu:
            
            "Study":
                $ energy -= 3
                $ hours += 3
                $ intelligence += 5
                
                "You studied."
                jump room
                
            "Go to work":
                $ energy -= 3
                $ hours += 5
                $ money += 15
                $ intelligence += 1
                "You went to work."
                jump room
                
            "Go to the Store":
                jump store
                    
            "Do your Chores - allowance $3":
                
                $ energy -= 3
                $ money += 3
                show screen inv_screen
                "You parents have given you your allowance."
                jump room
                    
            "Sleep":
                "Good Night!"
                jump sleep
                

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Help? Can't add to values more than once in a scene..

#4 Post by philat » Tue Feb 03, 2015 10:10 pm

It's not that the variables themselves aren't updating, it's that whatever you're using to track the variables isn't (I would assume a screen). If you press shift+r or put in a line of dialogue after every menu choice that says, for example, "intelligence [intelligence]" you'll see that the variable itself has changed.

I don't quite understand what the issue is with the screens not updating, but you can fix it by hiding and showing the screen again.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Help? Can't add to values more than once in a scene..

#5 Post by namastaii » Tue Feb 03, 2015 10:31 pm

Thank you. I could try hiding and re showing them :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]