[Solved] What's the official, correct way, to declare & use variables with custom python function to avoid all problems?
Posted: Sun Jun 13, 2021 12:32 am
From RenpyTom in discord: "I pretty much use global exclusively. Store is used in special cases - for example, SetVariable(...) is actually SetField(store, ...)"
How to fix: local variable 'locCur' referenced before assignment
How to fix: local variable 'locCur' referenced before assignment
Code: Select all
default locCur = "testC"
default locN= "testN"
init python:
global locCur #SOLUTION
global locN #SOLUTION
def func_1():
# for reference, the following use of store. also fixes the problem, but RenpyTom uses global, so I'll use global as well.
# if store.locCur != store.locN
if locCur != locN:
# dostuff