Using SDK on MacOS. I have a delay timer that is used after certain criteria is met. Timer needs to be able to repeat, but when I start it anew it does not wait for the full delay duration.
This is about what my code looks like:
local timer = pd.timer.performAfterDelay(5000, function())
timer:paused()
timer.repeats = true
function pd.update()
if not conditionMet then
[extra code]
elseif conditionMet then
pd.timer.updateTimers()
timer:start()
end
end
I used print(timer.timeLeft) and get a linear 5000 → 0 on first use. Every subsequent use shows about 5000 prior to the timer starting, but once the conditions are met it skips to a random number (39 on my last test) and lowers linearly to 0.
I tried the “if self.paused then return end” solution I saw on another thread, but that did not seem to fix the issue. I removed it so my CoreLibs/timer is back to default.