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
asm
Wanderer


Joined: 19 Jul 2004
Posts: 68

PostPosted: Sun Mar 11, 2007 12:23 am   

Adjusting an alarm
 
Hello everyone,

Simple problem. I have an alarm, and I want to change the time until it goes off. Or, more specifically, add to it. Here's what I came up with based on the documentation, but it doesn't seem to be working:

Code:
#noop %alarm( walkalarm, %alarm( walkalarm)+4000)


Anyone know how to get this to work properly?

Thanks,
asm
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Mar 11, 2007 1:03 am   
 
I think you may have to surround the expression (%alarm()+4000) in an %eval().

Is it a simple alarm as far as the code it executes? You could achieve the same effect using the #ALARM command, but that requires you also include such code. As long as the alarm has an id associated with it the new #ALARM will simply replace the old one rather than creating a second alarm.
_________________
EDIT: I didn't like my old signature
Reply with quote
asm
Wanderer


Joined: 19 Jul 2004
Posts: 68

PostPosted: Sun Mar 11, 2007 1:15 am   
 
Code:
#noop %alarm (walkalarm, %eval( %alarm( walkalarm) + 4000))


Didn't work :/

And...I'm specifically looking to add to the time instead of replacing the alarm.
_________________
My collections of scripts.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Mar 11, 2007 2:38 am   
 
You have a space there you shouldn't have, after the %alarm. Even without it, it still won't work.

This is actually really bizarre. I tried creating a variable containing the time:

#math NewAlarm %alarm(testalarm)+4000
#call %alarm(testalarm,@NewAlarm)

but even that didn't work. Even weirder, I put a static value into @NewAlarm and tried doing this:

#call %alarm(testalarm,@NewAlarm)
#show %alarm(testalarm)

and it didn't return the value of @NewAlarm - it returned the maximum value that %alarm could have (I was using a 30 second alarm - it returned 30000). All it was doing was resetting the alarm, not changing the value.

EDIT: If it's any consolation, this:

#call %alarm(testalarm,%alarm(testalarm)+4000)

works in CMUD.
Reply with quote
asm
Wanderer


Joined: 19 Jul 2004
Posts: 68

PostPosted: Sun Mar 11, 2007 2:47 am   
 
Hmm. The original code didn't have any spaces, those only appeared after I saved (don't ask me why). Though the zscript syntax is a pretty bizarre thing in itself.

Thanks to both of you for making an effort, though. :-)

Fang Xianfu wrote:
#call %alarm(testalarm,%alarm(testalarm)+4000)

works in CMUD.


Heh. Thought about getting cmud since I've gotten back into mudding, decided that if I do I'll want to wait a bit for bugs and such to be worked out, what with the limited upgrade time and it being new and such.
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