Jump to content


Photo

Maybe A 'wait' Command.


  • Please log in to reply
18 replies to this topic

#1 01000001

01000001

    GMC Member

  • New Member
  • 6 posts

Posted 09 October 2006 - 03:09 AM

We need a wait command like used in the great game maker: "MegaZeux".

Tell one object to wait a certain amount of miliseconds before doing something else. That would help alot!
  • 0

#2 pythonpoole

pythonpoole

    Scorpion Software

  • New Member
  • 1894 posts

Posted 09 October 2006 - 03:23 AM

uhh... its called an alarm... or you can make the whole game pause for a moment with the sleep function.
  • 0

#3 01000001

01000001

    GMC Member

  • New Member
  • 6 posts

Posted 09 October 2006 - 03:34 AM

uhh... its called an alarm... or you can make the whole game pause for a moment with the sleep function.

<{POST_SNAPBACK}>


That's just it. Alarms are too complicated, always screw up my game, and the sleep command freezes everything!
  • 0

#4 Smarttart62

Smarttart62

    designFUSION™

  • New Member
  • 2619 posts

Posted 09 October 2006 - 04:14 AM

How are alarms complicated!?

ON CREATE:
alarm[0]=1000;

ON ALARM 0:
// Do something!

Simple!
-Steve
  • 0

#5 SleeK GeeK

SleeK GeeK

    The Biggest And The Best

  • New Member
  • 769 posts

Posted 09 October 2006 - 05:25 AM

Yes. Just as Smarttart62 mentioned, they're not complex. I'll just explain their structure. Most of the time, an alarm is set in the creation event or any other event other than an unconditional step event. When you set an alarm, you specify a time after which the alarm is triggered. In the alarm event, you specify what should happen when the alarm is triggered. This is just the same as what you describle, "Tell one object to wait a certain amount of miliseconds before doing something else. That would help alot!". Just see what i mentioned above, and look at your own phrase. You set an alarm, which is the same as telling how much milliseconds the wait should last. And in the alarm event, you mention what should happen when the alarm is triggered.

Just try to get started. Read the manual, see the example games. If you need help, the Novice Q&A is the best forum, and people will be glad to help. Good luck!

Regards,
SleeK GeeK.
  • 1

#6 Evilish

Evilish

    GMC Member

  • New Member
  • 397 posts

Posted 09 October 2006 - 06:24 AM

One thing you must also watch out for is constantly setting the alarm to a value... each step the value alarm goes down by 1... until it hits 0 and then the alarm event is executed.

Of course, to solve this, only set an alarm when it hasn't already been set, which means checking if it equals 0...

Smarttart and Sleek... get some different avatars... it's freakn hard to tell the difference!

Posted Image
  • 0

#7 SleeK GeeK

SleeK GeeK

    The Biggest And The Best

  • New Member
  • 769 posts

Posted 09 October 2006 - 10:13 AM

Yes, thats what i meant by this line of mine,

Most of the time, an alarm is set in the creation event or any other event other than an unconditional step event.

I've mentioned above not to set an alarm in an unconditional step event, that is setting it in every single step.

Regards,
SleeK GeeK.

Edited by SleeK GeeK, 09 October 2006 - 10:14 AM.

  • 0

#8 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 09 October 2006 - 11:16 AM

And I don't even think pausing an event is possible because of Game Maker is running in events.

I was actually also a bit mad about it, you could in Warcraft III map editor, but they were running individual.
  • 0

#9 SanMan

SanMan

    GMC Member

  • New Member
  • 259 posts

Posted 09 October 2006 - 11:36 AM

A simple if statement at the start of an event will give you complete control over when it is executed. You can "pause" it like this quite easily.
  • 1

#10 Evilish

Evilish

    GMC Member

  • New Member
  • 397 posts

Posted 15 October 2006 - 10:38 AM

I saw another piece of code recently on how to do such a thing...

Create an object, that object takes a screen capture of the window and sets it as a sprite, then it deactivates all instances except it's self.
  • 0

#11 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 15 October 2006 - 05:30 PM

sleep(100)
that will freeze the game for .1 of a second I think
sleep(1000)
that will freeze the game for 1 second I think
  • 0

#12 Rusky

Rusky

    GMC Member

  • GMC Member
  • 2492 posts

Posted 16 October 2006 - 09:56 PM

he doesn't want the sleep function.

as everyone has been saying... USE ALARMS.
  • 0

#13 Fonstw

Fonstw

    GMC Member

  • New Member
  • 1 posts

Posted 16 November 2011 - 06:53 PM

I want that option too, you see...

I want to create an object that removes 1 health every 10 frames but only when you're touching it, when I use an alarm it keeps going on removes health even when the Player-object has gone away from the health removing object.
So I want it to do something like "(event)When collision with player-(commands)Set health relative -1, wait 10 frames before repeating it."
With an alarm i can't make it stop...
  • 0

#14 AndrewBGM

AndrewBGM

    GMC Member

  • GMC Member
  • 199 posts
  • Version:GM:Studio

Posted 16 November 2011 - 09:52 PM

Necropost much Fonstw? Here's a simple way to do what you are intending.

// Create Event
delay = 10;

// Step Event
if ( delay > 0) delay -= 1 else delay = 10;
if ( place_meeting( x, y, obj_player) && delay == 0) {
    health -= 1;
}

  • 0

#15 sophkc

sophkc

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 05 February 2012 - 10:40 PM

How are alarms complicated!?

ON CREATE:
alarm[0]=1000;

ON ALARM 0:
// Do something!

Simple!
-Steve



I'm really confused. I have gamemaker 8.0. If I click on an object, and an event of an alarm, it doesnt bring up anywhere where I can change anything or edit the alarm etc, it just adds 'alarm' to my event list.
I'm trying to get an object to change to another and back again, every maybe 3 seconds, from the very beginning, just as an automatic thing - I'm trying to make a banner around my game and I want every object in the banner to change colour and back again, continuously, to make it interesting (its for children).
Hope this makes sense and hope someone can help me.
Thanks
  • 0

#16 Skazzr

Skazzr

    GMC Member

  • New Member
  • 3 posts
  • Version:GM8

Posted 22 March 2012 - 11:05 AM

I want that option too, you see...

I want to create an object that removes 1 health every 10 frames but only when you're touching it, when I use an alarm it keeps going on removes health even when the Player-object has gone away from the health removing object.
So I want it to do something like "(event)When collision with player-(commands)Set health relative -1, wait 10 frames before repeating it."
With an alarm i can't make it stop...


try "if [collision] player - set health -1 relative - set alarrm 10 (convert frames to milliseconds) REPEAT"
The "repeat" bit is the most important. That way it checks for the player touching the object every time it wants to remove health.
You might want to also do an "if else" bit.
  • 0

#17 IsmAvatar

IsmAvatar

    Good Samaritan

  • GMC Member
  • 2411 posts
  • Version:GM8

Posted 23 March 2012 - 01:52 AM

sophkc: You've created the event, and that's half of it. The other half is *setting* the alarm, and that is done with a Drag and Drop action. You'll find it, looks like the alarm icon.
  • 0

#18 DZiW

DZiW

    GMC Member

  • GMC Member
  • 729 posts

Posted 25 March 2012 - 09:55 AM

Basically, alarms are but counters which are deducted every gamestep, so it is more than trivial.
  • 0

#19 2DGroove

2DGroove

    GMC Member

  • GMC Member
  • 26 posts
  • Version:GM:Studio

Posted 30 December 2013 - 09:24 PM

here's what you could do: have a code in the step event that has a variable counting up every step. You can use this variable and say

if var = 10 {do whatever; var = 0;}


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users