stopping timers

Non-platform specific questions.

stopping timers

Postby j2graves » Sat Apr 25, 2009 7:49 pm

okay, there's an event that starts a timer, but there is supposed to be a way to stop that timer. how can I cancel a timer?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: stopping timers

Postby jimmynewguy » Sat Apr 25, 2009 9:37 pm

DestroyTimer("timer"); :lol:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: stopping timers

Postby j2graves » Sun Apr 26, 2009 12:36 am

thanks, +1
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: stopping timers

Postby ikarus » Thu Aug 18, 2011 3:28 am

I keep trying this but my timer goes on forever??? It even returns true???
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: stopping timers

Postby skydereign » Thu Aug 18, 2011 4:26 am

You can make timers go on forever, or any number of times, but using DestroyTimer will destroy the specified timer for the event actor. It should be just like jimmynewguy says. The only tricky thing is that you can't destroy other actors' timers.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: stopping timers

Postby ikarus » Fri Aug 19, 2011 6:30 am

Hmm... It's not working for me. What's going on is I have an activation even that triggers the creation of a timer that has a 5 count. That goes on forever by the way anyways. So I tried DestroyTimer() to end it on the fifth count, that doesn't work either. But it's fine for now, I worked around it. I just have a variable now, and whenever it's true the timer event does something, otherwise it does nothing.
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: stopping timers

Postby skydereign » Fri Aug 19, 2011 7:21 am

Here is an example of what you just described, more or less, with the DestroyTimer working. On the create actor, it sends an activation event to itself, which creates an infinite timer. Each iteration of the timer, it moves the actor 10 pixels. To stop it, click the actor, which calls DestroyTimer.
http://game-editor.net/media/kunena/attachments/66/destroy_timer.zip
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest