[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Substitutes in Mush/Lua

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Substitutes in Mush/Lua
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 09 Jun 2012 09:13 PM (UTC)  quote  ]
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Oligo   (26 posts)  [Biography] bio
Date Sat 09 Jun 2012 02:38 PM (UTC)  quote  ]

Amended on Sat 09 Jun 2012 02:41 PM (UTC) by Oligo

Message
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]

mud.arctic.org : 2700
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


669 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]