I have some code that needs a Timer that I would like to activate when certain objects enter a script zone....
The problem I have is that if you are holding a bunch of objects or w/e the onEnter and onExit stuff triggers a heap of times... meaning I get an error saying "the timer already exists" as it trys to spawn it a bunch of times.
So the question is how can I test to see if the timer exists and if it dose.. to not do anything?
sudoCode
Code:
function onObjectLeaveScriptingZone(zone, obj)
if zone == getObjectFromGUID('1a6c3b') then --Zone I want to test enter and exits
local timerID = self.getGUID()..math.random(9999999999999)
IF TIMER IS NOT RUNNING THEN --<---- How cand I do this line?
timerSpawn = true
Timer.create({identifier=timerID, function_name="countItems", function_owner=self,
repetitions=5, delay=1})
END
end
end
I know I could spawn a zillion timers with unique names but would prefer to do it this way.
PS - Is there a way to put a callback.. so it runs a function after the timer has stopped its repetitions?