Okay, I've tried to write a wait, but I'm unable to compile/syntax check it at the moment, could someone do it for me? I wrote it in gedit with the syntax highlighter...
Also if you see any obvious errors, please tell me.
/S
Also if you see any obvious errors, please tell me.
/S
JASS:
//========================================================================
// This is a quite simple function that I've written because I wasn't
// satisfied with the original "TriggerSleepAction" function.
// If you use it, you don't have to credit me in any way. Just don't
// claim that it's yours in any way. It uses timer arrays to wait, and
// then returns a boolean when the timer ended. It should be MUI
// but there might be cases when timer arrays collide and malfunction
// but that chance is like x/65536 where x is the number of timers going
// at the same time.
//
// --Shadowcon/Shjort/Mamma Mu--
//
//========================================================================
globals
trigger RunTimer
boolean array TimerEnded
endglobals
function RunTimer_Actions takes integer Array returns nothing
set TimerEnded[Array] = true
endfunction
function RegisterTimer takes timer array randomnumber, integer Array returns nothing
set RunTimer = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( RunTimer, randomnumber[Array] )
call TriggerAddAction( RunTimer, function RunTimer_Actions(Array) )
endfunction
function MyWait takes real time returns boolean
local integer Array = GetRandomInt(0, 65535)
local timer array randomnumber
call RegisterTimer(randomnumber, Array)
call StartTimerBJ( randomnumber[Array], false, time )
loop
if TimerEnded[Array] then
set randomnumber = null
set RunTimer = null
return true
endif
endloop
endfunction