mIRC Homepage
Posted By: pif___ is this possible, higlight text - 04/08/07 02:46 AM
Hi guys,

I am in a news channel. The format of the text in this channel is like this

<CNN> ......
<BBC> ......
<FOX> &#8230;..

What I would like to do is to change the color of each line according to the source. For instance, CNN will have a red color whereas BBC will have Blue. Can you help me? Can I mix the colors so the source (i.e. <CNN>) will have a color different than the text??

Regards,

P.S. I am only a regular user, so I do not have access to the bot
Posted By: LostShadow Re: is this possible, higlight text - 04/08/07 02:53 AM
Try looking at your address book (Alt B), and select the colors tab. You can select colors for individual nicks and channel modes.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 03:15 AM
Thnx for the reply...

The news sources (i.e. CNN, FOX, ..etc) are not nicks, It is like this

[NICK] <BBC> ...............
[NICK] <CNN> ...............

So I am not sure if what you said is till valid. Can you explain more please?
Posted By: Lpfix5 Re: is this possible, higlight text - 04/08/07 03:35 AM
Originally Posted By: pif___
Hi guys,

I am in a news channel. The format of the text in this channel is like this

<CNN> ......
<BBC> ......
<FOX> &#8230;..

What I would like to do is to change the color of each line according to the source. For instance, CNN will have a red color whereas BBC will have Blue. Can you help me? Can I mix the colors so the source (i.e. <CNN>) will have a color different than the text??

Regards,

P.S. I am only a regular user, so I do not have access to the bot


Code:
on ^*:TEXT:*:#:{
if (CNN isin $1-) { echo # $replace($1-,CNN,4CNN) | halt }
}


Posted By: Bekar Re: is this possible, higlight text - 04/08/07 07:39 AM
You can't use the Address book's 'Colors' tab, but you can use the Options/IRC/Highlight stuff.

This can match text strings, and highlights (or plays a sound or ... etc.) based on the plain text string you've entered.

For example, I highlight '*bek*' to higlight lines with a partial-match of my nick in it.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 12:50 PM
Originally Posted By: Lpfix5

Code:
on ^*:TEXT:*:#:{
if (CNN isin $1-) { echo # $replace($1-,CNN, 4CNN ) | halt }
}




Thnx smile The script does work, is it possible to modify it to do the following

<NICK_1> |CNN| news news news news

What I want to do is this, if the text is from a certain nick (i.e. NICK_1), "|CNN|" will have a color, and "news news news news" will have a different color. If the text is from a different nick -other than NICK_1- it will be ignored. Currently I am using a "Digital Color Nick v3.5" to change the nicks' colors; it will be good if the script also changes the nicks color also.

It is something like this:

Take the input, verify the nick, if OK, change the colors, otherwise skip.

I appreciate all the help.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 12:51 PM
Originally Posted By: Bekar
You can't use the Address book's 'Colors' tab, but you can use the Options/IRC/Highlight stuff.

This can match text strings, and highlights (or plays a sound or ... etc.) based on the plain text string you've entered.

For example, I highlight '*bek*' to higlight lines with a partial-match of my nick in it.


It is not something that I write, it is something that the others write.
Posted By: Bekar Re: is this possible, higlight text - 04/08/07 01:28 PM
Originally Posted By: pif___
It is not something that I write, it is something that the others write.

That's what the Highlight stuff does. It doesn't highlight your own messages, only those sent by other users.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 01:45 PM
Originally Posted By: Bekar
Originally Posted By: pif___
It is not something that I write, it is something that the others write.

That's what the Highlight stuff does. It doesn't highlight your own messages, only those sent by other users.


sorry i did not know that...

*EDIT*
I just tested it, it is good and simple, but the only problem is that you will have a single color for the whole line.
Posted By: Riamus2 Re: is this possible, higlight text - 04/08/07 02:04 PM
If you don't like how the highlighting works, then just use the script that was given to you. If you want the CNN part to have |'s around it, just make the script that way...

Code:
on ^*:TEXT:*:#:{
  if (CNN isin $1) { echo $chan $+(03<,$nick,>) 04|CNN|05 $2- | halt }
  elseif (MSN isin $1) { echo $chan $+(03<,$nick,>) 04|MSN|05 $2- | halt }
}


And so on. If you want the |'s to have color, just move the color control codes outside of the |'s rather than inside them.

