Gammon Forum
Entire forum
MUSHclient
Lua
Trigger to replace text output?
Trigger to replace text output?
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Silencher
(55 posts) bio
|
Date
| Sat 20 Jul 2013 05:02 AM (UTC) |
Message
| 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.
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #1 on Sat 20 Jul 2013 08:06 AM (UTC) |
Message
| You can't directly amend output lines, however you can match them, omit them, and output something else in their place.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Silencher
(55 posts) bio
|
Date
| Reply #2 on Sun 21 Jul 2013 12:47 AM (UTC) |
Message
| 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.
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #3 on Sun 21 Jul 2013 11:26 PM (UTC) |
Message
| 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>
|
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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Silencher
(55 posts) bio
|
Date
| Reply #4 on Mon 22 Jul 2013 06:54 AM (UTC) |
Message
| Thanks, I'm okay with it changing the line. This should work well I think. I'll test it tomorrow. I really appreciate it. | 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.
15,099 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.