I was very close to release of the initial beta battle ground AFK scripts, when all of a sudden I hit a strange problem when start run with release version of the code.
When the execution enters a javascript function that accepts 1 argument, the bot skips everything and starts the next round.
A close inspection found that happens when the bot is trying to access that argument. Isolate to that one function, and the script reports it does not known that argument! Samething running with debug mode is just fine.
The first thought I had is it is those #define statements again. But none of that is the case. While I was stepping through the code, parse of arguments mysteriously changed on a totally unrelated statement (on a compare statement)! Inspecting on the resulting assembly code, and I found the stock return was corrupting the arguments passed in. Turned out the Microsoft optimizer is optimizing on nuts!
After put all javascript engine code on /Od (disable optimization), problem solved.
So that concludes another wasted night.