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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Wed Aug 10, 2011 11:23 pm   

#alarm bug?
 
With this function:
Code:
<func name="alarmTest" id="575">
  <value>$time = 31
#ALARM tempAlarm {+{$time}} {#SHOW time's up}
#SHOW time remaining: %alarm(tempAlarm)
#PRINT cancelling alarm
#CALL %alarm(tempAlarm, {+1})</value>
</func>


I get this output upon execution:
Quote:
time remaining: 3522095999998
cancelling alarm
time's up


That many milliseconds represents about 2700 years. Perhaps I have my syntax wrong (though Ctrl-K says no). Removing the inner brackets around $time yields the same results. Do alarms simply not work with local variables?
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Thu Aug 11, 2011 12:55 am   
 
Try the following changes.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="alarmTest" copy="yes">
    <value>$time = 31
$tempAlarm = %concat("#alarm tempAlarm {+",$time,"} {#SHOW time's up}")
#exec $tempAlarm
#SHOW time remaining: %alarm(tempAlarm)
#PRINT cancelling alarm
#CALL %alarm(tempAlarm, "+1")</value>
  </func>
</cmud>
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Aug 11, 2011 2:47 am   
 
Actually, the problem is not the inner brackets, but the outer brackets.

Code:
$time = 31
#ALARM tempAlarm +$time {#SHOW time's up}
#SHOW time remaining: %alarm(tempAlarm)
#PRINT cancelling alarm
#CALL %alarm(tempAlarm, {+1})


works just fine. Not sure why, and is probably a bug, but there you go.
Reply with quote
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Thu Aug 11, 2011 2:53 am   
 
I hope this is an isolated thing. I'd hate to think that the use of brackets is yet more complicated. Use them to evaluate their contents, sometimes. Use them to group commands and delimit command elements - no wait, not all the time.

Thanks for puzzling that out. I wouldn't have thought to try something which directly contradicts the documentation.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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