Newbie question on filtering/triggering

Posted by Uma on Tue 17 Nov 2009 03:49 PM — 7 posts, 21,455 views.

#0
Hello! I'm an utter newbie when it comes to mush client, muds, scripting, and plugins, but i manged to get a filter working that sends all pages in my Moo of choice to it's own window. The problem I'm having is that I'd like to move pages that say a particular thing to a third window, but can't seem to get the original Chat_redirector.xml from overcoming any sort of triggers or alternate filters I put in place! The complication is that the pages can come from any user. A friend told me that * can be used as a wild card in place of a name, but that doesn't' seem to work in my present situation. Any advice?

I've tried making a trigger for the main 'world' window and setting the sequences higher or lower. I've tried making another filter plug in(which i already have pitching spam to a spam window) grab the page as well, but I guess my page-filtering-redirector is just thorough.

What information would be helpful toward advising me? Should I copy the redirector here? should I copy an example of the text i want caught?.
Australia Forum Administrator #1
Can you restate the problem a bit?

Do you want your filter to stop things (like spam) going into the main chat window? Or are you saying that with the chat redirector there, the spam doesn't go to the spam window at all?

As I recall, each plugin gets a look at the incoming lines, so that if the chat redirector trigger matches one, it will get redirected, even if a different plugin also matches it.

You may need to edit the chat redirector itself, and then if you put in a *lower* sequence it will match earlier (and if you do *not* check "keep evaluating") so that could be used to direct some lines elsewhere.

Quote:

A friend told me that * can be used as a wild card in place of a name, but that doesn't' seem to work in my present situation.


I'm not sure what you mean by not working here. If regular expressions are *not* checked, a * will match any string (constrained by what you put around the *) however that isn't directly relevant to the problem here.
#2
Okay.

I want all pages to go to a page window. I have a disadvantage in the game that makes me get fake pages from people, but they are very standard messages like:

From your wristpad: billybob pages, 'I hate you'

I want to get my real ones, but to eventually filter out the very standard messages.

My script i use now looks like this (some one sent it to me and i kind of mimicked what i saw till i made it work right heh).


<?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="^\[party\].*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="^\[chatnet\].*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="^\[.*?zo.*?\].*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>




<trigger
enabled="y"
match="^From your wristpad:.*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="^You feel a tug on your line.*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>



<trigger
enabled="y"
match="^You text.*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>



</triggers>

<!-- Script -->


<script>
<![CDATA[
chat_world = "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>



I tried to have another script say

<trigger
enabled="y"
match="^from your wristpad: billybob pages, 'I hate you'*$"
omit_from_output="y"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

But as you said, each plugin looked at the same time.

I tried to get a trigger to look for the same text and never got them to work.

So in short i want the rotating list of anoying spam to go to a spam window (or to just be muted entirely!) and for the real pages to go to my happy functional page window.

Thank you so much for being patient with me. that's really nice of you!
Australia Forum Administrator #3
Well I would put your extra trigger into the plugin (slot it between some of the others), and change it a bit like this:


<trigger
  enabled="y"
  match="From your wristpad: * pages, '*'"
  omit_from_output="y"
  regexp="n"
  sequence="10"
>
</trigger>


Note I have:

  • Made it *not* a regular expression
  • Put asterisks in where I thought things might change
  • Not called the redirect script (so it won't be printed)
  • Made the sequence lower, so it gets done first


By the way, you need to get the case right (you had "from your wristpad") but the example line you gave was "From your wristpad").

However now that I look closely, it looks similar to a real page. How do you tell the difference? Is it the name of the person, or something else?
#4
OH this looks like it's going to work out great! thank you so much!

Well, you can only tell the difference in that the pages are random and unreasonable and from some one you may not have spoken to before. it's supposed to make you seem to be going crazy. you're paranoid and everyone is out to get you so...there's no way to distinguish between the paranoia induced pages, or the real pages. I'm just filtering out some of the more common paranoia messages so i get less dings from pages coming in :)
#5
Do i need to use rising sequence numbers for them to all work? i tried to make a lot of filters like that at 10 and only the first worked.
Australia Forum Administrator #6
No, all the 10 sequence triggers are checked before anything with a higher sequence (like 11).

However they should all work, unless one of them is too general. For example:


(trigger a) Match: * says *
(trigger b) Match: Nick says hello


If they were both sequence 10, and the first one matched, then the second one wouldn't match because the first one caught it first.