 |
Shezmu Wanderer
Joined: 23 Apr 2010 Posts: 53
|
Posted: Fri Jun 25, 2010 5:00 pm
Problems with Database record variables |
Using CMUD v 2.37
Okay, here is my dilemma. I am trying to build a damage counter that will trigger off various messages when I or my groupmates cause damage to mobs.
The counter that I am building is based off a past player's counter, which would create a database record variable when it saw damage from a groupmate. It would then create a Key of that particular damage verb, and increment a counter in Value.
The end result of this damage counter is that it will report that a particular groupmate hit for each damage verb X number of times.
Here is an example of a damage message:
WaWa's attacks strike a gold guardian 2 times, with MUTILATING intensity!
Here is the trigger. As far as I can see, the trigger works fine:
^(%w{@DCtrack})~'s[^>;] *[^>;]with [*>= ]({@dverbshort})([*<= ])%w[!.]
Here's where the problem lies. The trigger should do the following:
#addkey %1 %2 (%eval(@{%1.%2}+1))
I want it to create a Variable of WaWa, with a key of MUTILATING, and increment the value by one. If the key of MUTILATING already exists, I want it to increment the current value by one.
Instead, it is creating a variable of WaWa, a key of MUTILATING, and a value of .MUTILATING1
What am I doing wrong? |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Jun 25, 2010 9:06 pm |
#addkey %1 %2 (%eval(%db(@{%1}, %2)+1))
|
|
|
 |
Shezmu Wanderer
Joined: 23 Apr 2010 Posts: 53
|
Posted: Sat Jun 26, 2010 12:12 am |
Thanks, Chamenas. This fixed it.
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sun Jun 27, 2010 6:25 pm |
Chamenas, you're using %eval again. (%db(@{%1},%2)+1) works by itself without %eval.
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Jun 27, 2010 7:57 pm |
I'm simply using what he's using!
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 28, 2010 4:02 am |
That's true. But it really should be discouraged. We are trying very hard to get people out of the habit of using %eval(). It should almost never be used. Shezmu, and anyone else reading this: if you think you need %eval, you are either wrong, or it should be reported as a problem. In general, simply putting parentheses, ( ), around your statement should automatically evaluate it mathematically.
|
|
|
 |
|
|