Hi
I'm making a game using ren'py and I wonder if anyone has some advice.I'm a noob I know, and maybe this was answered, but I just can't find it.
I hope I'm expressing myself correctly, and that I'm making myself understood.
Instead if having a linear structure to the code, I'm trying to make something circular" MC wakes up, does something in the morning, something in the afternoon, evening, goes back to sleep and wakes up again".
The problem I'm having is with the introduction of new variables and save games. For example if I want to make a 1 time event, and I declare a variable that controls it , it may be checked before it's defined, in the case of a saved game. When I do an update.
For example:
I define a variable in a separate file
default updatevar1 = False
and I want that variable to control an event
label afternoon:
if updatevar1 == False:
jump event1
else:
jump event2
label event1:
code...
code....
$ updatevar1 = True
jump sleep
In the case of saved games, It always gives me the "var1 not defined" error. The code works great with new games, but it always gives me problems with save games from previous builds.
I hope I'm making myself understood, english is not my first language.
Has anyone had problems like this, is there a place where I can better define my variables so that save games acknowledge them?
Variables advice
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.
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.
Variables advice
Last edited by radu32167 on Thu Feb 23, 2017 9:37 am, edited 1 time in total.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3792
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Variables advice
Before any labels, add
Code: Select all
default updatevar1 = False
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Variables advice
Default is what I meant
sorry
sorry
Who is online
Users browsing this forum: Majestic-12 [Bot]