Function WaitForSignal

Line
852
Location
common.ai
Constant?
no
Type
function
Arguments
nothing
Returns
integer
852
function WaitForSignal takes nothing returns integer
853
    local integer cmd
854
    local boolean display = false //xxx
855
    loop
856
        exitwhen CommandsWaiting() != 0
857
858
        //xxx
859
        call Trace("waiting for a signal to begin AI script...\n")
860
        set display = true
861
        call Sleep(2)
862
        exitwhen CommandsWaiting() != 0
863
        call Sleep(2)
864
        exitwhen CommandsWaiting() != 0
865
        call Sleep(2)
866
        exitwhen CommandsWaiting() != 0
867
        call Sleep(2)
868
        exitwhen CommandsWaiting() != 0
869
        call Sleep(2)
870
        //xxx
871
872
    endloop
873
874
    //xxx
875
    if display then
876
        call Trace("signal received, beginning AI script\n")
877
    endif
878
    //xxx
879
880
    set cmd = GetLastCommand()
881
    call PopLastCommand()
882
    return cmd
883
endfunction