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 ➜ VBscript ➜ Multi-line Tellcapture

Multi-line Tellcapture

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


Posted by Giz   (10 posts)  Bio
Date Tue 14 Aug 2007 12:14 AM (UTC)
Message
Ok searched the forum tried all the info i could find but still i'm running short i get the trigger to capture the first line but none of the rest this is the trigger and the script

the line to match from: Someone tells you, "something"
this can also be said in diffren languages and it would be like this: Someone tells you in undercommon, "something"

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

sub DoTell (name, output, argv)

world.AppendToNotepad "Tells", FormatDateTime (Now, vbShortTime) & ": " & ""& argv(1) &" "& argv(2) &" "& argv(3) &": "& argv(4) &"" + vbcrlf

End sub


thanks for any replies
/Giz
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 14 Aug 2007 05:35 AM (UTC)

Amended on Tue 14 Aug 2007 05:37 AM (UTC) by Nick Gammon

Message
The default for a dot in a regular expression is to match everything *except* a newline. Since your text has newlines in it, you need to add the "dot matches all" option, like this:


Match on: ^(.+) (say|says|tell|tells|ask|asks) (.*), "(?s)(.+)"\Z


That seemed to work OK for me, matching multiple lines.

- Nick Gammon

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

Posted by Giz   (10 posts)  Bio
Date Reply #2 on Tue 14 Aug 2007 11:01 AM (UTC)
Message
Yes Thanks nick that worked for capture but now i runned into a another problem, when it captures it captures the tell and then it takes the next line no matter what it is seems like the trigger doesn't end after the last "


/giz
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Tue 14 Aug 2007 04:56 PM (UTC)
Message
I'm not sure what type of mud or mush you are using, but for most servers, tells are sent as one line which can be linewrapped by the client. Are you positive you need a multiline trigger for this?

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Giz   (10 posts)  Bio
Date Reply #4 on Tue 14 Aug 2007 06:17 PM (UTC)
Message
Sadly yes because the mud i play "Realms of the Dragon" don't autowrap this it just auto sets the next line on a col break like this:
someone tells you in common, "HoSen e fan helt
imba"
maybe the easiest way is to force the immortals to change the wrapings

/Giz
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 14 Aug 2007 08:41 PM (UTC)

Amended on Tue 14 Aug 2007 08:43 PM (UTC) by Nick Gammon

Message
Can you please post another copy of your exact trigger?

See http://mushclient.com/copying

Also, post the lines of output from the MUD that result in an overrun - does the problem line have a " in it? (Include the extra line that appears in the output).

- Nick Gammon

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

Posted by Giz   (10 posts)  Bio
Date Reply #6 on Tue 14 Aug 2007 08:49 PM (UTC)
Message
ok this is a sample from the notepad:
12:50: You ask someone, someone, someone, someone and someone in undercommon: "uh?"
Holding : Gnomishly Dragon Enchanted Celestial Armagor's Scourge (Storm
Bonded) (left hand) and Ultimately Gnomishly Insulated Spiked Adamantite Shield (right


The Trigger: </trigger>
<trigger
enabled="y"
lines_to_match="4"
match="^(.+) (say|says|tell|tells|ask|asks) (.*), &quot;(?s)(.+)&quot;$\Z"
multi_line="y"
omit_from_output="n"
regexp="y"
script="dotell"
sequence="2"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>

the output from the mud:
someone says in undercommon: "but you did superlow damage.. 1.5k.. without my overshield"

and the script:
sub DoTell (name, output, argv)

Dim Tell

Tell = split(argv(4))

world.AppendToNotepad "Tells", FormatDateTime (Now, vbShortTime) & ": " & ""& argv(1) &" "& argv(2) &" "& argv(3) &": "& argv(4) &"" + vbcrlf


End sub

finially i should maybe say that i got all of this in a plugin don't know if that matters.

/Giz
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #7 on Tue 14 Aug 2007 09:00 PM (UTC)
Message
Quote:

ok this is a sample from the notepad:
12:50: You ask someone, someone, someone, someone and someone in undercommon: "uh?"
Holding : Gnomishly Dragon Enchanted Celestial Armagor's Scourge (Storm
Bonded) (left hand) and Ultimately Gnomishly Insulated Spiked Adamantite Shield (right

...

someone says in undercommon: "but you did superlow damage.. 1.5k.. without my overshield"


I'm not seeing here the extra line you spoke about, however I can reproduce it like this:


Someone tells you, "
Ok searched the forum tried all the info i could find but
still i'm running short i get the trigger to capture the
first line but none of the rest this
is the trigger and the script"
Someone else tells you, "oh no, another line"


If I test that, it matches on both tells, for the simple reason that it finds:


someone tells you ... "something"


The problem is, in the batch of lines it is looking at, the "something" includes a second tell. I am working on a workaround for this, will post again soon.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 14 Aug 2007 09:27 PM (UTC)
Message
Well I got it to work fairly well. I redid it in Lua, sorry for that, but VBscript isn't as good at string handling. For this to work you need to make Lua your main script language. Alternatively, make this single trigger into a small plugin that uses Lua, that will work.


<triggers>
  <trigger
   enabled="y"
   lines_to_match="10"
   match="^(.+) (say|says|tell|tells|ask|asks) (.*), &quot;(?s)(.+?)&quot;\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="2"
  >
  <send>

-- remove backslashes from in front of the double-quotes
line = string.gsub ([[%0]], '\\\\"', '"')

result = ""

-- get last match
for w in string.gmatch (line, '.-, ".-"') do
  result = w
end -- for

-- find who told us what again
who, what = string.match (result, '(.-), "(.+)"')

-- append to notepad
AppendToNotepad ("Tells", 
                os.date ("%H:%M") .. ": " .. who .. ": " .. what .. "\\r\\n")

</send>
  </trigger>
</triggers>


What this does is (in send-to-script, so it doesn't need a script file):


  • Remove backslashes from in front of the quotes - MUSHclient adds them in when it sees send-to-script, but we don't need them for multi-line literals.

  • Scans the matching text for "someone tells you something", dropping all but the last one.

  • Rescans the last matching one to find the "who" and "what".

  • Logs that one to the notepad.


That should result in each line only being logged once.

- Nick Gammon

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

Posted by Giz   (10 posts)  Bio
Date Reply #9 on Tue 14 Aug 2007 10:55 PM (UTC)
Message
Thanks nick i tried and put that one in to a plugin and it work to an extent i still get the same problem though with it capturing lines that not includes a tell.

I guess i just give that a rest and go with the one line tell capture untill i've managed to get the immorts to change the mud handler


/giz
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #10 on Tue 14 Aug 2007 11:19 PM (UTC)
Message
You could try having the termination being a line which ends with quotation mark. You might be unlucky enough to get a message where someone happens to have a set of quotes within the message in just the wrong spot, but it will be better than nothing.

It is much easier to fight for one's ideals than to live up to them.
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.


32,953 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.