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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

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

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Getting the Previous Line

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


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

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Sun 29 Jul 2012 11:29 PM (UTC)  quote  ]
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

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

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

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

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

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


783 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]