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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Mitnik
Newbie


Joined: 24 Feb 2010
Posts: 1

PostPosted: Wed Feb 24, 2010 9:19 am   

#ALARM problems
 
I'm using CMUD Pro 3.14a

It works fine in Zmud, I have a count down timer that lets me know when I can either sip or eat something to heal...

Code:
#IF (%1) {
  #ADDITEM countdownlist {%0}
  countdown
} {
  #IF (%numitems(@countdownlist)>0) {
    #ALARM countdown {+1} {countdown}
    #FORALL @countdownlist {
      #IF (@{%i}=0) {
        #DELITEM countdownlist %i
      } {
        #MATH %i @{%i}-1
      }
    }
  }
}


Assume the name of the alias here is countdown
Everything will work for the first run through the alias, my timer will go down by one. However, once it executes the second time, the alarm will be created, but will not fire, nor will it be deleted. Is anyone else suffering from something similar? If so, have you found a way around it?
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Wed Feb 24, 2010 2:28 pm   
 
I think the issue might be that you're recreating the alarm while it's about to be deleted. Here, try this:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Countdown" copy="yes">
    <alias name="countdown" copy="yes">
      <value>#untrigger alarm_%1
#if (%2 > 0) {
  #ADDITEM countdownlist %1
  #UNTRIGGER alarm_%1 "countdown"
  #ALARM alarm_%1 %concat( "+", %2) {} "countdown"
  #call %btncol(btn_%1, (%color(green) + %color(hi)))
  }
#forall @countdownlist {
  #update btn_%i
  #if (%alarm( alarm_%i) == -1) {
    #delitem countdownlist %i
    #call %btncol(btn_%i, (%color(red) + %color(hi)))
    }
  }</value>
      <notes>Syntax: countdown balance time
Example: countdown moss 5</notes>
    </alias>
    <var name="countdownlist" type="StringList" copy="yes"/>
    <trigger type="Alarm" priority="30960" copy="yes">
      <pattern>*0.1</pattern>
      <value>#forall @countdownlist {
  #update btn_%i
  #if (%alarm( alarm_%i) == -1) {
    #delitem countdownlist %i
    #call %btncol(btn_%i, (%color(red) + %color(hi)))
    }
  }</value>
    </trigger>
    <button name="btn_moss" color="red" textcolor="white" priority="30990" copy="yes">
      <caption>@GetTime(moss)</caption>
    </button>
    <func name="GetTime" copy="yes">
      <value>#return %if(%alarm(alarm_$timer) != -1, %int(%alarm(alarm_$timer) / 1000.0 + 0.99), 0)</value>
      <arglist>$timer</arglist>
    </func>
  </class>
</cmud>
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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