Matching colours?

Posted by Poromenos on Sat 15 Jan 2005 09:25 PM — 7 posts, 26,234 views.

Greece #0
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
Australia Forum Administrator #1
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.
Greece #2
Ah, I see. Well, the plugin is already written in VBscript, so I'll use GetStyleInfo, thanks :)
Greece #3
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?
Australia Forum Administrator #4
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.
Greece #5
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?
Australia Forum Administrator #6
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.