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.
Your function is defined in the init block, before the game even start, as Imperf3kt said.
tmp0000 wrote: ↑Wed Mar 21, 2018 1:51 amThank you. Seems that I missed it in docs. Game is not crashing now. But I think that after loading game this function is not executed. Any ideas?
Now, if I understand you correctly, you don't know how to execute your function whenever the player loads the game, right?
In that case, you could use the special label after_load.
Lord Hisu wrote: ↑Wed Mar 21, 2018 2:44 am
Your function is defined in the init block, before the game even start, as Imperf3kt said.
...
Now, if I understand you correctly, you don't know how to execute your function whenever the player loads the game, right?
Nope. Am sorry if I tangled you.
But the result seems like this: user plays game, then saves it. I modify script and define function that make gameplay randomisations. And paste it's executions many times in game script too. When user loads his old game with new script, it doesn't crash anymore (because the function declaration was moved to the init block, as Imperf3kt adviced). Then user plays game further. When script control goes on lines where this function is executed, it seems that nothing happens. But when user starts a new game all is working as I expected.
Where could be an error?
In that case, you could use the special label after_load.
tmp0000 wrote: ↑Wed Mar 21, 2018 11:52 amBut the result seems like this: user plays game, then saves it. I modify script and define function that make gameplay randomisations. And paste it's executions many times in game script too. When user loads his old game with new script, it doesn't crash anymore (because the function declaration was moved to the init block, as Imperf3kt adviced). Then user plays game further. When script control goes on lines where this function is executed, it seems that nothing happens. But when user starts a new game all is working as I expected.
Where could be an error?
Can you post a shor version of your code? I can try to find the problem for you. =)
tmp0000 wrote: ↑Wed Mar 21, 2018 11:52 amCool! It seems I can solve some other problems with it. But. There is no "before save" label (or it's analog), is it?
No, but you can work with the save screen and modify the actions of the buttons, doing something and then saving the game.