new AI script: hard error debugging

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany

new AI script: hard error debugging

Post by DylanDog »

Hello
I hope some developer can help me with this.
I am developing a new AI.
The issue is that after some time the game crashes, the stderr.txt file reports:

Code: Select all

info    |10:35:56: [SDL_main] (global) mod (multiplay.wz) is enabled
error   |10:37:31: [scrAllianceExistsBetween] Invalid player parameters 0 and -1
error   |10:37:31: [scrAllianceExistsBetween] Assert in Warzone: scriptfuncs.c:4163 (i < MAX_PLAYERS && j < MAX_PLAYERS && i >= 0 && j >= 0), last script event: 'N/A'
error   |10:37:31: [interpRunScript] interpRunScript: could not do func
error   |10:37:31: [interpRunScript] interpRunScript: *** ERROR EXIT *** (CurEvent=5)
error   |10:37:31: [interpRunScript] Original event ID: 5 (of 100)
error   |10:37:31: [interpRunScript] Current event ID: 5 (of 100)
error   |10:37:31: [interpRunScript] Call depth : 0
error   |10:37:31: [scrOutputCallTrace]  *** Script call trace: ***
error   |10:37:31: [scrOutputCallTrace] 0: N/A (current event)
error   |10:37:31: [interpRunScript] interpRunScript: error while executing a script
error   |10:37:31: [interpRunScript] Assert in Warzone: interpreter.c:946 (!"error while executing a script"), last script event: 'N/A'
error   |10:37:31: [eventFireTrigger] eventFireTrigger: event N/A: code failed
error   |10:37:31: [eventFireTrigger] Assert in Warzone: event.c:1128 (0), last script event: 'N/A'
error   |10:37:31: [stackReset] stackReset: stack is not empty
error   |10:37:31: [stackReset] Assert in Warzone: stack.c:1048 (((psCurrChunk == psStackBase) && (currEntry == 0))), last script event: 'N/A'

Now I do not see any event name or rows mentioned in this error message, any idea where I should search in my AI script for the error?

I see that MAX_PLAYERS is mentioned, this is usually used in my script to loop throught the players, I also understand that possibly the erorr is here, the problem is that I have dozen of such loops using MAX_PLAYERS and with no rows or event name mentioned is hard to find where the issue is...

thanks!
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
-Kosh-
Trained
Trained
Posts: 203
Joined: 16 Sep 2009, 23:34

Re: new AI script: hard error debugging

Post by -Kosh- »

Something that calls scrAllianceExistsBetween()

Hunt down all those would be my best guess.
This is a waste of space. Something important should be here.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: new AI script: hard error debugging

Post by Per »

Somewhere you are calling allianceExistsBetween() with the second parameter as -1. There is no such player, so the game freaks out.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany

Re: new AI script: hard error debugging

Post by DylanDog »

ok, thanks!
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).