- Aug 15, 2017
- 14
- 6
Defining these initial variables at the beginning of the start label will prevent unexpected behavior as the project grows in size, as well as making things clearer and more organized.Even better, just keep them loose in a rpy file. No point in keeping them inside a label.
Yes...Remove the following section:
No!and set variables inside start label:
Wrong.Defining these initial variables at the beginning of the start label will prevent unexpected behavior as the project grows in size, as well as making things clearer and more organized.
The OP did not provide any detailed information about the project, including whether there will be several updates at different times or whether these variables will actually be used later in the next chapters/days. If it is a project with a really short story, there may not even be a need for players to use saves.Yes...
No!
Wrong.
It's not an issue for the first release of a game, but for it only.
For any following release, either the code is kept clear and organized, with all variables declaration being grouped in the "start" label, and therefore the game will not be save compatible. Or the game is kept save compatible, and therefore the variables declaration will be spread all over the code, what is the opposite of "clear and organized".
And, obviously, doing it for the very first release is also not an option, because it starts a bad habit.
Ren'Py have two statements specially dedicated to variables declarations, and every devs should use them. The first one beingYou must be registered to see the linksd as constants, and the second beingYou must be registered to see the linksfor all the other variables.
This is the only way to have both a clear and organized code, and a save compatible game (at least when it come to variables). All declarations are located in the same place, by example a loose file like Winterfire said. This while ensuring that all variables will exist in a players play, whatever the moment they've been added to the game, whatever how old the save file is, and whatever content the player have seen during his own playthrough.
if you don't know, then give an answer that works for all scenarios. if your solution only works for a specific scenario, then you should have said so in your answer. that's just common senseThe OP did not provide any detailed information about the project, including whether there will be several updates at different times or whether these variables will actually be used later in the next chapters/days. If it is a project with a really short story, there may not even be a need for players to use saves.
Considering a scenario like this and that when a variable is not defined at game start, using the "default" statement is the same as defining the variable at the beginning of the start label, my solution is still applicable and is still a clear/organized way to deal with these initial variables in the limited context presented by the OP. I am not obligated to imagine/foresee all the different scenarios where it is necessary to give different instructions to someone who asks a question here with limited information.
What you wrote reads like: "well, it's not my fault if OP killed his mother following what I said. He should have been more explicit, and explained that 'she's ill, how can I help her' was about a human person having a flue, and not about an agonizing animal."The OP did not provide any detailed information about the project, [...]
The solution I gave solves the immediate problem the OP presented and will allow the project to run without errors. I really don't have to guess all the needs of his project. It would be up to him to make these aspects clear somehow or wait for another answer that better meets his needs (which he apparently did).if you don't know, then give an answer that works for all scenarios. if your solution only works for a specific scenario, then you should have said so in your answer. that's just common sense
you even said "as the project grows in size" which doesnt sound like a small one-off short story.
Regardless of the type of question/situation, it is the OP's responsibility to provide as much information as possible to allow for more accurate suggestions, especially since this is not some kind of paid technical support. It is also the OP's responsibility to decide how and whether to actually use these suggestions. In the context of your joke, the OP would be 100% responsible for the outcome.What you wrote reads like: "well, it's not my fault if OP killed his mother following what I said. He should have been more explicit, and explained that 'she's ill, how can I help her' was about a human person having a flue, and not about an agonizing animal."