Filter to Seperate Windows? (chat/tells/clans etc)

Posted by Drauka on Tue 31 Oct 2006 03:17 AM — 24 posts, 100,505 views.

#0
I'd like to filter text and remove it from the main window and put in seperate window(s) for several things (like channels, tells, clans, etc).

Is it possible to do this other than appending to the notepad? That is all I could find from searching.
USA #1
What else would you be looking to put it into, besides notepad?

If it's because you want colors, I'm pretty sure the notepad can use colors.
Amended on Tue 31 Oct 2006 03:32 AM by Zeno
Australia Forum Administrator #2
If you want a fully coloured extra window, you can create a dummy world window.

There was a discussion about this in this post:

http://www.gammon.com.au/forum/?id=6551

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).

Now your trigger needs to be:


<triggers>
  <trigger
   enabled="y"
   match="Clan: *"
   omit_from_output="y"
   script="clantalk"
   sequence="100"
  >
  </trigger>
</triggers>


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".
Amended on Tue 31 Oct 2006 04:07 AM by Nick Gammon
#3
Wow, thank you very much.
#4
Hrm, this seems to crash Mushclient under wine.

Tried appending to a new world and new note (through manual and gui) and the client crashes.

Will try at home tonite under Windows to verify that just a wine thing.
Australia Forum Administrator #5
Which version of MUSHclient are you using, and which action crashes it? Using a dummy world window, or appending to the notepad?
#6
It works in Windows.

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.

Sorry Nick, I wish I could be more help.

Using 3.82
#7
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.
USA #8
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
Amended on Mon 16 Apr 2007 05:16 PM by Shaun Biggs
#9
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:

^(\d+?)h\, (\d+?)m(?:\, \d+?e)?(?:\, \d+?w)? (c?e?x?k?d?b?@?)-

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?
Australia Forum Administrator #10
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.
#11
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?
Australia Forum Administrator #12
Can you give an example?
#13
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?
Australia Forum Administrator #14
Well I think that is a bit tricky, because "look" can generate lots of lines of output: room description, mobs, exits, objects, etc.

I don't see how you can easily "mark" those multiple lines as belonging to the other window.
USA #15
well there maybe be a way to mark it is by color if setup properly. but of course that depend on muds.. hmm.

just my two cent.
#16
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...
Australia Forum Administrator #17
There is no current provision to do that. Perhaps play a beep sound when you get a chat? Or, update the status or info bar.
#18
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.
Australia Forum Administrator #19
Sounds work even with a disconnected world. Can you paste your trigger here?

See http://mushclient.com/copying
#20
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

end -- world found



</send>
</trigger>
</triggers>



and here was the sound trigger

<triggers>
<trigger
enabled="y"
match="*you tell your clan,*"
sequence="100"
sound="Z:\usr\lib\openoffice\share\gallery\sounds\apert.wav"
>
</trigger>
</triggers>

Australia Forum Administrator #21
Quote:

bad argument #1 to 'ipairs' (table expected, got nil)


You are doing "send to script" (send_to="12") which does not support the TriggerStyleRuns table.

See the help for editing a trigger. This is available here, as well as from inside MUSHclient:

http://www.gammon.com.au/scripts/doc.php?dialog=IDD_EDIT_TRIGGER

Near the bottom of the page it says:


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).
#22
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.
Australia Forum Administrator #23
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.

Check out this post:

http://www.gammon.com.au/forum/?id=7991

A little way down the thread talks about capturing multi-line chats. See if that helps.