Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Thu Sep 22, 2005 7:17 am   

alarms
 
is there a way to set an alarm based upon a variable? example when the hp variable @hp is < 250 then i could echo something to myself or send a tell to a teammate for a rescue?
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Thu Sep 22, 2005 4:01 pm   
 
How is the HP variable being populated? It would seem to be simpler to check the variable when its being set and not as a seperate alarm. I would assume you have a trigger to pull this information already. Add to the trigger an #IF and check it there...
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Thu Sep 22, 2005 5:58 pm   
 
A word of warning on this. If you go with a basic If (HP<250) it will be awfully spammy if you are under this threshold for any amount of time. An example would be a similar message someone spammed at us on Retromud where their low hp message literally fired 15 times as they sat crippled and dying at negative hit points for several rounds before finally going down.

An answer to that problem is to do something like this. It will prevent it from executing more than once when your Hp goes low. and will reset itself when you Hp goes back up again.

Code:
#IF (@Hp<250)&(!@HpAlarmOn) {
  #VAR HpAlarmOn 1
  #ECHO {Ow! Ow and stuff!}
  } {#IF (@Hp>250) {#VAR HpAlarmOn 0}}
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Thu Sep 22, 2005 6:36 pm   
 
well i was just using hp as an example, i really want to use it for other things, one of which is for my zmudamp controls, i wanna set an alarm so that when the songtime goes back to zero it'll fire out the songtitle on the music channel and a few other things
_________________


Look at me I've got zSKILLS
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Mon Sep 26, 2005 3:23 pm   
 
so then i guess there's no way to set an alarm from the value of a variable?
_________________


Look at me I've got zSKILLS
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Sep 26, 2005 8:27 pm   
 
I believe you are looking for an expression trigger. However these may not be checked immediately upon a variable change from a COM source. I would suggest using a 1 second alarm and checking the variable within code for that.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Tue Sep 27, 2005 6:38 am   solution
 
i found the solution to this problem. There's an alarm for the zmudamp controls that runs each and every second. add this in the alarm:

#if (@songtime<1000) {music @song}

it has to be 1000 or it's plausable that the alarm may miss it, cuz it goes every second and the songtime changes every 1000th of a second.

idea came from vijilante, so thanks to him, and also thanks to everyone else who helped.[/code]
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net