I’ve got a python script which is running all the time when the game engine has been started. And i’ve got a boolean property named Done.
My question:
How can I pause the script during Done is false without pausing the whole game engine?
if int == 1: # initial, before the bool is true
run...
int = 2
if int == 2:
waiting... # you wouldn't actually do this in the code, this is just for completion.
if int == 3: # the bool is true, this won't run until something external changes int to 3
run...
int = 4
if int == 4: # after the bool section has run
run...
int = 5
Like Monster said. You can run your script every frame (or time step whatever you want) with an always sensor and check if done == true. But if you stop the script the whole game will stop and wait for the script.
The reason the whole game paused is because you used a while, which is a loop, but you never made an exit- so you stuck the game in an infinite loop. Use If, not while.