Note that this was changed to trigger only when the network is in the first "word" (i.e. <CNN> news here)... not when it appears anywhere else in the text. It will also only color the first word. In my opinion, that will look better. Note that it will not change any other colors of text in the news message if there are colors in it.

*EDITED* Changed the colors to use 3 colors as requested. Just change the numbers to suit your needs.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 02:54 PM
Riamus: Can you update your code so it does the following if it is no too much trouble, otherwise just ignore my request

<NICK_1> |CNN| news news news news

<NICK_1> === color1
|CNN| === color2
news news news news === color3

thnx in advance




Posted By: Riamus2 Re: is this possible, higlight text - 04/08/07 03:08 PM
Edited... see above.
Posted By: pif___ Re: is this possible, higlight text - 04/08/07 03:37 PM
Thnx....

Can I do something like this

Code:
on ^*:TEXT:*:#:{
  if ($nick == NICK_1) {
    if (CNN isin $1) { echo $chan $+(03<,$nick,>) 04|CNN|05 $2- | halt }
    elseif (MSN isin $1) { echo $chan $+(03<,$nick,>) 04|MSN|05 $2- | halt }
} }


GR8...Thnx everyone for the help...this code now modifies the posts made by NICK_1 only. I will try to modify it further. Something I noticed is that the spaces between the braces and after the if statemnts are mandatory!...thnx to all of you especially Riamus2 and Lpfix5.
Posted By: Riamus2 Re: is this possible, higlight text - 04/08/07 04:39 PM
Yes, spacing is required. smile
Posted By: Lpfix5 Re: is this possible, higlight text - 05/08/07 01:31 AM
Originally Posted By: pif___
Thnx....

Can I do something like this

Code:
on ^*:TEXT:*:#:{
  if ($nick == NICK_1) {
    if (CNN isin $1) { echo $chan $+(03<,$nick,>) 04|CNN|05 $2- | halt }
    elseif (MSN isin $1) { echo $chan $+(03<,$nick,>) 04|MSN|05 $2- | halt }
} }


GR8...Thnx everyone for the help...this code now modifies the posts made by NICK_1 only. I will try to modify it further. Something I noticed is that the spaces between the braces and after the if statemnts are mandatory!...thnx to all of you especially Riamus2 and Lpfix5.


Code:
on ^*:TEXT:*:#:{
if ($nick == NICK_1) && (MSN isin $1) || (CNN isin $1) { echo # $+(03<,$nick,>) $replace($1-,$1,$+(4|,$1,|5)) | halt }
}


&& means like saying AND/Bitwise Comparison and || means saying Or so in the script we check if $nick Matches and if MSN or CNN is in
Posted By: Riamus2 Re: is this possible, higlight text - 05/08/07 03:04 AM
Close, but you didn't remove the <>'s. Besides, if they are one, then you can't make different colors for each kind of news item, which was the original request.
Posted By: Lpfix5 Re: is this possible, higlight text - 05/08/07 07:04 AM
Originally Posted By: Riamus2
Close, but you didn't remove the <>'s. Besides, if they are one, then you can't make different colors for each kind of news item, which was the original request.


What are you talking about? Im copying from PIF's last post has I quoted it and made it smaller, I didnt read anything else, + making new colors within one line of code for every word is easier then saying pie.
Posted By: pif___ Re: is this possible, higlight text - 05/08/07 11:08 AM
Thnx guys, i appreciate it a lot.

I am trying to add spaces after one of the variables
Code:
echo $chan [ $chr(32) $1 $chr(32) $chr(32) ]

does not work...any thoughts?

Something else I noticed
Code:
$+(1,[ 06,$2 1,])

produce the output w/o extra spaces, which is good

Code:
1 [ 06 $2 1 ]

This one adds a lot of spaces, which is in my case bad! I am not sure why is that and what is the difference.
Posted By: SladeKraven Re: is this possible, higlight text - 05/08/07 11:39 AM
1. Try using $chr(160) I could be wrong but I think that only works with certain fonts, but I don't have the time to check through them all.

2. The $+ identifier is the difference maker.

From the help file:

$+(n1,...,nN)

Combines all of the specified parameters, the same as using $+ in between each item.

So without it you're gonna get the spaces.
Posted By: pif___ Re: is this possible, higlight text - 05/08/07 12:37 PM
$chr(160) gave me the wrong ascii, did you mean 255 instead?

thnx for that hint.


