An example of doing this is below. This trigger matches "Clan: xxx" and omits that line from the main window. It then locates the "clantalk" world using GetWorld, and if found, sends the message to that world.
<triggers>
<trigger
enabled="y"
match="Clan: *"
omit_from_output="y"
send_to="12"
sequence="100"
>
<send>
w = GetWorld ("clantalk")
if w then
w:ColourNote ("blue", "", "%0")
end -- world found</send>
</trigger>
</triggers>
The above example simply sends the line in the colour blue, however if you want to preserve the original colours, whatever they are, then a slightly more complex method is needed. You need to make a script file (this is using Lua scripting). Inside the script file put this:
function clantalk (name, line, wildcards, styles)
local w = GetWorld ("clantalk")
if w then
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
What this does is send any trigger text to the clantalk world, keeping the original colours (it goes through the style runs in the original line).
The omitting from output is optional, if you want the line to be in the original window and the other one as well, just don't check "omit from output".
Trying to append to notepad or send to another world window both seem to crash in Linux. I am not certain how to figure out the error or problem, as it crashes when trying to do the action on the trigger.
If it works in Windows, I am ok with that as it is a Windows program and I am lucky it runs in Wine.
Nick thanks for this one. Currently using it to filter out my chat/tells. Switched the plugin around to send the commands back to the main world and it works like a charm. Very convenient when you get spam coming left and right, while trying to pay attention to what's being said.
The SendToNotepad issue is the same issue that's been brought up due to the internal notepad in a few previous threads. Pretty much Wine has an incomplete dll for passing some of the values back and forth between MUSHclient and the internal editor, and this is causing the crash. I'm still trying to figure out which dlls to copy over, and I've tried all the mfc related dlls one by one. So far I've gotten it down to one error instead of three, but it still crashes.
I haven't had any issues with passing things back and forth to worlds, but I go only by world id numbers. Use GetWorldIdList() to see what the worlds are named, then pass things with GetWorldById(). My test for this was an empty world opening to 0.0.0.0, and I used this command in the world connected to the mud I play:
/GetWorldById( "4fbba8187ae44e23234467fe" ):Note( "foo" )
Sure enough, "foo" appeared in the other window with no problem.
Oh, and before I forget: MUSHclient v4.01, Wine-0.9.34
Alright i can't seem to figure this one out. I've got the channels being sent back properly, and sending information back to the world. my prompt is this:
The problem is i just cant figure out how to set it up so that when the channel is sent, it needs to gag the next prompt and then stop gagging. Any suggestions?
Have a trigger that matches the prompt, and omits from output. Give it a name. Set it to disabled initially.
When you need to gag the next prompt, enable this trigger. When the trigger fires it has a small script to disable itself. That way it only does it once.
Thanks Nick. Just called a function to turn itself off and works like a charm. Any idea if its possible that when you send commands back to the main window, it can capture the response and send it back to the filtered window?
I mean like right now i can send commands to the main world such as look, but i would like to see the actual response in the dummy world rather than having to flip back over to the main. anyway to do that whenever a command is sent from the dummy world?
Hmm I know this is an OLD post but is it possible to have the new activity light light up the world number when you get a new tell.. that way if you miss the tell you can tell by looking at the world number because it would be red...
Hrm unless im doing something wrong I couldnt get the beep to work. I was thinking maybe it's because the world is actually not connected. I'm just using 0.0.0.0 to connect..
I suppose If I could find a small server to run that would work.. Been wanting one anyways to test things.
Hmm wierd thing is it would work sometimes then sometimes it wouldn't But i just switched to linux and now I get this error any time I try to run the script
Run-time error
World: 4dimensions.org
Immediate execution
[string "Trigger: "]:4: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
[string "Trigger: "]:4: in main chunk
<triggers>
<trigger
enabled="y"
match="*You tell your clan,*"
send_to="12"
sequence="100"
>
<send>local w = GetWorld ("CHAT") -- get "CHAT" world
if w then -- if present
for _, v in ipairs (TriggerStyleRuns) do
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
w:Note ("") -- wrap up line
If you use "send to script (after omit)" then the style runs are also available from the global variable: TriggerStyleRuns.
(My emphasis). You need to change it from "send to script" to "send to script (after omit)".
It may have worked under Windows simply because you had another trigger that did a "send to script (after omit)" which would have established the global variable TriggerStyleRuns, which would still have "hung around" until the other trigger fired (although its contents would be wrong).
Does this filter window catch the word wrap? I've done a lot of similar experiments in zmud and it will work out, catching the tell and sending it to the appropriate window but it breaks off at the word wrap.
The problem with the word wrap is that - if it is a "hard" wrap - the new line looks like, well, a new line to the client. Thus it isn't part of the trigger.