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
Azerack
Beginner


Joined: 05 Nov 2007
Posts: 14

PostPosted: Tue Jan 15, 2008 5:43 pm   

odd problem when resetting variables to 0
 
Hi.

I made myself a small "kill count" trigger package that basically adds +1 to whatever critter I kill.
So if I kill a giant, it triggers on "* giant died" and adds +1 to the @giants variable.

To reset this count, I made an alias which sets all my counting variables (be they trolls, giants, orcs, etc) to 0.
Like this:
Code:

#var goblins (@goblins = 0)
#var kobolds (@kobolds = 0)
#var grimlocks (@grimlocks =0)
#var elves (@elves = 0)
#var humans (@humans = 0)
#var pirates (@pirates = 0)
#var bandits (@bandits = 0)
#var cruncher (@cruncher = 0)
#var golems (@golems = 0)
#var orcs (@orcs = 0)
#var ogres (@ogres = 0)
#var giants (@giants = 0)
#var trolls (@trolls = 0)
#echo Killcounters reset!


This works fine if said variable has a value other than 0, but if it is already 0, it becomes 1.
What's that all about? Confused
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jan 15, 2008 6:16 pm   
 
First of all, you don't need the @goblins=0 and ect. I think that's the base of your problem. Instead, use:

#VAR goblins 0
#var kobolds 0
and so forth.

It's already changing the variable when you use the #var variablename command.

Charneus
Reply with quote
Azerack
Beginner


Joined: 05 Nov 2007
Posts: 14

PostPosted: Tue Jan 15, 2008 6:31 pm   
 
Aha, that worked. Thank ye!
_________________
"I'd be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it."

- Terry Pratchett
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