Code:
var %channel $iif($2,$2,#DEFAULTCHANNEL,#OTHERCHANNEL,#ANOTHER)
var %users $nick(%channel,0, -1)
Both of these lines are wrong. I don't know how #OTHERCHANNEL would ever work in an $iif.

Code:
var %channel $iif($2,$2,#DEFAULTCHANNEL)
var %users $calc($nick(%channel,0) - 1)


Regarding the script OrFeAsGr posted, it will return the amount of users on all channels your bot is currently on, looping through $comchan - which returns how many channels and channelnames the bot is currently on.