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
Vortigen
Novice


Joined: 10 Dec 2000
Posts: 44
Location: United Kingdom

PostPosted: Sun Nov 18, 2001 1:20 am   

#ALARM
 
Here's what I am trying to do.

I need an alarm that fires on 0 seconds and then every second after.
ie 0 ... 1 ... 2 ... 3 ... you get the idea.

#ALARM *1
Will do all but 0 seconds.

Is there a way to do this with out me resorting to

#ALARM 0|1|2|3|4|... and on

Vortigen

"It's not just a riot of blots and blurs and disjointed jottings linked by bursts of speed...it only looks as if it is, damn it."
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sun Nov 18, 2001 9:34 am   
 
I ran the alarm #ALARM *1 {#ECHO %time(ss)} for a few minutes. While I never got the initial 00 seconds, I did get all the subsequent ones. How are you using your alarm?



Troubadour
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Nov 18, 2001 12:55 pm   
 
I did get 00 seconds every once in a while, but I also didn't get it every once in a while. The same happened with all the other numbers. Remember that I'm sure that *1 for an alarm is not exactly one second each time, and even more, it needs to wait until whatever script you give the alarm finishes before waiting another second. So it should wait between execution and execution roughly one second but it will get out of synch with the clock every once in a while.

Kjata
Reply with quote
Vortigen
Novice


Joined: 10 Dec 2000
Posts: 44
Location: United Kingdom

PostPosted: Wed Nov 21, 2001 11:32 am   
 
I'm not sure that I made myself that clear enough on the first example.

The Alarm *1 trigger seems to wait 1 second then fire. Then waits another second and then fires.

But I wanted an alarm that fired instantly, and then fired every second after that.

In the end I resorted to making an ALIAS with the same script as the ALARM.
And then having a script that went:

ALIAS
#T+ ALARM

so it fired the alias(the copy of the alarm script) then after 1 second the alarm kicked in.

A bit of a sloppy way of doing it. But it worked .

Is there a better way of doing this?

Also from your post it seemed that you were suggesting ALARM *1 should fire on 0 seconds, is that true?

Yours perplexed

Vortigen

"It's not just a riot of blots and blurs and disjointed jottings linked by bursts of speed...it only looks as if it is, damn it."
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Nov 21, 2001 11:28 pm   
 
You can't get an alarm to fire instantly, unless it happens to catch a valid alarm time the moment it figures out what a valid alarm time is.

Best bet is to use an alias. Put the code to enable the alarm in it, as well as the code for the actual task. If the alias is not yet too big you might want to also throw in a conditional that determines if you actually need to call #T+ Alarm or not.

Thus, your alarm becomes:
#Alarm *1 {Alias}

and you can start it up by calling the alias itself.

EDIT: so far as I can figure out, the only way to possibly get the alarm to fire instantly is *0, but of course you can't divide by zero and thus the alarm will either not fire at all or do some really bad things
li'l shmoe of Dragon's Gate MUD
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Nov 25, 2001 7:19 am   
 
tick timer set to one second that runs an alias... if you dont want it to fire every second, null the alias...

Enter the commands you want to execute when you do want it to fire into another an alias. Then, when you want it to fire, set the alias that the tick timer executes to the value of this other alias.

Confused? Me too.

Example:
Open the tick timer.
Disable the 'show tick message thing'. it will be spammy as hell.
Set time interval to 1.
Set timeout margin to 0.
Timeout command: tick_counter

#alias tick_counter ""
#alias do_stuff {do stuff; do more stuff}

#var tick_counter do_stuff
You will now be doing stuff. Every second.
#var tick_counter ""
You will stop doing stuff.

I have it set up this way, because if you want to... do_different_stuff... you just have to tell the tick counter that you want to do that instead.

Do away with your alarms and convert to the tick timer revolution!

~~Dec
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