mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2011
Posts: 53
S
Babel fish
OP Offline
Babel fish
S
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
D
Vogon poet
Offline
Vogon poet
D
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
E
Self-satisified door
Offline
Self-satisified door
E
Joined: Jul 2013
Posts: 4
PLEASE explain ur answer is all greek to a newb like me ty.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You can use somthing like this. (Untested)
Code:
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


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
O.K. Feast your eyes on some more greek smile
Code:
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,>) %a

Halt the default output
haltdef

The end of the script
}

Joined: Nov 2014
Posts: 5
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 5
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,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
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: 5
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 5
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,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I see, it was the word boundaries. You can try either of these, the former will color the colon and the latter will not.

Code:
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
}


Code:
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: 5
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 5
Works like a charm, thank you so much (=


Link Copied to Clipboard