This script will show your "power" on all your networks.
It works as intended, but I found several scripting flaws.
You aren't using a while loop, you're using goto's instead.
You use "/set" when "/var" would work just as fine. And it doesn't unset the global variables. Then you should use $comchan($me,0) instead of $chan(0), as $chan(0) will include channel windows that are open even if you are not on them. Then when the script is done collecting information, it messages the channel with this information. It doesn't work in queries and it doesn't check if active is a channel or not..
This script needs plenty of work, could be posted as a simple snippet as well. Good luck in the future though!