Adapting Nick's Chat Redirector Plugin

Posted by Lilac on Wed 31 Mar 2021 04:31 PM — 5 posts, 19,839 views.

#0
I use Nick's redirector plug in, and I'm trying to have PK toasts go over to the capture window, as well.

The trigger match will be as follows (for example):

[ BadGuys ] Bobby got ***DESTROYED*** by SallyMae [ GoodGuys ]

So, the first part I'm having trouble with is the damage. ***DESTROYED*** is only one variable, some have extraneous punctuation and some does not. For example, a simple "offed" or "killed" or "<<< ERADICATED >>>" or "=== OBLITERATED ==="


Second part is that stuff within the brackets and the character names will change, as well. Ergo, the only constant in the equation will be:

[ * ] * got * by [ * ]


I'm also assuming just * isn't enough for so many variables, but I'm a potato with no script talent.
Amended on Wed 31 Mar 2021 04:33 PM by Lilac
USA Global Moderator #1
Quote:
I use Nick's redirector plug in

This isn't enough information for us to know which plugin you mean. Please link to either a copy of the plugin or the forum post where you got it from.

Quote:
[ * ] * got * by [ * ]

I think you mean [ * ] * got * by * [ * ]

Quote:
I'm also assuming just * isn't enough for so many variables, but I'm a potato with no script talent.

Did you try it? What did you try and what happened?
Amended on Wed 31 Mar 2021 04:47 PM by Fiendish
#2
Nick's Redirector:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48 -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the
world you want chats to go to.
-->

<muclient>
<plugin
name="Chat_Redirector"
author="Nick Gammon"
id="cb84a526b476f69f403517da"
language="Lua"
purpose="Redirects chat messages to another world"
date_written="2007-06-30 10:45:35"
requires="4.08"
version="1.0"
>
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!-- Triggers -->

<triggers>

<trigger
enabled="y"
match="^[A-Za-z]+ (says|chats|yells) \'(.*?)\'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="^You (say|chat|yell) \'(.*?)\'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

</triggers>

<!-- Script -->


<script>
<![CDATA[
chat_world = "RoD chats"
local first_time = true

function redirect (name, line, wildcards, styles)

-- try to find "chat" world
local w = GetWorld (chat_world) -- get "chat" world

-- if not found, try to open it
if first_time and not w then
local filename = GetInfo (67) .. chat_world .. ".mcl"
Open (filename)
w = GetWorld (chat_world) -- try again
if not w then
ColourNote ("white", "red", "Can't open chat world file: " .. filename)
first_time = false -- don't repeatedly show failure message
end -- can't find world
end -- can't find world first time around

if w then -- if present
for _, v in ipairs (styles) do
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
w:Note ("") -- wrap up line

end -- world found

end -- function redirect

]]>
</script>


</muclient>






The chat redirect works great, but I tried adding the below and it didn't work:


<trigger
enabled="y"
match="[ * ] * got * by * [ * ]"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>
Amended on Wed 31 Mar 2021 06:27 PM by Lilac
Australia Forum Administrator #3

A link to the relevant page would be helpful rather than copy/pasting it. That way we can all refer back to the same page rather than the copy. Also, comments on that page may shed some light onto things. Please post the link to where you found it (I have done a few chat redirector plugins).

Australia Forum Administrator #4

I’m also assuming just * isn’t enough for so many variables, but I’m a potato with no script talent.

You can use around 100 wildcards, so that isn’t the issue. Fiendish seems to have spotted that you left one out.