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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Getting the Previous Line

Getting the Previous Line

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


Posted by Chik   (10 posts)  [Biography] 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,
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] 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
[Go to top] top

Posted by Chik   (10 posts)  [Biography] 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,
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] 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
[Go to top] top

Posted by Chik   (10 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] 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
[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.


13,989 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]