- Joined
- Mar 16, 2008
- Messages
- 812
I'm trying to debug an AI script. I was sending messages at the beginning of each function but they weren't sent quick enough, before it crashed. So I tried implementing these functions to wait until the message is send before running the rest of the function, but now it's not sending any messages. The script is still running though, just not sending the messages. Any ideas how to get it working?
set up functions:
example of the first and seventh function to be debugged:
these are only some relevant snips of the script.
edit: solved seems
works when it's simply changed to
set up functions:
JASS:
globals
player debug_player = Player(4)
string debug_toPrint = ""
endglobals
//= DEBUG WAIT ========== credit: Bribe =====================================
function WaitPrint takes string toPrint returns nothing
set debug_toPrint = toPrint //you must define a string called debug_toPrint in the globals block
call ExecuteFunc("WaitPrint_Exec")
endfunction
function WaitPrint_Exec takes nothing returns nothing
local string toPrint = debug_toPrint
call TriggerSleepAction(0)
call DisplayTextToPlayer(debug_player, 0, 0, toPrint)
endfunction
example of the first and seventh function to be debugged:
JASS:
//===========================================================================
function CheckLastCommand takes boolean pop returns integer
local integer cmd = GetLastCommand()
call WaitPrint ("1")
if (pop) then
call PopLastCommand( )
endif
return cmd
endfunction
//===========================================================================
function ResetAttackUnits takes nothing returns nothing
call WaitPrint("7")
set awGold = 0
set awWood = 0
call InitAssaultGroup( )
endfunction
these are only some relevant snips of the script.
edit: solved seems
JASS:
call ExecuteFunc("WaitPrint_Exec")
JASS:
call WaitPrint_Exec()
Last edited: