HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Timer Problems

07-09-2007, 12:25 AM#1
Av3n
Well Suggested from the title i have timer problems *sigh* and its getting on my nerves. I have no idea what im I doing wrong.
Oh I forgot about elaboratin. Well lets say i want to check my timer is workin so i put an message display in it. And it isn't displayin the message so i presume it insn't workin any ideas why?
Note that its uses vJass. I might try using 1 timer you know instead of local timers or CSSafety. So any ideas to help me out to fix it?

Here's the spell code
Collapse JASS:
function Web_Timer takes nothing returns nothing
    local Web store = Web.create()
    local timer t = GetExpiredTimer()
    local group g = CreateGroup()
    call GroupEnumUnitsInRange(g,store.x,store.y,store.radius,Condition(function Web_Filter))
    set store.counter = store.counter+1.00
    call DisplayTimedTextToPlayer(store.owner,0,0,10,"Hello")
    if GetUnitState(store.web,UNIT_STATE_LIFE) == 0.00 or store.counter == store.time then
        set store.exit = true
    endif
    call DestroyGroup(g)
    set t = null
    set g = null
endfunction

function Web_Actions takes nothing returns nothing
    local Web store = Web.create()
    local timer t = CreateTimer()
    local location p = GetSpellTargetLoc()
    local real add = 0.00
    set store.caster = GetSpellAbilityUnit()
    set store.owner = GetOwningPlayer(store.caster)
    set store.x = GetLocationX(p)
    set store.y = GetLocationY(p)
    set store.web = CreateUnit(store.owner,Web_dummy(),store.x,store.y,bj_UNIT_FACING)
    set store.level = GetUnitAbilityLevel(store.caster,Web_id())
    if Web_ltx() == true then
        set store.time = Web_lasttime()*I2R(store.level)
    else
        set store.time = Web_lasttime()
    endif
    if Web_ltaddx() == true then
        set add = Web_ltadd()*I2R(store.level)
        set store.time = store.time+add
    else
        set store.time = store.time+Web_ltadd()
    endif
    if Web_rx() == true then
        set store.radius = Web_lasttime()*I2R(store.level)
    else
        set store.radius = Web_lasttime()
    endif
    if Web_raddx() == true then
        set add = Web_radd()*I2R(store.level)
        set store.radius = store.radius+add
    else
        set store.radius = store.radius+Web_radd()
    endif
    call RemoveLocation(p)
    set p = null
    call TimerStart(t,0.10,true,function Web_Timer)
    loop
        exitwhen store.exit == true
        call PolledWait(0.10)
    endloop
    call PauseTimer(t)
    call DestroyTimer(t)
    call store.destroy()
    set t = null
endfunction

I appreciate help only related to timers & spell improvements leaks and such etc. Most importantly to drift off to Dota posts cause the spell is called web

-Av3n
07-09-2007, 12:47 AM#2
TheSecretArts
First off, what is going wrong.. .you say your having problems but your not telling us what is (or isnt) happening... please elaborate...
EDIT: I think i figured it out... you destroy the timer in the same function you declared it in... just instead of
Collapse JASS:
if GetUnitState(store.web,UNIT_STATE_LIFE) == 0.00 or store.counter == store.time then
    set store.exit = true
endif
do
Collapse JASS:
if GetUnitState(store.web,UNIT_STATE_LIFE) == 0.00 or store.counter == store.time then
    call DestroyTimer(t)
endif
07-09-2007, 03:30 AM#3
Av3n
Thx 4 the suggestion. Updated the first post with a bit more info

-Av3n
07-09-2007, 03:47 AM#4
Rising_Dusk
Put a BJDebugMsg() call just before the TimerStart call.
See if it's even getting that far in the script.
07-09-2007, 04:31 AM#5
Av3n
I'll see to it

-Av3n

EDIT: It does work before and after the call, the timer does work. I just couldn't tell if it was workin problem solved thx
07-09-2007, 06:23 AM#6
Rising_Dusk
Collapse JASS:
    call TimerStart(t,0.10,true,function Web_Timer)
    loop
        exitwhen store.exit == true
        call PolledWait(0.10)
    endloop
    call PauseTimer(t)
    call DestroyTimer(t)
Make sure you don't initialize that variable to true.
07-09-2007, 05:41 PM#7
TheSecretArts
or if you just used my suggestion, you wouldnt need that variable period :P
07-10-2007, 11:08 PM#8
Av3n
I know. Im gonna try usin 1 timer though vJass now. Coding the timer will come later. Thx for the help

-Av3n