Page 5 of 5

Re: Damage Counter script errors

Posted: Thu Mar 06, 2014 5:05 pm
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...).

Re: Damage Counter script errors

Posted: Fri Mar 07, 2014 7:37 pm
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

Re: Damage Counter script errors

Posted: Fri Mar 07, 2014 7:47 pm
by noblestone
So the proper way is in trigger box

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

Am I right?

Re: Damage Counter script errors

Posted: Fri Mar 07, 2014 8:31 pm
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.