Damage Counter script errors

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: Damage Counter script errors

Post by Oneymus »

As a bit of feedback (I can't speak to your problem, because I don't know the script well enough), but you can easily cut down on those crazy table definitions if you modify your pattern a bit.

Code: Select all

^Your attacks? strikes? (?:an?|the) ([\w\s]+) (\d+) times, with \**(\w+)\** (\w+)!$
That one pattern matches all three of your sample strings (verified at http://regexpal.com/).

Then, you can call string.lower() on matches[4] (guessing it's 4 by count). That way, you can dispense with the crazy lookup table entirely. *MANGLING* becomes "mangling", ***DISMEMBERING*** becomes "dismembering", obliterating becomes "obliterating".

This also drastically reduces maintenance burden, as you don't need to deal with _critNames at ALL. Just remove it.

Now, I see there are more special characters in there (<, >, =). I'll leave that as an exercise for you (hint: see the \* in there? Now think of that with []'s around it...).

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Damage Counter script errors

Post by noblestone »

Finally worked, nice seeing the counter, Thanks.

I havent grasped the concept of string.lower() and special chars, so where on web shall I read about how to set it up?

Thanks

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Damage Counter script errors

Post by noblestone »

So the proper way is in trigger box

string.lower(matches[4])
CritCounter:AddCrit(matches[4])

Am I right?

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: Damage Counter script errors

Post by Oneymus »

From what little I know of the script, yes, that looks to be right.

You want to remove the _critName table and the part in CritAdd that indexes into it, as those become superfluous when your input data is already in the right format.

Post Reply