Alright, it's the morning now. And somehow, it's working just fine with zero changes between last night and now.
Now my only issue is the commands adding to the main menu (Ex., when I use "Kei Look" it adds a line with only "Kei Look" to the main screen (Same thing happens when I use the sub-world's plugin))
Other than the above, which is perfectly tolerable, it's working perfectly. Thank you SO MUCH for helping me out!
Edit: And now even that issue is resolved! Thank you again!
Edit2: I'm now wondering if there's some way to strip off the trigger (the "puppet1> " part) before sending it to the chat_world (So that I can set all the windows to 80 columns, the default for this MUCK, and not have the triggers turn that into more than 80 and cause linebreaks where there shouldn't be some)
I COULD just add the length of the trigger to the columns, but then I'd have a buncha different-sized windows.
This is what I'm trying, but it's not changing what's sent to the world:
<script>
<![CDATA[
chat_world = ""
function redirect (name, line, wildcards, styles)
chat_world = string.sub (string.match (line, "[^ ]->"), 1, -2) -- figure out which world is the chat_world
line = string.sub(line, string.len(string.match (line, "[^ ]->"))+2, -1) -- Attempt to separate the actual line from the trigger
-- try to find "chat" world
local w = GetWorld (chat_world) -- get "chat" world
-- if not found, try to open it
if 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)
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>
Then only reason I'm calling the redirect function by defining it into a variable is because I couldn't find hide nor hair about just CALLING a function in lua, every site I tried to look up only had information about using functions as variable, not just outright calling them. So rather than experiment and get it wrong 20 times I just used something I knew would work.
Edit3: Changed the script, merged both sub-functions into the main function (Why did I even MAKE them sub-functions?)
Edit4: I tried modifying the colortell to wrap it in an "if not" to just not send the message if v.text was the prefix but then it wouldn't send anything at all
for _, v in ipairs (styles) do
if not v.text == chat_world .. "> " then
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end
end -- for each style run
Edit5:
Slight issue, not exactly critical but ANSI styles aren't moving over. For example, the OOC command is supposed to render in italics.
Main window (correct): https://gyazo.com/6a81ba8e5dc9f0ac171e21d9ccf6f2a4
Keith's window (incorrect): https://gyazo.com/f5ac650ba7cbd13c2d0a0e69ed95ded0
So to recap (Neither of these are critical)
- Strip the prefix from messages ("Keith> ")
- Transfer ANSI styles (Italics, bold, underline)