documentation indexreference manualfunction index

renpy.dynamic

Function: renpy.dynamic (*vars):

This declares a variable as dynamically scoped to the current Ren'Py call. The first time renpy.dynamic is called in the current call, the values of the variables named in the supplied strings are stored. When we return from the current call, the variables are given the values they had at the time when renpy.dynamic was called. If the variables are undefined when renpy.dynamic is called, they are undefined after the current call returns. If renpy.dynamic is called twice for the same variable in a given call, it has no effect the second time.

Example

label fight:
    $ renpy.dynamic("playerhp", "monsterhp")
    $ playerhp = 100
    $ monsterhp = 100

    "A terrible fight ensues!"

    return



documentation indexreference manualfunction index