I've been attempting to have a variable that switches from true to false and back again at random real-time intervals. I thought I'd be able to use renpy's time function to do it but haven't had any luck using it as described for non-jumping purposes. I decided to make a custom function that would do it instead and have been trying to get it to work. This is what I have so far (no time even involved yet) but I haven't been successful.
The variable is intended to be referenced during choices like a flag eventually.
Here's my code I've been testing with, Eileen in this example only says false (the default value for watched)
Code: Select all
init 999 python:
config.developer = True
config.console = True
define e = Character("Eileen")
default watched = False
init python:
currentwatch = False
def swapWatch(currentwatch):
if currentwatch is True:
watched = False
else:
watched = True
# The game starts here.
label start:
scene bg room
show eileen happy
# These display lines of dialogue.
e "[watched]"
e "[watched]"
$ swapWatch(watched)
e "[watched] (should be swapped)"
e "[watched]"
$ swapWatch(watched)
e "[watched] (should be swapped back)"
e "[watched]"