It’s possible to write an “infinite loop” bug in ChoiceScript, where the game keeps running the same lines of code over and over again, forever. These bugs can be hard to find and fix.
In the latest version of ChoiceScript up on Github, there’s a new error message you can get when your game goes into an infinite loop during Randomtest.
RANDOMTEST FAILED: Error: startup line 34: visited this line too many times
This error occurs when a line has been run (“visited”) 1,000 times in a single Randomtest playthrough, which is a strong indication that your game has an infinite loop. Without this, Randomtest would just run forever if you hit an infinite loop.
I thought it might be possible that somehow you’d actually want to run a line 1,000 times in a single playthrough, so there’s a command to support that,
*looplimit, which you can use like this:
*looplimit lets you raise or lower the limit to any number you like. (It is not possible to turn off the limit completely, but surely running the same line a million times is good enough for anybody. I don’t know what the maximum looplimit is, but it’s probably really big.)
In addition, the latest version of ChoiceScript fixes a bug where text wouldn’t appear in
randomtest-output.txt if the game ran forever in an infinite loop.
If you’re having trouble debugging an infinite loop in Randomtest, try running Randomtest with the “full text” option enabled. That will let you see exactly what’s happening during the loop.