Simple identifier, but very effective, as far as I've used it.
This is useful on networks where there are extra modes that mIRC generally doesn't let you check for, such as Owner/CO-Owner (+qo, ~), Protected op/Admin (+ao, &). This is best used as an identifier, where you can use it 2 times in an if statement to check if one nick has more power than the other.
Be sure to use $nick(#, nick).pnick, else it won't be able to find the mode character and therefor always return 1.
example:
alias modenum-test {
if ($modenum($nick($chan, $1).pnick) > $modenum($nick($chan, $2).pnick)) {
echo $1 has a higher rank than $2
}
else {
echo $1 has a lower rank than $2
}
}
if anything is unclear, post a comment or gimme a shout on IRC.
alias modenum {
var %x $left($1,1)
;check for voice (+)
if (%x == $chr(43)) {
return 2
}
;check for halfop (%)
elseif (%x == $chr(37)) {
return 3
}
;check for op (@)
elseif (%x == $chr(64)) {
return 4
}
;check for admin/protected op (&)
elseif (%x == $chr(38)) {
return 5
}
;check for owner/co-owner (~)
elseif (%x == $chr(126)) {
return 6
}
;if we have no match, $1 is probably a regular nick.
else {
return 1
}
}
lmao um ok what im saying is useing his ex with ur code if i did /modenum-test tom stan
tom is an chan owner and stan is a reg user it outputs tom has a lower rank than stan. im not saying to make it a 1 i used 0 for reg users and im not saying anything bad about ur code im just saying it gives the wrong info.
Sigh. Even if you add a ",0" to my $iif() statement, it still won't behave like the original, since the lower bound would be 0 rather than 1. Realistically, you'd need to use $calc() to increase the output by 1, in order to match his example.
HOWEVER the fact that it does not match the example in behaviour by returning the same values for the same modes is irrelevant - the fact remains that higher modes return higher numbers, thus you're able to establish precedence, which is the point of the snippet as explained in the original post.