Imagine the following scenario:
Now even though the timer is released (recycled), which should pause the timer (which it doesn't for some reason).
It seems that call BJDebugMsg(I2S(hurray.itteration)) displays a continuous negative value even after the timer is released and the struct is destroyed.
Now here comes the strange part: when I create a new struct and a new timer for some reason someCondition seems to be still true because it instantly destroys the new struct and restarts counting downwards.
Does anybody have an idea why this keeps happening?
EDIT: Nevermind my question, please ignore this thread I see that I did something very stupid in my code
I exidentally
before
no sh!t the timer didn't stop...
Problem solved. My mistake. If someone could close this thread it would be appreciated.
JASS:
scope myScope initializer init
globals
private myStruct globalHurray = 0
endglobals
struct myStruct
integer itteration = 1
boolean someCondition
method onDestroy takes nothing returns nothing
set this.itteration = 0
set this.someCondition = false
endmethod
endstruct
private function enumFunc takes nothing returns nothing
local myStruct hurray = globalHurray
set hurray.someCondition = true
set globalHurray = hurray
endfunction
private function timerFunc takes nothing returns nothing
local timer t = GetExpiredTimer()
local myStruct hurray = GetTimerData(t)
set globalHurray = hurray
call EnumDestructablesInRect(some kinda rect, some kinda filter, function enumFunc)
call BJDebugMsg(I2S(hurray.itteration))
if (!someCondition) then
set hurray.itteration = hurray.itteration + 1
else
set hurray.itteration = hurray.itteration - 1
endif
if (hurray.itteration == 0) then
call BJDebugMsg("stop this nonsense")
call hurray.destroy()
call ReleaseTimer(t)
endif
endfunction
private function init takes nothing returns nothing
local timer t = NewTimer()
local myStruct hurray = myStruct.Create()
call SetTimerData(t, hurray)
call TimerStart(t, 0.2, true, function timerFunc)
endfunction
endscope
Now even though the timer is released (recycled), which should pause the timer (which it doesn't for some reason).
It seems that call BJDebugMsg(I2S(hurray.itteration)) displays a continuous negative value even after the timer is released and the struct is destroyed.
Now here comes the strange part: when I create a new struct and a new timer for some reason someCondition seems to be still true because it instantly destroys the new struct and restarts counting downwards.
Does anybody have an idea why this keeps happening?
EDIT: Nevermind my question, please ignore this thread I see that I did something very stupid in my code
I exidentally
JASS:
set t = null
JASS:
if (hurray.itteration == 0) then
call BJDebugMsg("stop this nonsense")
call hurray.destroy()
call ReleaseTimer(t)
endif
Problem solved. My mistake. If someone could close this thread it would be appreciated.
Last edited: