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


Joined: 18 Aug 2001
Posts: 43
Location: USA

PostPosted: Sun Apr 27, 2003 3:22 am   

Wrong default value for variable in a timer.
 
I have a trigger set up so that when I use a specific skill it changes the value of a variable (displayed in a gauge), and sets a 10 minute alarm (the skill's delay) which will then reset the variable to what it was before I used the skill.

I've also got the gauge set up with a small bitmap (built in bitmap, PLUSR). I thought it would be cool if I set it up so when there is a delay for the skill, instead of it displaying the Red Cross symbol, it would be a black X, and then change back when it is once again available.

I set up the following trigger:

Pattern:
You heal yourself completely.

Value:
#VARIABLE Sheal unavailable
#VARIABLE HP @HPmax
#ALARM Sheal +10:00 {#VARIABLE Sheal available %btnimage( Sheal, PLUSR)} Gauges
#NOOP %btnimage( Sheal, ABCM_SYSTEMCLOSE)

Now, this works for the gauge and variable while I'm playing. The gauge changes its bitmap properly and displays the 'available' or 'unavailable' propery of the variable fine. The strange thing is that is sets the default value of the variable from 'available' to 'PLUSR'. So when I first open my MUD character window, the gauge says 'Sheal PLUSR' instead of 'Sheal available'.

I also tried the trigger this way:

#VARIABLE Sheal unavailable
#VARIABLE HP @HPmax
#ALARM Sheal +10:00 {
#VARIABLE Sheal available
%btnimage( Sheal, PLUSR)
} Gauges
#NOOP %btnimage( Sheal, ABCM_SYSTEMCLOSE)

When I did it that way, the alarm gets messed up and actually causes an infinite loop when it goes off.

I also tried doing it with the #NOOP inside the alarm part of the trigger (in both the single-line version and the two-line version), and if I did that then the button would have the words '#NOOP' inside it, so I figured out that part didn't seem to be necesary for the alarm trigger.

I have the ; seperator character disabled on my MUD character because multiple commands-per-line-carriage are illegal on my MUD. I took it off because any time I tried using a ;) smiley it would send two commands (and I could theoretically get banned for just that).

I'm not sure if there's something I am doing wrong or if there is another way to set my trigger up so that it won't change the default value of the variable like that, if there is I would appreciate somebody letting me know ;)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 27, 2003 6:17 am   
 
It only did what you told it to do. As you can see from the #VAR helpfile, you included a default field (I think it took me over a year to notice I was doing this):
Syntax: #VA variable value [defaultval] [classname]

#ALARM Sheal +10:00 {#VARIABLE Sheal available %btnimage( Sheal, PLUSR)} Gauges

To fix it, delete the existing variable and change the trigger. The next time the trigger fires, it will make the variable without the default value:

#UNVAR Sheal
Pattern:
You heal yourself completely.
Value:
#VARIABLE Sheal unavailable
#VARIABLE HP @HPmax
#ALARM Sheal +10:00 {#VARIABLE Sheal available;#NOOP %btnimage( Sheal, PLUSR)} Gauges
#NOOP %btnimage( Sheal, ABCM_SYSTEMCLOSE)

LightBulb
Advanced Member
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