Jump to content


Photo

How can you tell by GML if an alarm is active?


  • Please log in to reply
10 replies to this topic

#1 KingDragonRider

KingDragonRider

    KDR Productions

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

Posted 19 April 2012 - 06:00 PM

Is it even possible?

:thanks:

KingD.

Edited by KingDragonRider, 19 April 2012 - 07:27 PM.

  • 0

#2 ChefDavid22

ChefDavid22

    No, YOU shut up!

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

Posted 19 April 2012 - 06:02 PM

In the alarm event draw some text on the screen. That's how I test.
  • 0

#3 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8251 posts
  • Version:GM7

Posted 19 April 2012 - 06:02 PM

if (alarm[0])
{
//is active
}
  • 1

#4 THE_GAME_EDITOR

THE_GAME_EDITOR

    GMC Member

  • GMC Member
  • 798 posts
  • Version:GM8.1

Posted 19 April 2012 - 06:02 PM

Nice find BattleRifle

But seriously?
Where do you need it for? I'd like to know.

EDIT -
Nah.. i don't care.

Edited by THE_GAME_EDITOR, 19 April 2012 - 06:10 PM.

  • 0

#5 KingDragonRider

KingDragonRider

    KDR Productions

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

Posted 19 April 2012 - 06:11 PM

Nice find BattleRifle

But seriously?
Where do you need it for? I'd like to know.


Sorry for not explaining....

Basically, I would like to perform something, only if it is not already running already in the alarm, does that make sense?

EDIT- Here is the working script:

//Step event//
if global.ammocount != global.ammo and !(alarm[1]){
alarm[1] = 1.5;
}

//Alarm[1] event//
if global.ammocount < global.ammo{
global.ammocount += 1;
alarm[1] = 1.5
}
else if global.ammocount > global.ammo{
global.ammocount = global.ammo;
}

if (alarm[0])
{
//is active
}


Thanks, I'll try that out :)
EDIT- Works a treat, thanks!

KingD.

Edited by KingDragonRider, 19 April 2012 - 06:17 PM.

  • 0

#6 THE_GAME_EDITOR

THE_GAME_EDITOR

    GMC Member

  • GMC Member
  • 798 posts
  • Version:GM8.1

Posted 19 April 2012 - 06:15 PM

Basically, I would like to perform something, only if it is not already running already in the alarm, does that make sense?

Oh.. ja. Posted Image

I'm kinda dumb when it comes to alarms because i don't use them.
  • 0

#7 KingDragonRider

KingDragonRider

    KDR Productions

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

Posted 19 April 2012 - 06:18 PM

Basically, I would like to perform something, only if it is not already running already in the alarm, does that make sense?

Oh.. ja. Posted Image

I'm kinda dumb when it comes to alarms because i don't use them.


How can you not use Alarms?!?! :P
In my opinion they're vital! :P

KingD.
  • 0

#8 THE_GAME_EDITOR

THE_GAME_EDITOR

    GMC Member

  • GMC Member
  • 798 posts
  • Version:GM8.1

Posted 19 April 2012 - 06:31 PM

How can you not use Alarms?!?! :P
In my opinion they're vital! :P


I use my own in the step event.
It functions the same but i just prefer that way.

EDIT -

In my opinion they're vital! :P


Yes they are!

Edited by THE_GAME_EDITOR, 19 April 2012 - 06:31 PM.

  • 0

#9 ChefDavid22

ChefDavid22

    No, YOU shut up!

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

Posted 19 April 2012 - 06:43 PM

My apologizes. I missunderstood your question. Thought you simply wanted to know if you triggered your alarm properly.
  • 0

#10 KingDragonRider

KingDragonRider

    KDR Productions

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

Posted 19 April 2012 - 07:27 PM

My apologizes. I missunderstood your question. Thought you simply wanted to know if you triggered your alarm properly.


No worries, thanks for taking the time to try and help anyway :)
KingD.
  • 0

#11 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14398 posts
  • Version:GM:Studio

Posted 19 April 2012 - 08:53 PM

Careful with the method. for an alarm to tick down, you need to have added the alarm event to the object. I simply drop a comment d&d in the event. If you dont have an event for the alarm, it will stay at the value you set it. I learned that the hard way.

The most logical and common reason to use alarms this way is for collision handling when you only want to trigger the collision once and you dont want to use the step event because that would be a waste.

InfoSwitch
on alarm0
//tick tock

on collision with player
if(!alarm[0])
{
display_a_message("Hello")
}
alarm[0] = 2;


DoorSwitch
on alarm0
TheDoor.open= false;
play_sound(swoosh_snd);

on collision with player
if(!alarm[0])
{
TheDoor.open = true;
play_sound(swoosh_snd);
}
alarm[0] = 2;
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users