Code: Select all
init python:
def loopedFunction():
renpy.say(narrator, "list item: %(l)s" % {"l":myList[1]})
renpy.say(narrator, "int: %(i)s" % {"i":myInt}) # A
renpy.say(narrator, "bool: %(b)s" % {"b":myBool}) # B
myInt = myInt - 1
if myInt <= 0:
myBool = False
label start:
python:
myList = ["a", "b", "c"]
myBool = True
myInt = 3
while myBool:
loopedFunction()
The weird thing is that in my actual code, I get an error (effectively) on the line '# B', for much the same thing.
What I don't understand is why a list defined in one label/block/whatever is accessible from another place with no problems - the first thing you see if you run this code is a "b", as expected - but an int isn't. And why in my actual code, a list and and int are both accessible in a similar nesting of calls and blocks, but a bool isn't. I'm sure I'm probably just forgetting or ignorant of something, can anyone explain it?
...
Now, you want to know something else weird? If I change my code to this:
Code: Select all
init python:
def myFunction():
renpy.say(narrator, "list item: %(l)s" % {"l":myList[1]})
renpy.say(narrator, "int: %(i)s" % {"i":myInt})
renpy.say(narrator, "bool: %(b)s" % {"b":myBool})
label start:
python:
myList = ["a", "b", "c"]
myBool = True
myInt = 3
myFunction()