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 ➜ Getting the Previous Line

Getting the Previous Line

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


Posted by Chik   (10 posts)  Bio
Date Sun 29 Jul 2012 09:47 PM (UTC)
Message
Hi,

What's the best way to get the previous line?
GetRecentLines(2) gives me the previous line, but it also gives me the current line as well.
GetLineInfo(GetLinesInBufferCount()-1, 1) gives me the previous line from the output window, not the actually line received from the mud. If the line is wrapped around, it gives me only part of the line.
Thanks for your help,
Top

Posted by Fiendish   USA  (2,558 posts)  Bio   Global Moderator
Date Reply #1 on Sun 29 Jul 2012 11:29 PM (UTC)
Message
Quote:
GetRecentLines(2) gives me the previous line, but it also gives me the current line as well.

So split at newline?

Or try http://www.gammon.com.au/scripts/doc.php?function=GetLineInfo

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Chik   (10 posts)  Bio
Date Reply #2 on Sun 29 Jul 2012 11:51 PM (UTC)
Message
GetLineInfo(GetLinesInBufferCount()-1, 1) gives me the previous line from the output window, not the actually line received from the mud. If the line is
wrapped around, it gives me only part of the line.
Is there way to specify the actual line, not the line from output window?
Thanks,
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 31 Jul 2012 05:50 AM (UTC)
Message
All it really saves is the line in the output window. However some people use the plugin callback OnPluginScreendraw which is called as lines are drawn.

You could use OnPluginPacketReceived to find the actual text arriving, as it arrives, complete with ANSI code sequences, etc.

Why do you want to do this?

- Nick Gammon

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

Posted by Chik   (10 posts)  Bio
Date Reply #4 on Fri 10 Aug 2012 07:20 PM (UTC)
Message
I need to create a trigger, but that trigger only needs to fire depending on the previous line received.
The previous line is sometimes long, so it gets wrapped, and sometimes short.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 11 Aug 2012 12:23 PM (UTC)
Message
Just make a catch-all trigger (ie. match on "*") with "keep evaluating" set). Save whatever it matched on in a variable.

Then when the "other" trigger matches you can check this variable.

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


20,746 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.