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.
Screens aren't supposed to have side effects that are visible from outside the screen. As the documentation says: "Screens must not cause side effects that are visible from outside the screen. Ren'Py will run a screen multiple times, as it deems necessary. It runs a screen as part of the image prediction process, before the screen is first shown. As a result, if running a screen has side effects, those side effects may occur at unpredictable times."
So it seems having your screen directly doing something is a bad idea. A Timer seems like the ways to go for you. Or if you really want to be complicated, you could create a UDD.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
well I know that screens code runs multiple time, however I can't see no difference between running the code inside a screen or inside a screen using a python function, that aside, I'm trying to keep the variables in the screens scope, using python means I have to define my variables global.
if a timer is a correct way to do it, something like timer with 0 delay should be the other, better correct way as well, something like:
In the first place, why do you want to fill the list inside a screen? Why not make it outside of the screen and then pass it to screen? What do you try to achieve?
I have no use for it yet but I figured i can keep track of things while the screen is shown inside the screen instead of keeping a separate list, for example:
default things = ["thing 1", "thing 2", "thing 3"]
screen things_click(t):
default showem = []
vbox:
for i in range(len(t)):
$ renpy.AddToSet(showem,1)
if showem[i]:
button:
text t[i]
action SetDict(showem, i, 0)
...
show screen things_click(things)
I can pass a list to that screen to show some objects, and it can keep track of the variable data inside the screen without changing anything outside of the screen, there's no need to keep track of what is what outside of that screen, there's no need to worry about the length of the list I pass to it and once I'm done the data is discarded by hiding the screen without touching the original list or any other variable. it can be very handy in battle systems or something like that I assume.
in my head it's like private variables as oppose to public ones.