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 ➜ Multi-line-scripting...

Multi-line-scripting...

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


Posted by Ixokai   USA  (24 posts)  Bio
Date Sun 27 Apr 2003 08:04 PM (UTC)

Amended on Sun 27 Apr 2003 11:11 PM (UTC) by Nick Gammon

Message
I'm having a problem with a script/trigger i'm working on. Its purpose? To capture the output of the 'news' command, prepend a little note, and to omit it from the log file.. I want my logs to contain only IC information, y'see.. The annoying/interesting part about this is that there is the header and footer lines are the same.. soo, i had to work out a toggle..

Here's the toggle-trigger:

  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^(\-{6}(\* ){3}){6}$"
   name="news_toggle"
   omit_from_output="y"
   regexp="y"
   script="OnMultilineToggle"
   send_to="12"
   sequence="100"
  >
  <send>mlType = 'news'</send>
  </trigger>


It runs through this script:


def OnMultilineToggle(sTriggerName, sLine, lWildCards):
    if world.GetTriggerOption("multiline_catcher", "enabled"):
        world.SetTriggerOption("multiline_catcher", "enabled", 0)
    else:
        world.SetTriggerOption("multiline_catcher", "enabled", 1)
        world.SetVariable("in_multiline", mlType)


Which turns on/off this trigger:


  <trigger
   expand_variables="y"
   match="*"
   name="multiline_catcher"
   omit_from_log="y"
   omit_from_output="y"
   send_to="2"
   sequence="1000"
  >
  <send>@in_multiline | %0</send>
  </trigger>


Here's the output:


news | The following news topics are available: 
news | ----------- ----------- ----------- ----------- ----------- 
news | Admins      Advertising Animals     CANON       CHARACTERS  
news | Chronology  Classes     HOUSES      INFORMATION Magic       
news | Medicine    Newbie      Patroni     Permission  Points      
news | POLICY      Prefects    Quidditch   RATING      Sorting     
news | SPOILERS    THEME       Timeline    Updates     Web 
news | ----------- ----------- ----------- ----------- ----------- 
news | It's strongly recommended that you read and become familiar with the 
news | contents of every news file. The ones in ALL CAPS and their 
news | subcategories are required reading for all players. 
news |  
news | Type 'news ' (no 's or s) to see an entry. 
news | ------* * * ------* * * ------* * * ------* * * ------* * * ------* * * 


The problem? It excludes the header, but includes the footer.. I'm not positive which I want-- both headers, or both footers-- but I don't quite see how to do either... help? :)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 27 Apr 2003 11:09 PM (UTC)
Message
I added [code] and [/code] to make the post read better, and simplified your matching trigger so it wouldn't take up as much room on the page.

Now to work out the problem ...

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 27 Apr 2003 11:16 PM (UTC)
Message
Take off the "keep_evaluating" on the first trigger. Then it will match, and not fall through to the second one.

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


12,955 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.