mIRC Home    About    Download    Register    News    Help

Print Thread
#99032 28/09/04 03:52 PM
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Hi there.

I'm currently finishing my theme engine and have stumbled across a problem I can't seem to fix.

I want to color nicknames in channel windows (on text/on action events) just like they would be colored in default mIRC without scripts.

What I use now is "$nick($chan,$nick).color", but my problem is that it returns "1" (default text color) if the nick doesn't match any of the entries in the nickname coloring setup of mIRC (ALT+B -> Colors). I need to know if the nick doesn't match any entry so I can skip coloring instead of making it the default text color.

It's quite difficult to explain, I hope you know what I mean...

Suggestions?
Thanks in advance.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Use $cnick($nick) - it will return 0 if the nick isn't in the alt-b > colors list.

Code:
if ($cnick($nick)) { dostuff }




New username: hixxy
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
That doesn't work.

Example:

I have 1 entry in the colors list, which marks all ops in red color.
$cnick(<opnick here>) will return 0, but infact it would have to be displayed in red.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
In which case you can use $cnick(@):

Code:
if ($cnick($nick)) { dostuff }
elseif ($regex($left($nick($chan,$nick).pnick,1),/([.~!*&amp;@%+])/)) {
  if ($cnick($regml(1))) { dostuff }
}


New username: hixxy
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
The thing is, I would have to do the same for ignore/op/voice/protect/notify lists, all user modes, idle time, user levels and addresses. And this for every text and action event. It would take ages writing such a script and text processing would be slow as hell.

But I guess there is no simple way, so I'll head over to the feature suggestions forum...

I just don't understand why Khaled didn't let "$nick($chan,$nick).color" return $null when there is no entry. Oh well...

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You don't have to check for notify, ignore, user levels, etc, $cnick() does that for you smile ($cnick() won't return the colour for an entry in the color list unless it matches all of the criteria)
The following will work fine:

Code:
alias iscolour {
  if ($cnick($1)) { return $cnick($1).color }
  elseif ($regex($left($nick($2,$1).pnick,1),/([.~!*&amp;@%+])/)) {
    if ($cnick($regml(1))) { return $cnick($regml(1)).color }
  }
  return 0
}


$iscolour(nick,channel)
channel is optional, you need to specify channel if you want to match a certain mode though.
It will return the colour if the nick is matched, 0 if it's not.


New username: hixxy
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Doesn't work for me.

This is my setup:

("Any nick (@)" = white)

Your alias always returns "2" (The "Any nick (No mode)" color), even if the nick is opped or voiced (also if I specify an invalid nick).

Thanks for your efforts anyway.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Ah yeah, didn't think of that, you're right, you would have to write a big alias to check all of the possibilities.


New username: hixxy
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Ok, too bad smirk

Thanks again.


Link Copied to Clipboard