Substitutes in Mush/Lua

Posted by Oligo on Sat 09 Jun 2012 02:38 PM — 2 posts, 12,586 views.

#0
I'm trying to port some string subs from Tintin to Mush but I've noticed some pretty significant performance degradation. I suspect it has to be with the way I setup the regex. I have roughly 100 of these spell subs.

In Tintin, the syntax I use is like
#sub {%1 wooden splint} {$1 wooden splint [LOW HEA]}


In Mush, I couldn't figure out an exact 1-to-1 match to the tintin #substitute command so I use a trigger with omit output to mimic #sub behavior. I do the following which seems to have heavy performance penalty. If I add an anchor ^ at the beginning of the pattern will that help performance? Or is there a more robust way or better technique to what I'm doing?
<trigger colour_change_type='1' enabled='y' expand_variables='y' group='spellcomps' 
	match="(.+) wooden splint(.*)" omit_from_output='y' regexp='y' 
	send_to='12' sequence='100' other_text_colour='white'>
  <send>ColourNote("silver","black","%1 wooden splint [LOW HEA]%2")</send>
</trigger>


Ideally if I encounter something like
A wooden splint is here. [2]

I'd like the sub to replace it with
A wooden splint [LOW HEA] is here. [2]
Amended on Sat 09 Jun 2012 02:41 PM by Oligo
Australia Forum Administrator #1
The anchor may help, to save it having to keep retrying a match from position 1, position 2 and so on.

What will probably also help is uncheck "expand variables". Variables are where variable substitution is done, which you are not doing.