mIRC Homepage
Posted By: Patriot1911 Using $cnick when auto-color is used - 17/02/22 05:34 PM
I'm trying to retrieve the color automatically assigned to a given nick using $cnick, but some of the nicks have colors assigned to them using the 'Auto-color based on nick' option. If I use $cnick on those nicks, it just returns the default text color. Is there a way to retrieve the automatically generated nick-based code?
Posted By: maroon Re: Using $cnick when auto-color is used - 17/02/22 07:31 PM
$nick( $chan , $nick ).color
Posted By: Patriot1911 Re: Using $cnick when auto-color is used - 17/02/22 08:00 PM
Ah yeah, that works. And is shorter even. Thanks!
Posted By: Epic Re: Using $cnick when auto-color is used - 17/02/22 08:31 PM
Depending on which assigned numerical color code you want to know:
Code
//echo -a $cnick(NickName).color
//echo -a $nick(#chan,NickName).color

1.Assigned nickname color in "Address Book". Details here: https://en.wikichip.org/wiki/mirc/identifiers/$cnick
2.The actual color from the channel's nickname list. Details here: https://en.wikichip.org/wiki/mirc/identifiers/$nick
Posted By: maroon Re: Using $cnick when auto-color is used - 11/02/23 11:05 AM
I retract my answer, and ask if anyone has a solution. I'm trying to create an echo that's a modification of the display of the ON TEXT event, and the solution only works in a channel.

The OP was correct that $cnick(nick).color is not returning the correct color number if that nick is being auto-colored to a random color. In those cases, it's instead returning:

Code
$cnick($nick,1).color returns $color(listbox text)
$cnick($nick  ).color returns $color(normal)
$cnick($nick  )       returns N for the Nth matching rule
$cnick($nick  ).auto  returns $true if the nick matches an autocolor rule (even if the nick's color is not actually coming from that auto-rule)


The $nick($chan,$nick).color is not a complete solution because $nick() won't work in a query window where the auto-nick rule is coloring the speaker, because $chan being $null in a query window makes it an invalid parameter error, and $nick($nick,1) won't work either.

Even if I share a channel with the nick, I can't steal the color from $nick($chan,$nick).color unless their color in that channel comes from the auto-color rule, instead of from some other rule.

If I use /cline to turn a nick red, $nick().color is the only one that gives me true info about the nicklist nick being red, and $cnick().auto continues telling me that their nick matches an auto-color rule, but doesn't tell me that the nick isn't actually being autocolored.
© mIRC Discussion Forums