Pop this script into ya remotes and right click a channel, click an option to see the channel status in image form.
Fairly useless, but was bored. Comment any improvements ;)
alias ops.img {
var %users = $nick($chan,0), %ops = 0, %c = 1
while (%c <= %users) {
if ($nick($chan,%c) isop $chan) {
inc %ops 1
}
inc %c 1
}
var %ops.perc = $round($calc((%ops / %users) * 10),0)
echo -a Ops:0,0--* 11,11 $+ $str(X,%ops.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %ops.perc))
}
alias voices.img {
var %users = $nick($chan,0), %voices = 0, %c = 1
while (%c <= %users) {
if ($nick($chan,%c) isvoice $chan) {
inc %voices 1
}
inc %c 1
}
var %voices.perc = $round($calc((%voices / %users) * 10),0)
echo -a Voices: 11,11 $+ $str(X,%voices.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %voices.perc))
}
alias hops.img {
var %users = $nick($chan,0), %hops = 0, %c = 1
while (%c <= %users) {
if ($nick($chan,%c) ishop $chan) {
inc %hops 1
}
inc %c 1
}
var %hops.perc = $round($calc((%hops / %users) * 10),0)
echo -a Hops:0,0-- 11,11 $+ $str(X,%hops.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %hops.perc))
}
alias status {
voices.img
hops.img
ops.img
}
menu channel {
Status Img: status
Server Status Img: serverstatus
}
alias serverstatus {
lusers
}
raw 265:*: {
var %local.perc = $calc(($5 / $7) * 10)
echo -a Local Users:0,0X 11,11 $+ $str(X,%local.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %local.perc))
}
raw 266:*: {
var %global.perc = $calc(($5 / $7) * 10)
echo -a Global Users: 11,11 $+ $str(X,%global.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %global.perc))
}
Actually, nevermind, the problem must have been somewhere in your while loop. Now realizing that you have the correct formula, I edited your script and here is what worked:
alias ops.img {
var %ops.perc = $round($calc(($nick(#,0,o) / $nick(#,0)) * 10),0)
echo -a Ops:0,0--* 11,11 $+ $str(X,%ops.perc) $+ 1,1| $+ 14,14 $+ $str(X,$calc(10 - %ops.perc))
}
Since I am lazy to really discover why this happens, just try adjusting your script to that. ;P
Best wishes,
BloodHound
Interesting idea, however, your while loops can easily be replaced with $nick(#,0,aohvr) (/help $nick).
Not only this, but your script malfunctioned for me. On a channel with no ops it returned 100% (my server supporting the ~&@%+ prefix & me using version 6.21). And on a channel with only 3 ops, it returned 50%. I\'ve discovered that this is due to your formula, EX:
My channel has 15 users, 3 are ops:
//echo -a $calc(($nick(#,0) / $nick(#,0,o)) * 10) returned 50%
Why? Because, $nick(#,0) (The total amount, 15) is divided by the amount of ops (3). IE: 15 / 3 = 5. Next, you multiply this result by 10. So, 5 * 10 = 50, returning 50%.
Try using this formula (X = Number of Ops, Y = Total amount of nicks): X / Y * 100
So now, we replace the variables with our real amount of ops and real amount of users:
3 / 15 (0.2) * 100 = 20%, which is the correct answer.
Try implementing this somewhere in your script.