i made this for a script i was using to mirror stuff between channels and i didn't want to have to keep opening servers in the same order.
i remember a few people asking about something like this before so i figured i'd post it. sorry if something similar has been posted before.
what this does is it creates a $findnetwork identifier that uses the network name to find the scon # and return it's value.
example:
/scon $findnetwork(EFnet)
that will switch the script to the EFnet network. (assuming you are connected to that network.)
if you try to find a network that you are not connected to, it returns $null

Code:
/findnetwork {
  var %nextnet = 1
  scon %nextnet
  while ($network != $null) {
    if ($network == $1) { return %nextnet }
    inc %nextnet
    scon %nextnet
  }
  return $null
}


if anyone has some tips to make the script better, i would also like to hear them.