*EDIT*
255 is wrong also...
Posted By: SladeKraven Re: is this possible, higlight text - 05/08/07 12:59 PM
No I meant 160.

//echo -a $chr(160) Hello $chr(160) World $chr(160) !
Posted By: pif___ Re: is this possible, higlight text - 05/08/07 03:04 PM
Thnx...

160 produced wrong ascii. The one that worked was 254!!! It could be related to my language settings.
Posted By: Bekar Re: is this possible, higlight text - 05/08/07 09:43 PM
And the font you are using..
Posted By: RusselB Re: is this possible, higlight text - 06/08/07 12:01 AM
For a true space, you should use $chr(32), as any other ascii value might return something that doesn't look like a space based on the font being used.

One work around for the multiple spacing, for output messages, is to use something like <bold>space<bold>space<bold>space<bold>
the bold tags will prevent mIRC from removing the extra spaces, since the spaces aren't literally side-by-side.

The above example creates what looks like 3 spaces, and will work no matter what font you're using.
Posted By: pif___ Re: is this possible, higlight text - 06/08/07 10:07 AM
Originally Posted By: RusselB
For a true space, you should use $chr(32), as any other ascii value might return something that doesn't look like a space based on the font being used.

One work around for the multiple spacing, for output messages, is to use something like <bold>space<bold>space<bold>space<bold>
the bold tags will prevent mIRC from removing the extra spaces, since the spaces aren't literally side-by-side.

The above example creates what looks like 3 spaces, and will work no matter what font you're using.


Thnx your trick did the job laugh
Posted By: Riamus2 Re: is this possible, higlight text - 06/08/07 06:14 PM
Originally Posted By: Lpfix5
Originally Posted By: Riamus2
Close, but you didn't remove the <>'s. Besides, if they are one, then you can't make different colors for each kind of news item, which was the original request.


What are you talking about? Im copying from PIF's last post has I quoted it and made it smaller, I didnt read anything else, + making new colors within one line of code for every word is easier then saying pie.


Quote:
It is like this

[NICK] <BBC> ...............
[NICK] <CNN> ...............


His original request was to color the text when what's shown above is said in the channel. You weren't removing the <>'s from that text. You just added ||'s to it. That's what I meant. As far as the colors go, he originally requested having each news source using a different color format, which isn't that easy with a single line (BBC being one set of colors, CNN another, etc).
Posted By: Lpfix5 Re: is this possible, higlight text - 06/08/07 10:49 PM
Originally Posted By: Riamus2
Originally Posted By: Lpfix5
Originally Posted By: Riamus2
Close, but you didn't remove the <>'s. Besides, if they are one, then you can't make different colors for each kind of news item, which was the original request.


What are you talking about? Im copying from PIF's last post has I quoted it and made it smaller, I didnt read anything else, + making new colors within one line of code for every word is easier then saying pie.


Quote:
It is like this

[NICK] <BBC> ...............
[NICK] <CNN> ...............


His original request was to color the text when what's shown above is said in the channel. You weren't removing the <>'s from that text. You just added ||'s to it. That's what I meant. As far as the colors go, he originally requested having each news source using a different color format, which isn't that easy with a single line (BBC being one set of colors, CNN another, etc).


Still easy...

Code:
on ^*:TEXT:*:#:{
  if ($nick == Elder) && (BBC isin $1) || (CNN isin $1) { echo # $+(03<,$nick,>) $replace($1-,<CNN>,$+(4,|CNN|,5),<BBC>,$+(11,|BBC|,5)) | halt }
}
Posted By: Riamus2 Re: is this possible, higlight text - 07/08/07 12:20 AM
Easy, but hard to see easily... especially for a newer scripter. It also makes it more of a pain to edit later. Especially if you are doing more than a couple news outlets as well as having more colors than just the label (as was requested later in the thread).

I never said it wasn't possible. Just that it was easier to just have it on separate lines if they were going to be formatted differently.
Posted By: Lpfix5 Re: is this possible, higlight text - 07/08/07 06:50 AM
Originally Posted By: Riamus2
Easy, but hard to see easily... especially for a newer scripter. It also makes it more of a pain to edit later. Especially if you are doing more than a couple news outlets as well as having more colors than just the label (as was requested later in the thread).

I never said it wasn't possible. Just that it was easier to just have it on separate lines if they were going to be formatted differently.


I know lol im aloud to have fun, you should already know me by now :P There's ton's of possibilities!
© mIRC Discussion Forums