Multi-line-scripting...

Posted by Ixokai on Sun 27 Apr 2003 08:04 PM — 3 posts, 14,337 views.

USA #0
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? :)
Amended on Sun 27 Apr 2003 11:11 PM by Nick Gammon
Australia Forum Administrator #1
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 ...
Australia Forum Administrator #2
Take off the "keep_evaluating" on the first trigger. Then it will match, and not fall through to the second one.