• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[AI] [solved] Debug Script Not Working. Ideas?

Status
Not open for further replies.
Level 20
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:
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")
works when it's simply changed to
JASS:
call WaitPrint_Exec()
 
Last edited:
Status
Not open for further replies.
Top