• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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:
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.
 
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..
 
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.
Back
Top