Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Troubles with omit + multi-line

Troubles with omit + multi-line

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Wolfhedz   (1 post)  Bio
Date Mon 09 Jan 2012 09:53 AM (UTC)
Message
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 ?

Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 09 Jan 2012 11:29 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,767 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.