Text Substitutions in MUSHclient.

Posted by Haflinger on Sun 21 Apr 2002 06:57 PM — 2 posts, 13,459 views.

#0
Is there any way I can make a list of text substitutions? I'd like to have my input text converted to something else when it is sent, mainly for a lauguage accent.

For example, if I type "Hello" I'd like it to send "Hallo", or if I typed "one" it would send "vun". As you can see, it would be a German accent.

I'd need a list of about 30 words to be substituted.

Thanks ;)
Amended on Sun 21 Apr 2002 06:58 PM by Haflinger
Australia Forum Administrator #1
You could do it fairly easily, however you may have problems with "words" within words. The example I give below would replace "one" even inside another word (like someone, bone, lonely etc.).

Make an alias that calls a script ...


Alias: *
Label: FixUpWords
Script: FixUpWords


Add this script to your script file (language VBscript) ...


Sub FixUpWords (AliasName, AliasLine, arrWildcard) 

dim NewLine

  NewLine = arrWildcard (1)	' get line they entered

  NewLine = world.Replace (NewLine, "one", "vunn", true)
  NewLine = world.Replace (NewLine, "hello", "hallo", true)
'
'  add other ones here
'

  world.send NewLine

end sub


What this does is get the line you entered, and scan it for each word you want to find, and replace it with the replacement word. You could add extra lines to do more words.

Then finally the resulting string is sent to the world.

You could fix the "one" problem by searching for " one " (with spaces around it) and replacing with " vunn " (with spaces), however then you might run into problems with sentences like this: "I see one, I think" (in that sentence, "one" doesn't have a space on each side).

However with a bit of tweaking you can probably make it work pretty well.