On one hand, it's nice that Ren'Py allows such a coding-noob to create stuff, however, I'm lost when I need stuff like defining functions...
Situation:
Upon entering a screen, if variable PersuasionValue is greater than 100, it is saved onto PersuasionValueStorage before being changed to 100.
Upon exiting the screen, value of PersuasionValue is restored.
Code: Select all
# Defining first function
def albatros():
global PersuasionValue
global PersuasionValueStorage
if PersuasionValue > 100:
PersuasionValueStorage = PersuasionValue
PersuasionValue = 100
# Defining second function
def pigeon():
global PersuasionValue
global PersuasionValueStorage
PersuasionValue = PersuasionValueStorage
# Then, upon entering the screen, I add it to the button functions.
button:
background something
xpos xxxx
ypos xxxx
action Show("Screen"),albatros()
# And same when exiting the screen.
button:
background something
xpos xxxx
ypos xxxx
action Show("Screen"),pigeon()
Code: Select all
def albatros->():
def pigeon->():It even used to work, then I deleted that piece of code, tried something else, and wrote back the same thing (What you see above here).
Follow-up question:
If I understood variables correctly, when I do
Code: Select all
$ PersuasionValue = 20Code: Select all
global PersuasionValue