Trigger to replace text output?

Posted by Silencher on Sat 20 Jul 2013 05:02 AM — 5 posts, 22,823 views.

#0
Hello!

I play a mud where there's no introduce/remember/etc. and I get confused sometimes about who I'm playing with.

I have a trigger set up for their 'short descriptions' with an output of 'name', but it doesn't quite work how I'd like it to, it just shows the name at the bottom of whatever output.

So 'a man dressed like bugs bunny' I might have my trigger call 'weirdo' And so the following situation happens:

a man dressed like bugs bunny says, "What's up doc?"
(Note/Output:)weirdo.

I'd prefer if it was more like this:

weirdo says, "What's up doc?"

But I'm not sure if something like that is really possible?

An alternative would be:

a man dressed like bugs bunny(weirdo) says, "What's up doc?"

But I don't know how to do that either, or if it's even possible.
Australia Forum Administrator #1
You can't directly amend output lines, however you can match them, omit them, and output something else in their place.

#2
Can you show me an example of how to do that? I tried

.*descriptionhere.* as the trigger line
replaced the body with 'weirdo'

and checked omit, but it omitted everything in every line, so I had to disable it.

It also looks like it's still coming after where the sentence would be, rather than replacing it.
Australia Forum Administrator #3
Simple example:


<triggers>
  <trigger
   enabled="y"
   match="* a man dressed like bugs bunny *"
   omit_from_output="y"
   send_to="2"
   sequence="100"
  >
  <send>%1 weirdo %2</send>
  </trigger>
</triggers>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


This will come out on the "note" colour. You can change the colour by doing it slightly differently. A more elaborate example would keep the original line colours.
#4
Thanks, I'm okay with it changing the line. This should work well I think. I'll test it tomorrow. I really appreciate it.