• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
Level 18
Joined
Mar 16, 2008
Messages
721
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