|
Azerack Beginner
Joined: 05 Nov 2007 Posts: 14
|
Posted: 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? |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
|
Azerack Beginner
Joined: 05 Nov 2007 Posts: 14
|
Posted: 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 |
|
|
|
|
|