Ok, so I've been mucking around with plugins and scripting in LUA and been getting a little better at it. Not by too much, but a little :)
Anywho, I was looking at the Aardwolf_Chats script to see how Mr. Gammon does his output redirection and I am a little confused.
I see in the trigger match, there is the line:
This line is a regex, so the text inside any ()'s should be stored to some variable(s). Which variables are they stored to? And in the function chat_redirect(below), which line of code actually displays the chat message in the separate chat window (or World)??
If I were to make a simple plugin to redirect, for example, only messages on the ftalk channel, to an already created "Dummy" world, seems to me like it would be one trigger with a regex match, and then one funtion that would redirect the whole message, minus the tags, to the other world. Is this correct? Or is it more complicated than that? With all these OnPlugin*** functions and TelnetOption*** commands that are confusing me? :)
Anywho, I was looking at the Aardwolf_Chats script to see how Mr. Gammon does his output redirection and I am a little confused.
I see in the trigger match, there is the line:
Quote:
match="^{chan ch=(?<channel>\w+)}(?<msg>.*)"
match="^{chan ch=(?<channel>\w+)}(?<msg>.*)"
This line is a regex, so the text inside any ()'s should be stored to some variable(s). Which variables are they stored to? And in the function chat_redirect(below), which line of code actually displays the chat message in the separate chat window (or World)??
Quote:
-- chat redirector
function chat_redirect (name, line, wildcards, styles)
local w = get_a_world (chat_world, folder)
if w == nil then
colourNote("red","","Chat world file not available.")
return
end
table.remove (styles, 1) -- get rid of tag
-- send to other world
send_to_world (chat_world, styles)
-- this stuff to echo in this world as well
if echo then
for _, v in ipairs (styles) do
ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
Note ("") -- wrap up line
end -- echo wanted
end -- function chat_redirect
-- chat redirector
function chat_redirect (name, line, wildcards, styles)
local w = get_a_world (chat_world, folder)
if w == nil then
colourNote("red","","Chat world file not available.")
return
end
table.remove (styles, 1) -- get rid of tag
-- send to other world
send_to_world (chat_world, styles)
-- this stuff to echo in this world as well
if echo then
for _, v in ipairs (styles) do
ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
Note ("") -- wrap up line
end -- echo wanted
end -- function chat_redirect
If I were to make a simple plugin to redirect, for example, only messages on the ftalk channel, to an already created "Dummy" world, seems to me like it would be one trigger with a regex match, and then one funtion that would redirect the whole message, minus the tags, to the other world. Is this correct? Or is it more complicated than that? With all these OnPlugin*** functions and TelnetOption*** commands that are confusing me? :)