mIRC Home    About    Download    Register    News    Help

Print Thread
To optimize code #223600 30/07/10 12:58 AM
Joined: Sep 2007
Posts: 109
K
kwell Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Sep 2007
Posts: 109
Code:
on ^*:text:*:*:{
  haltdef
  if $count($nick(#,$nick).pnick,@) { var %colour 04 }
  if $count($nick(#,$nick).pnick,+) { var %colour 03 }
  if $chan { echo -ti16 $v1 %colour < $nick > $1- }
  elseif $query($nick) { echo -ti16 $v1 %colour < $nick > $1- }
}

@ (Red)
+ (Green)
users (Blue)

I can not make normal users blue =o/

Re: To optimize code [Re: kwell] #223601 30/07/10 01:39 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
One way would be to insert an else-condition after the second if-condition:
Code:
else { var %colour 12 }
for
Code:
all
other users, or
Code:
elseif ($nick(#,$nick,r)) { var %color 12 }
for regular users only (as further/other nick prefixes might be in used, depending on the network).

But why trouble to color with a script at all?
mIRC has an in-build "nick colors" feature in the Address Book (Alt-B; /help nick colors). You even can add/change the nick color settings of this feature with editbox commands. In your case, the commands to set the three color rules would be:
/cnick -m0 * 4 @
/cnick -m0 * 3 +
/cnick -nm0 * 12


smile

Edit:
Ah, don't forget to use
/cnick on
once so you enable the in-build nick coloring feature.


[nit-pick]
If you're familiar with the mIRC command syntax, you take /cnick <on|off> for granted. It's switching that switchbox, but afaik is not documented in the helpfile, and it does not print any message like similar "switch"-commands do, e.g /notify <on|off> laugh
[/nit-pick]

Last edited by Horstl; 30/07/10 02:02 AM.