- Joined
- Jul 9, 2010
- Messages
- 396
I've been experimenting with Jass AI for a while and while I managed to get some basic AI running, whenever I expand my test AI with new commands, I struggle to find causes of errors. When AI crashes or is invalid, there's no error message, debug functions like DisplayTextToPlayer are not called, AI just stops working and units do nothing, so I can only guess and comment out lines of script until I find a working version, then restore them, and so on.
So my question is: how do you handle this? What is the best practice here? Is there a way to call something like I'd write in OOP languages?
I found a solution in LUA (pcall function) which works fine in my LUA scripts, but it doesn't seem to work with errors from StartCampaignAI() function.
So my question is: how do you handle this? What is the best practice here? Is there a way to call something like I'd write in OOP languages?
Code:
try {
StartCampaignAI(Player(19), "myAI.ai")
} catch (e) {
print(e)
}