Bold and non-bold white match on the same colour?

Posted by Poromenos on Tue 05 Oct 2004 05:49 PM — 8 posts, 26,514 views.

Greece #0
I am trying to make a tell trigger and I don't want it to match on grey, but if i turn bold on it matches neither on white nor gray, while if I turn it off it matches on both. Bug?
USA #1
Poromenos, you sure you have it "on" and not greyed?
And, are you sure youre using the right grey? (whether thats bold black, or normal white)

While we're on this subject, can we get a "Default" option for both?
Greece #2
Yes, it's on (match_bold="y") and I want to match on bold white, but it matches on gray, so it's quite wrong... Looks like a bug.
Australia Forum Administrator #3
I can't reproduce that.

If I set it to match on bold white, and send this with Shift+Ctrl+F12:

blah \1B[1m\1B[37m room \1B[0m blah


(matching the word "room")

This matches - bold white. It also doesn't match "room" in non-bold white (ie. gray).

Greece #4
OK, this is in a plugin, I used this to test:

\1B[1m\1B[37mSomeone tells you 'list'
\1B[0m\1B[37mSomeone tells you 'list'



The trigger is:


  <trigger
   enabled="y"
   ignore_case="y"
   keep_evaluating="n"
   match="([A-Za-z]+) tells you \'list\'$"
   match_bold="n"
   match_text_colour="y"
   regexp="y"
   script="sbTellList"
   sequence="100"
   text_colour="15"
   other_text_colour="black"
   other_back_colour="black"
  >
  </trigger>


With match_bold="n":

Someone tells you 'list'
TRACE: Matched trigger "([A-Za-z]+) tells you \'list\'$"
TRACE: Executing trigger script "sbTellList"
Someone tells you 'list'
TRACE: Matched trigger "([A-Za-z]+) tells you \'list\'$"
TRACE: Executing trigger script "sbTellList"


The first tell is bold white, yet it matches on both.

With match_bold="y":

Someone tells you 'list'
Someone tells you 'list'
TRACE: Matched trigger "([A-Za-z]+) tells you \'list\'$"
TRACE: Executing trigger script "sbTellList"


The first one is the bold one, yet it only matches the second one. I can't explain this erratic behaviour...
Australia Forum Administrator #5
It works for me, it isn't a bug nor is it erratic. :)

Here is my output (I removed the script call and changed it to colour the line, to better see what it was doing).


Someone tells you 'list'
TRACE: Matched trigger "([A-Za-z]+) tells you \'list\'$"
Someone tells you 'list'


Note how it correctly matches the bold line. However the trigger is this:


<triggers>
  <trigger
   bold="y"
   custom_colour="2"
   enabled="y"
   ignore_case="y"
   match="([A-Za-z]+) tells you \'list\'$"
   match_bold="y"
   match_text_colour="y"
   regexp="y"
   sequence="100"
   text_colour="15"
  >
  </trigger>
</triggers>


Not only do you need:

match_bold="y"

but also:

bold="y"

Taken together they mean this:

  • match_bold - is the bold attribute to be tested?
  • bold - what value are we testing for?


This is how we get the tri-state checkbox. You clearly can't have three values (checked, unchecked and gray) in a simple yes/no value.

If match_bold = "y" then it tests the bold attribute. If it is testing the bold attribute it compares it to the value in the "bold" = "x" line, where "x" is Y or N.



Amended on Thu 07 Oct 2004 07:19 AM by Nick Gammon
Greece #6
Oh, great! It works, thank god. I got a lot of abuses of this one, I thought that it was "y" for checked, "n" for unchecked and if the entire line didn't exist it was grayed. Thanks Nick :)
Australia Forum Administrator #7
If the line does not exist it takes a default value - that is, "n" for flags, "" for strings, and 0 for numbers. Although in some cases it has other defaults (eg. the number of lines in your output buffer does not default to zero if you omit that line).

In fact, the script function GetDefaultValue tells you what the defaults are for various options.