|
Hazram Wanderer
Joined: 24 May 2005 Posts: 71
|
Posted: 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? |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: 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 |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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. |
|
|
|
Hazram Wanderer
Joined: 24 May 2005 Posts: 71
|
Posted: 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. |
|
|
|
|
|