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
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Wed May 20, 2009 1:17 am   

modify the time setting of an alarm with a trigger
 
So I have an alarm that should go off every 20 minutes which works well, however sometimes that is too soon for the actions I want to perform. My plan is to simply use a trigger off a pattern from the mud to adjust the time of that alarm accordingly.

Code:

#NOOP %alarm( minetime, 5:00)


This is not changing the set time of the *20:00 alarm. That is what I want to do though, a one time adjustment to a standing alarm.
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Wed May 20, 2009 2:18 pm   
 
You're needing to use #ALARM for that.

From the zMUD 7.21 help file:
Quote:
#ALARM example {*5} {#ECHO example}
#ALARM example {+3}

Creates an alarm that will fire every 5 seconds then changes the time pattern for that alarm.


So your trigger output should be
Code:
#ALARM minetime 5:00


You may also want to check out #SUSPEND/#RESUME. I personally would use those. My trigger pattern would be:
Code:
#SUSPEND minetime
#ALARM minedelay {+5:00} {#RESUME minetime}


PS. When you use the [ code ] tag, don't insert a newline, start your code right after the closing ]. That will eliminate the blank line in your code block.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed May 20, 2009 3:12 pm   
 
You can also use %alarm, but the second argument to the function needs to be the number of ms until you want the alarm to fire. If the alarm repeats, it'll only affect the current iteration; once it executes, it'll go back to its normal timer.

In short, use 300000 instead of 5:00.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Thu May 21, 2009 3:15 pm   
 
Aye Fang, but as you pointed out, it requires conversion. Which is why I pointed him at #ALARM instead ;)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Thu May 21, 2009 9:56 pm   
 
not sure I understand. I already have an alarm called minetime, and upon receiving these from the mud:
Code:

You do not have enough energy right now
      change it to five minutes

It takes time to properly set your timbers, wait a bit..
      change it to five minutes

Dang nab it, you find nuttin' ...
      change it to five minutes


I want to change the alarm, minetime to a different time, but only once that way next time around it runs its course of 20 minutes.
I guess I could simply suspend the *20 alarm and create a new one that will resume the *20 alarm after it performs the +5 alarm.
Reply with quote
Ithilion
Wanderer


Joined: 02 Sep 2005
Posts: 85

PostPosted: Thu May 21, 2009 10:25 pm   
 
trigger each line with an alarm for 5 minutes? *shrug*
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu May 21, 2009 10:29 pm   
 
This is exactly what the %alarm function is for. Do what I suggested in my post above. All the %alarm function does is change the ms-remaining counter for the alarm to whatever number you provide. When the alarm fires and the counter is reset, it'll be set to whatever the alarm's pattern dictates. You argument just needs to be in ms.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Thu May 21, 2009 10:46 pm   
 
so I just need to do this?

Code:

You do not have enough energy right now

      #call %alarm( minetime, 300000)


or would this work?

Code:

You do not have enough energy right now

      #exec {%alarm( minetime, 300000)}
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri May 22, 2009 2:00 pm   
 
You need to use #call.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri May 22, 2009 2:04 pm   
 
You can use any of the methods posted by myself or Fang. %alarm with 300000ms as an arg, or #ALARM with 5:00, or #SUSPEND/#RESUME. Use whichever you're comfortable with.

All three methods in code:
Code:
#TRIGGER {{You do not have enough energy right now|It takes time to properly set your timbers, wait a bit..|Dang nab it, you find nuttin' ... }} {#ALARM minetime {5:00}}
#TRIGGER {{You do not have enough energy right now|It takes time to properly set your timbers, wait a bit..|Dang nab it, you find nuttin' ... }} {
   #SUSPEND minetime
   #ALARM {+5:00} {#RESUME minetime}
}
#TRIGGER {{You do not have enough energy right now|It takes time to properly set your timbers, wait a bit..|Dang nab it, you find nuttin' ... }} {#CALL %alarm(minetime,300000)}
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri May 22, 2009 2:43 pm   
 
I'm fairly sure that the other two methods aren't exactly what the OP is after, though - using #alarm will permanently rather than temporarily change the time remaining, and using #suspend and #resume will add the time to the current remaining time, rather than setting it to the value given. But they're useful to know, anyway.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Fri May 22, 2009 6:36 pm   
 
thanks guys, #noop works fine. I havn't tried #call yet but am about to do it now. #noop got it working, all I really had to do was change the 5:00 to 300000.
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