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 ➜ Python ➜ Trouble getting text colour

Trouble getting text colour

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


Posted by Shwick   (21 posts)  Bio
Date Sat 29 May 2010 08:29 AM (UTC)

Amended on Sat 05 Jun 2010 05:43 AM (UTC) by Nick Gammon

Message
I'm trying to match the colour of text I receive from the mud.

I'm using world.GetLinesInBufferCount, world.GetStyleInfo and world.GetLineInfo.

The problem is the output buffer changes to rapidly that I can't detect the text I want.

Am I supposed to match the trig_line with a line from the output buffer by iterating through it?

I tried outputting the last 25 lines of the output buffer using GetLineInfo, counting from GetLinesInBufferCount - 25 to GetLinesInBufferCount.

The output was skipping lines from the screen, it was not sequential.

Is there a method that gets called when the output buffer changes, or am I going about this the wrong way.

for example, this never seems to work:


#check last line in the buffer for colour yellow
line = world.GetLinesInBufferCount - 1        
styleRuns = world.GetLineInfo (line, 11)
ansiColour = world.GetStyleInfo (line, styleRuns, 14)                
        if ansiColour == 65535:
                print('found')


wow my code tags aren't even working... im doing godlike tonight
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 05 Jun 2010 05:45 AM (UTC)
Message
Shwick said:

Is there a method that gets called when the output buffer changes, or am I going about this the wrong way.


Yes, a trigger matching "*" would be called when new output arrives.

As for the colour, a trigger matching the text you want and matching the wanted colour would work, provided the very first matching character of the trigger is the one you want to check the colour of.

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


10,148 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.