Is it possible to use loops to make simpler custom timers?
I usually do something like this. (Variable names are for clarity.)
Quote: Create Event
// How long the timer will last. hypotheticalTimerDuration=20; //The countdown variablehypotheticalTimerCountDown=hypotheticalTimerDuration
Quote: Step Event
//Subtract 1 from the countdown every step hypotheticalTimerCountDown-=1; // If it reaches 0, reset it, and execute whatever you want to happen when it reaches 0 if hypotheticalTimerCountDown<=0{ hypoteticalTimerCountDown=hypotheticalTimerDuration //Reset part (Insert other code here) //What you want to happen part }
No, a loop's not what you're looking for. If you run a repeat/for/while loop in the step event, it'll go through every iteration of the loop in a single step. What you're doing now is fine, but I'd personally just use GM's alarms – that way incrementation is handled automatically.
I used to use alarms all the time. Over time I realized I could do pretty much the same thing manually, with much more control over them and no cluttered event list in an object.
You definitely answered my question, though. Thanks.I don't like alarms. it is hard to remember which one is for what, and you have a limited number of them. I just create an ordinary variable, and deduct one from it at the end of every frame. if it gets into negative numbers, that is fine. you only need to be checking to see if it is equal to zero.
True enough. But then, GM has a lot of things that are just numbered where names would be better: user events, arguments, alarms… I guess I just got used to it.
LAR did you get my message? Did it make sense?
Oh, yeah. I got it. Sorry for not replying!
I skimmed it a bit, but I haven't had a chance to study/ mess around with it yet. I'm sure it'll help.Thanks, again!