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: Sat Jun 26, 2010 12:20 am   

Code runs fine in an alias, but not in a trigger.
 
CMud 2.37, Win 7

Here is a problem that I can't quite figure out. This is building off my damage counter that someone helped me on earlier today. Previous post:

http://forums.zuggsoft.com/forums/viewtopic.php?t=35392

Here's my problem now. When I get a message that one of my groupmates has done damage to a mob, I want it to take the damage verb, which may be modified by a couple of special characters (ie. **MUTILATING** is a bit more damage than *MUTILATING*, which is more than MUTILATING), compare the damage verb to a list of known damage values, then total that to a database record under that player's name.

So, the damage message of:
WaWa's attacks strike a gold guardian 3 times, with *MUTILATING* intensity!

And using the trigger:
Code:
^({@DCtrack})~'s[^>;] * [^>;] with [*>= ]({@dverbshort})([*<= ])%w[!.]


(DCtrack is the list of groupmates)

What I want the following code to do, is look up the damage verb of *MUTILATING*, map it to the appropriate damage value in DVALUES, and save that to the DEALT key under that character's database record, showing a total of all damage done throughout a run:

Code:
#addkey %1 dealt (%eval(%db(@{%1}, dealt) + %item( @dvalues, %ismember( %concat( %2, %3), @dverbs))))


Now here's the funny thing. When I do this as a trigger, nothing happens. If I just copy out the above line of code to an alias and run it with test values, it works just fine.

Why would this run just fine as an alias, but not as a line of code in a trigger? The trigger is mapping the values to the %1-%3 variables properly.
Reply with quote
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: Sat Jun 26, 2010 1:49 pm   
 
I found it... I had an extra space that was being mapped to the third variable.
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