I love using setTimer but it sometimes gives me grief. For example I’ll do something like:
setTimer(1,1,function( )) Function function() //stuff Return //more stuff
And I’ll get an error like incorrect number of perimeters for function or something like that.
But if I add
With nothing in it before setTimer I get no error.
But sometimes I’ll get a
unrecognized Type -6392748503736 error
I don’t even know what it means and the number is always different. and when I run the program again it will run for like 5 min doing nothing and then the unrecognized type error will just randomly pull up.
Timers unfortunately can be a bit buggy. How literal is your example there? Because that timer is going to fire once and once only after a second. So I'm guessing that not really what you're doing.
I have this code and so far have never hit a problem
_waveTimer = setTimer(audioLength(sndWave) - 0.2, -1, startWave()) stopTimer(_waveTimer)
The idea is that I setup a timer that is used to delay the start of a new wave long enough to just about let the sound play. I set it up and stop it immediately. Then at the start of a new level I start the timer, there's a bit of a delay and then startWave() is called which pretty much just turns the timer back off again:
function startWave() stopTimer(_waveTimer) game.waveStart = false game.wavePause = 0 return void
SO, two key differences - I don't leave a long running timer going and the iterations is basically set to "indefinite"
Don't really know if any of this info is likely to help or not.
My example is not very literal what I have is a selection box that moves over once then sets the timer for .25 seconds then it lets you move the box again so the timer can only fire once it finishes and you move the box. Also I added a second print( ) before the timer and I get no errors
earlier I added a clear( ) before the timer and there are no errors but the screen flashes so that did not work.
I don’t know why but adding
Before a timer fixes it.
So I have it working just I run into errors with setTimer() almost every time I use it