i need to count how many pple are online and offline. what i did cant work for me.

alias load.notify {
if ($dialog(switchbar)) {
did -r switchbar 2
var %y = 1
while (%y <= $scid(0)) {
scon %y
did -i switchbar 2 1 cb root
did -a switchbar 2 +eb $iif($status != disconnected,1 1,2 2) $iif($status == connected,$scon(%y).network $+ $chr(9) $+ $me $chr(91) $+ $usermode $+ $chr(93) on $scon(%y).server $+ : $+ $port,Not connected $+ $chr(9) $+ Not connected)
did -i switchbar 2 1 cb last
did -a switchbar 2 +eb 3 3 Online ( $+ $notify(%x) $+ )
did -i switchbar 2 1 cb last
var %x = 1
while (%x <= $notify(0)) {
if ($notify(%x).ison == $true) {
did -a switchbar 2 +c 3 3 $notify(%x)
}
inc %x
}
did -i switchbar 2 1 cb up
did -a switchbar 2 +eb 4 4 Offline ( $+ $notify(%x) $+ )
did -i switchbar 2 1 cb last
var %x = 1
while (%x <= $notify(0)) {
if ($notify(%x).ison == $false) {
did -a switchbar 2 +c 4 4 $notify(%x)
}
inc %x
}
inc %y
}
did -i switchbar 2 1 cb up
}
}

it will get Online () and Offline ()

confused
crazy