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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Matching colours?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Matching colours?

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


Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

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

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

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

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

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


5,643 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]