Closed Draknek closed 7 years ago
Ah, it's obvious that it needn't do that. However, the code where cancel is added to the queue is several functions deep, through some generated code - not clear what a good solution would be. On one hand, maybe I could just suppress console output for the rest of the turn :P OTOH, maybe it'd be better to have it stop executing. HM.
If you want a local fix for now you can make a local copy of puzzlescript and add this to the start of consolePrint in console.js
if (level!=null && level.commandQueue!=null && level.commandQueue.indexOf('cancel')>=0 && text.indexOf('CANCEL')===-1) {
return;
}
I thought the performance aspect of this would be negligible but that turns out not to be the case - I'm noticing some turns which do this cancel/infinite loop thing are taking a very long time to process and freeze the game for a few seconds.
That's maybe partially the logging rather than the rules though? Haven't tested enough to see if the same thing happens without verbose_logging
Mostly I guess this wouldn't be a problem, but if you're trying to debug something it's pretty confusing. I just spent a while looking into a "Got caught looping lots in a rule group" message which only happens in situations where I've used cancel as an early out - only to realise that of course it doesn't matter because I've cancelled the turn.
This really clogs up the debug log and makes it awkward to see what's going on in the bit I care about.
http://www.puzzlescript.net/editor.html?hack=e96e89d3eeb5c0af4a9095354863aaaa