|
Getting the Previous Line
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Chik
(10 posts) bio
|
| Date |
Sun 29 Jul 2012 09:47 PM (UTC) [ quote
] |
| 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 (848 posts) bio
Global Moderator |
| Date |
Reply #1 on Sun 29 Jul 2012 11:29 PM (UTC) [ quote
] |
| Message |
|
| Posted by |
Chik
(10 posts) bio
|
| Date |
Reply #2 on Sun 29 Jul 2012 11:51 PM (UTC) [ quote
] |
| 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 (18,772 posts) bio
Forum Administrator |
| Date |
Reply #3 on Tue 31 Jul 2012 05:50 AM (UTC) [ quote
] |
| 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) [ quote
] |
| 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 (18,772 posts) bio
Forum Administrator |
| Date |
Reply #5 on Sat 11 Aug 2012 12:23 PM (UTC) [ quote
] |
| 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.
788 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )