|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
I'd like to highlight a single word - 'new' - in green and another single word - 'done' - in blue.
It seems the built in highlight function only permits a whole line/string to be highlighted.
Is there a way to highlight a single word - ideally in a specific channel, not across all channels?
|
|
|
|
Joined: Oct 2012
Posts: 164
Vogon poet
|
Vogon poet
Joined: Oct 2012
Posts: 164 |
Not with the Highlight feature, but you could do it with an on ^text script. /help halting default text /help on text
|
|
|
|
Joined: Jul 2013
Posts: 4
Self-satisified door
|
Self-satisified door
Joined: Jul 2013
Posts: 4 |
PLEASE explain ur answer is all greek to a newb like me ty.
|
|
|
|
Joined: Feb 2003
Posts: 3,412
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,412 |
You can use somthing like this. (Untested)
on ^*:text:*:#: {
if (word iswmcs $1-) { haltdef | echo -mt This is a new text. }
elseif (word2 iswmcs $1-) { haltdef | echo -mt This is a new text. }
}
You can look at the commands by type in mirc: /help halting default text /help on text
|
|
|
|
Joined: Oct 2012
Posts: 164
Vogon poet
|
Vogon poet
Joined: Oct 2012
Posts: 164 |
O.K. Feast your eyes on some more greek  on $&^*:text:/\b(new|done)\b/Si:*:{
var %a = $regsubex($1-,/\b(new)\b/gi,3\t)
var %a = $regsubex(%a,/\b(done)\b/gi,4\t)
echo -mirctbfl normal $iif(#,#,$nick) $+(<,$nick,>) %a
haltdef
} This line checks for the words "new" or "done" in a message. on $&^*:text:/\b(new|done)\b/Si:*:{Replace all instances of "new" with (coloured) " new" var %a = $regsubex($1-,/\b(new)\b/gi,3\t)Replace the word(s) "done" with " done" var %a = $regsubex(%a,/\b(done)\b/gi,12\t)Display the line echo -mirctbfl normal $iif(#,#,$nick) $+(<,$nick,>) %aHalt the default output haltdefThe end of the script }
|
|
|
|
Joined: Nov 2014
Posts: 7
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 7 |
Hi there,
I just found this script after searching for a script to highlight only single words in mIRC.
I am not sure if anyone follows this thread any longer, but I have two questions.
1: Is it possible to adjust the script to match for the proper capitalization of the word aswell, so it only matches New ?
2: I tried to add a word followed by colon, like New: but the script would not work. Is there a way to make the script do this ?
Thanks in advance
|
|
|
|
Joined: Jan 2004
Posts: 1,330
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,330 |
on $&^*:text:/\b(New|Done)\x3A\b/S:*:{
var %a = $regsubex($1-,/\b(New):\b/g,3\t)
var %a = $regsubex(%a,/\b(Done):\b/g,4\t)
echo -mirctbfl normal $iif(#,#,$nick) $+(<,$nick,>) %a
haltdef
} Remove the "i" modifier to force case sensitivity, ":" is meaningful in event headers, so escape it as \x3A
|
|
|
|
Joined: Nov 2014
Posts: 7
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 7 |
I removed the i-modifier, and case sensitivity works now, thanks.
Although, the changes involving colon does not work. I just copy/pasted your code and New: and Done: are not colored.
|
|
|
|
Joined: Jan 2004
Posts: 1,330
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,330 |
I see, it was the word boundaries. You can try either of these, the former will color the colon and the latter will not. on $&^*:text:/\b(New|Done)\x3A/S:*:{
var %a = $regsubex($1-,/\b(New:)/g,3\t)
var %a = $regsubex(%a,/\b(Done:)/g,4\t)
echo -mirctbfl normal $iif(#,#,$nick) $+(<,$nick,>) %a
haltdef
} on $&^*:text:/\b(New|Done)\x3A/S:*:{
var %a = $regsubex($1-,/\b(New)(?=:)/g,3\t)
var %a = $regsubex(%a,/\b(Done)(?=:)/g,4\t)
echo -mirctbfl normal $iif(#,#,$nick) $+(<,$nick,>) %a
haltdef
}
|
|
|
|
Joined: Nov 2014
Posts: 7
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 7 |
Works like a charm, thank you so much (=
|
|
|
|
|
|
|
|