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 get their old values back. 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