The Daily Click ::. Forums ::. Klik Coding Help ::. Delay an Event?
 

Post Reply  Post Oekaki 
 

Posted By Message

cosbish



Registered
  07/12/2006
Points
  26
1st April, 2007 at 21:15:03 -

Is there a way to delay an event from triggering for perhaps a second after the condition occurs?

 
n/a

jpSoul



Registered
  25/10/2003
Points
  1714
2nd April, 2007 at 03:36:12 -

I often use a method, maybe a better exists:

your condition + 'counter' equal to 0 => set 'counter' to 1

if 'counter' greater than 0 => add 1 to counter

if 'counter' greater or equal than 'your value' => do an action, set 'counter' to 0


don't forget to use active's alterable values instead of counters; you can modify the delay by changing 'your value'

Image Edited by the Author.

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
2nd April, 2007 at 05:39:15 -

Or you can just set the event as timed...

So you can say (when the event is triggered)

*Every 00 01 (second)
-(do events)
-repeat this action once...

 
http://www.SilverNova.co.uk


axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
2nd April, 2007 at 05:40:55 -

Don't use timer events. You should know better, Tim

 
n/a

WillWill

Give me stuff

Registered
  24/07/2006
Points
  552
2nd April, 2007 at 15:05:37 -

What about a fastloops solution? This reminds me of my queueing engine with a delay. I guess you should do it with a 'cooldown' counter tho if we're talking just an event or so.. Otherwise I'd pile up the events in an INI file as commands and parameters, commands being the fastloops, and the parameters being variables on how much you want to move the X and Y position of an object for example.. Requires more explanation I guess, but you won't really care bout my suggestion.


 
http://www.morphboy.newgrounds.com/
^ Free tunes, as long as you contact me.

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
2nd April, 2007 at 18:54:08 -

Sadly, gone are the days where you could just have done an empty for..next loop in BASIC to make your gme pause at specified points. I used to do that all the time, my things have changed!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
3rd April, 2007 at 13:24:08 -

@axel: One little innocent one wont hurt anybody!?

NYACH!! *dies*

 
http://www.SilverNova.co.uk


~Matt Esch~

Stone Goose

Registered
  30/12/2006
Points
  870

VIP Member
3rd April, 2007 at 13:26:56 -

lol, never used timer events. It's just better to time in code loops rather than seconds. If you fix the number of code loops / second you basically have a timer anyway, but at least you know everything 'moves' relative to each other.

 
http://create-games.com/project.asp?id=1875 Image


Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
4th April, 2007 at 11:29:37 -

I use timer events all the, um... time!

Most recently I have it so that if my game's hero pushes a crate, it moves 1 pixel every 15 milliseconds, which is cool because it gives the illusion of being heavy. And timer events are really helpful if you're doing cutscenes too.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
4th April, 2007 at 11:48:36 -

lol, no it isn't. If the game runs slow, these kind of things screw up. Never use timer events, period.

 
This space is for rent

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
4th April, 2007 at 12:14:11 -

Edit: Since MMF tries to run at 50fps, that means it tries to run your code 50 times a second. I think. So for the timer:

-Always> Add 1 to counter.
-Compare 2 general values (in special conditions), first box "value( "Counter" ) mod 50" second box "equals" third box "0"> your event here.

If you have MMF2 then replace 50 with your FPS.

I think that MMF's timer events keep actual time though, the method above will not if your game lags.

Image Edited by the Author.

Edit edit:

To make something trigger a second after-

-Trigger event (player collides with wall or something)> Set flag 0 on
-Flag 0 on> Add 1 to counter.
-Counter mod 50 = 0> do delayed event and turn off flag 0

Image Edited by the Author.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
4th April, 2007 at 18:53:51 -

I usually get a counter that is 0 by default, but counts down to 0 if it's any higher. Then set it to something, (say 100), then make the event happen when the counter = 1

it's most likely not the best way if you want an exact timing, but i'm never all that fussy about things like that.

If i wanted to allow the user to speed up things i could easily make it set the counter to a lower number, thus making the delay shorter.

 
.

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
4th April, 2007 at 19:22:24 -

Or you can forget using loads of counters and flags and stick with a timed event. *runs!*

 
http://www.SilverNova.co.uk


Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
4th April, 2007 at 19:28:19 -

Well, I like timers.. dagnabbit!

*sniff*, *sniff*
*Goes to find the nearest airlock..*

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
5th April, 2007 at 01:25:05 -

You'll die away with Gunner 3.

http://www.create-games.com/article.asp?id=1373 actually explains it better than I could.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath
   

Post Reply



 



Advertisement

Worth A Click