About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: 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?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Jun 25, 2010 9:06 pm   
 
#addkey %1 %2 (%eval(%db(@{%1}, %2)+1))
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: Sat Jun 26, 2010 12:12 am   
 
Thanks, Chamenas. This fixed it.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sun Jun 27, 2010 6:25 pm   
 
Chamenas, you're using %eval again. (%db(@{%1},%2)+1) works by itself without %eval.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Jun 27, 2010 7:57 pm   
 
I'm simply using what he's using!
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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.
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