[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  Multi-Line-Capture

Multi-Line-Capture

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


Posted by ZPY   (1 post)  [Biography] bio
Date Tue 19 Apr 2005 10:59 PM (UTC)
Message
Hi, im new in using Mushclient.
Great Client though.

Well Here's my problem.
I wanna capture my 'tells' in a specific window.
I gotta Plugin from a friend, but its only captureing single line tells.

Like this: (the tells looks exactly like this in the mud)
Dronur tells you, "I really don't know"

But if its a long tell it becomes two lines, and then its not working

Like this:
Dronur tells you, "I really don't know, ye gotta find that
out somehow by yer self, sorry can't
help you"

And I want it to Caputre the whole tell.
I really hope someone can help me with this.

My plugin looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, November 01, 2003, 3:12 PM -->
<!-- MuClient version 3.42 -->

<!-- Plugin "Tell_Capture" generated by Plugin Wizard -->

<muclient>
<plugin
name="Tell_Capture"
author="Pavo"
id="59d5bca4fb67f61c54534a4f"
language="VBscript"
purpose="Capture your tells and put it in a notepad window"
save_state="y"
date_written="2003-11-01 15:09:40"
requires="3.42"
version="1.0"
>

</plugin>


<!-- Get our standard constants -->

<include name="constants.vbs"/>

<!-- Triggers -->

<triggers>
<trigger
enabled="y"
lines_to_match="3"
match="^(.+) (say|says|tells|asks|tell|ask) (.*), &quot;rockers (.*)\&quot;$\Z"
multi_line="n"
name="lblTells"
omit_from_output="y"
regexp="y"
script="doRockers"
sequence="1"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
<trigger
enabled="y"
lines_to_match="2"
match="^(.+) (tells|asks|tell|ask) (.*), &quot;(.*)\&quot;$\Z"
multi_line="n"
omit_from_output="n"
regexp="y"
script="dotell"
sequence="2"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>

<!-- Script -->


<script>
<![CDATA[
sub OnWorldOpen
'world.note "---------- World Open ------------"
end sub

sub OnWorldClose
'world.note "---------- World Close ------------"
end sub

sub OnWorldConnect
'world.note "---------- World Connect ------------"
end sub

sub OnWorldDisconnect
'world.note "---------- World Disconnect ------------"
end sub

sub OnWorldGetFocus
'world.note "---------- World Got Focus ------------"
end sub

sub OnWorldLoseFocus
'world.note "---------- World Lose Focus ------------"
end sub

'------------------------------------------------------------
'
'------------------------------------------------------------
sub DoRockers (name, output, argv)

Dim teller

teller = argv(1)

if (teller = "You") then
teller = "Koodongan"

end if
world.ColourTell "silver", "", "["
world.ColourTell "gray", "", "Rockers"
world.ColourTell "silver", "", "]"
world.ColourTell "yellow", "", " "& teller &":"
world.ColourTell "red", "", " "& argv(4) &"" + vbcrlf
world.AppendToNotepad "Tells", FormatDateTime (Now, vbShortTime) & " : " & "[Rockers] "& teller &": "& argv(4) &"" + vbcrlf
end sub
'------------------------------------------------------------
'
'------------------------------------------------------------
sub DoTell (name, output, argv)
world.AppendToNotepad "Tells", FormatDateTime (Now, vbShortTime) & ": " & ""& argv(1) &" "& argv(2) &" "& argv(3) &": "& argv(4) &" "& argv(5) &"" + vbcrlf
End sub
'------------------------------------------------------------
'
'------------------------------------------------------------

]]>
</script>


</muclient>


[Go to top] top

Posted by Mastarck   Poland  (2 posts)  [Biography] bio
Date Reply #1 on Wed 12 Mar 2008 10:59 PM (UTC)
Message
what can I do to use both of:

omit_from_output="y"
multi_line="y"

lines_to_match="2"
match="^(?:&gt; )?(?:([A-Z][a-z]*(?: \w*){0,3})\.\n)?(?:Sa|Jest) tutaj (.*) widoczn(?:e|ych) wyjsc(?:ia|ie)?\: (.*)\.\Z"

i cannot gag location name and exits
(first line: location name starting with [A-Z] ending with \.) and no more than 4 words
and second line is much better for capture:

[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 13 Mar 2008 05:00 AM (UTC)

Amended on Thu 13 Mar 2008 05:01 AM (UTC) by Nick Gammon

Message
Multi-line triggers cannot directly omit from output, however you can do it with a bit of scripting.

First, make the trigger call a script in your script file (which you need to create if you don't have one in the Scripting configuration), like this:



<triggers>
  <trigger
   enabled="y"
   lines_to_match="2"
   match="^(?:&gt; )?(?:([A-Z][a-z]*(?: \w*){0,3})\.\n)?(?:Sa|Jest) tutaj (.*) widoczn(?:e|ych) wyjsc(?:ia|ie)?\: (.*)\.\Z"

   multi_line="y"
   regexp="y"
   script="mytrigger"
   sequence="100"
  >
  </trigger>
</triggers>


Now in your script file you can delete two lines (which hopefully will be the ones that just matched), like this:


function mytrigger (name, line, wildcards)
  DeleteLines (2)
end -- mytrigger 


See: http://www.gammon.com.au/scripts/doc.php?function=DeleteLines


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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,264 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]