Changing name strings

Posted by Trepko on Thu 26 Aug 2004 04:00 AM — 4 posts, 18,677 views.

#0
I was wondering if you can change a name string when someone says something on channels such as:

[OOC] Trepko: -- 'Hrm'
[OOC] Person I hate: -- 'Hrm'

I was wondering if you could change the name of someone when they talk on a channel to something like that.

If you know could you please tell me how to do it? :p

EDIT: I'm using MUSH v3.42
Amended on Thu 26 Aug 2004 04:03 AM by Trepko
Russia #1
If you don't care about preserving the original colours of the line then you can do it fairly easily:


<triggers>
<trigger
name="replace_name"
match="^(\[OOC\]) (?:NastyGuy1|NastyGuy2|NastyGuy3): -- (.*)$"
enabled="y"
omit_from_output="y"
sequence="1"
script="ReplaceName"
regexp="y"
></trigger>
</triggers>

sub ReplaceName(name, output, wildcs)
   world.ColourNote "white", "", wildcs(1) & " Person I hate: -- " & wildcs(2)
end sub


That's in Vbscript and requires you to put the sub in your script file, or you can make this a separate plugin. It'll replace the original line with a custom one, in white foreground.
Amended on Thu 26 Aug 2004 07:21 AM by Ked
USA #2
You can also just use this (no script file changing):


<triggers>
<trigger
name="replace_name"
match="^(\[OOC\]) (?:NastyGuy1|NastyGuy2|NastyGuy3): -- (.*)$"
enabled="y"
omit_from_output="y"
sequence="1"
regexp="y"
send_to="12"
>
<send>world.ColourNote "white", "", "%1" & " Person I hate: -- " & "%2"</send>
</trigger>
</triggers>


Or at least, I think thats right. I just cut up Keds trigger, and added things from memory.

Russia #3
Unless it changed, I believe using "omit_from_output" omits anything you try to send also. There was a workaround involving the use of two sequenced triggers, of which one sends to script and the other actually gags, but I thought that using the script file is easier.