SkipTimer function?

Started by Gepard, Tue 06/01/2009 09:56:03

Previous topic - Next topic

Gepard

Im posting this here as well, as some people might just visit Technical Forum and not Begginers... I would like to know if it is possible to create a new function: "SkipTimer (int timer, int loops);" Or is there a module for this sort of thing? The thing is I have a timer set to a certain amount of time and after player clicks on a button, I want 4000 loops out of 10000 to expire immediately.
Drink up me 'arties! Yo ho!

Gilbert

Don't use the internal timers then, use a variable that got its value decremented every game loop in the repeated_execute() or repeated_execute_always() functions. In this way you can modify the variable whenever and in whatever ways you like.

Gepard

#2
Damn! So simple and yet it would never cross my mind. Thank you! However, the SkipTimer function might be a nice feature in the next ags version as you get diferent results using timer and variable. With the timer, the game pauses every time a message is displayed, while with the variable it doesnt.
Drink up me 'arties! Yo ho!

Shane 'ProgZmax' Stevens

That's because SetTimer (if that's what you're using) will count down once and only once unless released and re-started.  I've never liked SetTimer for this reason, but as Gilb0t says, a variable will do what you need it to do.

Pumaman

Quote from: Gepard on Tue 06/01/2009 10:28:14
With the timer, the game pauses every time a message is displayed, while with the variable it doesnt.

If you put the code in repeatedly_execute it will pause while a message is displayed; if you put it in repeatedly_execute_always then it won't.

Also, please don't double-post threads. You've already asked this question in the Beginners Forum; if you don't get an answer there please just ask the moderators to move the thread here rather than creating a duplicate.

SMF spam blocked by CleanTalk