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.
 Entire forum ➜ MUSHclient ➜ General ➜ Matching colours?

Matching colours?

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


Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Sat 15 Jan 2005 09:25 PM (UTC)
Message
OK, I don't know if this has been said/done before, but I don't remember it. I have a list of people, like so:


Avatar          Draginox ai'Talnai wishes you a happy WEMas. (Baali)
Avatar          {IC} Annale Firestorm - not all is as it seems {SoA} (Baali)
Avatar          Calin I WILL KILL YOoOOoOo look, something shiney!  (Baali)
Administrator   Mari Fyremusik-LifeWind  [SoA-Leader][SoT][IOQC][CoD]  (Baali) [The Symposium]
Avatar          [AFK] Feriocri is for sale/trade check bio. (Baali)
Obdurati        Ba'al Typh, In memory of Grish. (Leader of Baali) [The Symposium]
Avatar          Poromenos is getting DSL in 5 days. (Baali)


Now, to my surprise, this list summarises very accurately what I want to do. I want to match the names unambiguously, but I don't know of a good way to do it, except look at colours. The ranks are deep green and the names are light green, but the Ba'al before Typh's name is also deep green. Is there a way for MC to distinguish colors, or can I do a trigger to match on light green and it will match on whatever comes after the deep green?
I hope that was clear :P

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 15 Jan 2005 10:09 PM (UTC)
Message
You can make a trigger conditional on matching a specified ANSI colour (red etc.) which is tested for on the *first* character of the matching text.

To be more sophisticated you need to make a trigger that matches regardless of colour, and in the trigger get the colour of the style runs and make your own tests. See GetStyleInfo (search the forum too) for examples.

In Lua trigger matching the line with its style runs is supplied as a 4th argument to the trigger function, so it is particularly easy to do there.

- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #2 on Sun 16 Jan 2005 08:21 AM (UTC)
Message
Ah, I see. Well, the plugin is already written in VBscript, so I'll use GetStyleInfo, thanks :)

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #3 on Sun 16 Jan 2005 08:59 AM (UTC)
Message
By the way, if I use World.GetLinesInBufferCount, will I be absolutely sure that I get the line the trigger matched on, or could it be some other line?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 20 Jan 2005 10:05 PM (UTC)
Message
I think you need to be cautious. If the line wraps over 2 lines, that count would be the last line of the group, not the first, and may possibly be the blank line that is started after the newline. Do a test and see.

- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #5 on Fri 21 Jan 2005 12:26 PM (UTC)
Message
It works fine so far... Does it look at the output window, or the lines from the mud? I.e. will having a small margin break it?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 25 Jan 2005 02:37 AM (UTC)
Message
Here is the actual code:


// world.GetLinesInBufferCount 
//
//  returns actual number of lines in output buffer 
//  (not count of lines received)

long CMUSHclientDoc::GetLinesInBufferCount() 
{
  return m_LineList.GetCount ();
}



It is the exact count of lines in the output buffer.

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


19,389 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.