Troubles with omit + multi-line

Posted by Wolfhedz on Mon 09 Jan 2012 09:53 AM — 2 posts, 11,708 views.

#0
Hi everyone,

I started using Mush (4.73) a few days ago and managed to fiddle around with triggers and alias. Now I'm in need of something a bit more complicated.

I am trying to redirect a fixed number of lines (after a key phrase) to another window but I have no clue about how to do it.


I managed to come up with a temporary solution (using advices and scripts I found around here) :

<triggers>
  <trigger
   enabled="y"
   lines_to_match="18"
   match="You call up an in-depth wristpad scan...((?s)(.*))"
   multi_line="y"
   omit_from_output="y"
   omit_from_log="y"
   regexp="y"
   script ="redirect_lm"
   sequence="100"
  >
  </trigger>

</triggers>

<script>
function redirect (name, line, wildcards, styles, chat_world)

  -- try to find "chatnet" world
  local w = GetWorld (chat_world)  -- get "Map" 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 .. ", discarded line, " .. line)
    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 

function redirect_lm (name, line, wildcards, styles)
  redirect( name, line, wildcards, styles, "Map" )
end -- function redirect 

</script>


I used a chat redirector and some advice from another topic. The problem is, the redirected text outputs on the new window ("Map") AND on the principal window. I have no idea about how to fix this and I'd use some help.

Thanks by advance !

PS : I want to apologize for my english. As I am not a native english writer, I try to do my best to be most the comprehensible I can. Also, maybe I failed to find a similar topic/ posted on the wrong forum, can you, please, redirect me ?

Australia Forum Administrator #1
Template:faq=23
Please read the MUSHclient FAQ - point 23.


You are better off not using a multi-line trigger, but three triggers: start of group, middle of group (multiple lines) and end of group. Those can all omit from output as required.