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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Unusual alias question
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Unusual alias question

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Posted by Omgbrady   (2 posts)  [Biography] bio
Date Mon 19 May 2008 05:20 PM (UTC)  quote  ]
Alright, so.. I play this RPI MUD called Armageddon, and I've found an extensive list of slang terms that my character would use.

However, since the list is so crazy long, there's no chance that I'll ever remember everything I want to.

So, here's my question. Does MUSHclient have the capability to replace single words in lines of text input by the user?

For instance, if i were to input the following..

Amos got caught with some stolen gear, and got executed. He tried to bribe the templar, but to no avail.

I'd want the client to send the following to the game.

Amos got caught with some ard gear, and got jammed. He tried to grease the bawler, but to no avail.

Is this possible?

Thanks in advance.
[Go to top] top

Posted by Nick Gammon   Australia  (19,675 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 19 May 2008 09:17 PM (UTC)  quote  ]

Amended on Mon 19 May 2008 09:18 PM (UTC) by Nick Gammon

Yes that is pretty easy with a bit of scripting for an alias. The alias below illustrates the idea, and you can just add words to the list in the same format. It uses Lua (I know you are in the VBscript section, but perhaps you could make the switch to Lua?). Failing that, you can make a plugin, where the plugin uses Lua but the rest of your stuff in is VBscript. That is really easy to do with the plugin wizard.

Anyway, here is the alias:

   match="^(say |'|chat )(.*)$"

replacements = {
  stolen = "ard",
  executed = "jammed",
  bribe = "grease",
  templar = "bawler",

--> add more words here


Send ("%1" .. string.gsub ("%2", "%a+", replacements))

See http://mushclient.com/pasting for how to copy and paste that into the client.

Basically it uses a single string.gsub (global substitution) to replace every word found by the regular expression %a+ (one or more letters), from the list in the replacements table. Simply add more words to the table to expand it.

The way it is written the target words have to be pure letters (A-Z) and not include punctuation or numbers. You could change that if necessary.

The first part of the alias checks for the words "say ", "chat ", or a single quote. You can expand that as required.


match="^(say |'|chat |whisper |tell |shout )(.*)$"

- Nick Gammon

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

Posted by Omgbrady   (2 posts)  [Biography] bio
Date Reply #2 on Mon 19 May 2008 09:19 PM (UTC)  quote  ]
Spectacular. Thanks!
[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.


It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.


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]    [Web site powered by FutureQuest.Net]