• 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.

[JASS] ...Glitch?...

Status
Not open for further replies.
Level 3
Joined
Feb 20, 2007
Messages
32
Okay, I'm having some trouble with a line of code. For some reason, my function is cutting out at a wait, it just doesn't make sence.

Here's my function:

JASS:
function ParsedMainstream takes nothing returns nothing
 local gamecache g = LocalVars()
 local timer t = GetExpiredTimer()
 local real x = GetHandleReal(t, "pmsx") 
 local real y = GetHandleReal(t, "pmsy") 
 local real ti = GetHandleReal(t, "pmsti")
 local integer d = GetHandleInt(t, "pmsd")
 local integer I = 0
 local timer array ta

 call BJDebugMsg(R2S(ti) + " " + I2S(GetHandleInt(g, "ENDPARSEDSESSION")))

 loop
  set I = I + 1
  set ta[I] = CreateTimer()
  call BJDebugMsg("Whoa.")
  call TriggerSleepAction(ti)
  call BJDebugMsg("Cuts out here.")
  exitwhen(GetHandleInt(g, "ENDPARSEDSESSION") == 111)
  call SetHandleHandle(ta[I], "truble", CreateUnit(Player(11), 'h002', x, y, d))
  call TimerStart(ta[I], 2.00, true, function TimedUnitMove)
 endloop

 call PauseTimer(t)
 call DestroyTimer(t)
 set t = null
endfunction

It cuts out perfectly at the wait. Nothing after it works. My first debug msg displays 5.000 & 110 respectively, meaning the wait is only 5 seconds. It just dies at the sleep action. This doesnt make any sence! Can anyone shed some light on this?
 
Last edited:
Level 3
Joined
Feb 20, 2007
Messages
32
Mmm, it's a one-shot timer that acts as a thread. It creates units in a loop and attaches a timer to each one. I used a timer so I could pass locals through it without a gamecache, otherwise I would have used ExecuteFunc.

Mmm, it's good to know timers dont like waits... I guess I might have to switch off to ExecuteFunc then... Well, thank you for the help.
 
Level 11
Joined
Jul 12, 2005
Messages
764
Btw, you didn't really declare the variable 'i'... ut i guess it's 'I'. * But try this:

JASS:
loop
exitwhen(GetHandleInt(g, "ENDPARSEDSESSION") == 111)
call TriggerSleepAction(ti)
set I = I + 1
set ta[I] = CreateTimer()
call SetHandleHandle(ta[I], "truble", CreateUnit(Player(11), 'h002', x, y, d))
call TimerStart(ta[I], 2.00, true, function TimedUnitMove)
endloop

*EDIT: Oh i see it changes by itself, lol. Strange bug, should be reported..
 
Level 3
Joined
Feb 20, 2007
Messages
32
Oh weird, I is counted as i but not really... Mmm, odd bug never would have spotted that. I gave up and replace it with an execute func call, it's working now... Not sure how though -,-.

Thanks for pointing that out.
 
Status
Not open for further replies.
Top