one way would be to call a routine in the perform section, and in the called routine, test which network its running on, and only load the scripts eneded for that network.
so perform would call a remote that is always loaded. and that romote would test network ($network), and load the scripts you need for that network. and as a last thing before ending mIRC you could run a remote that would unload all but the one call by perform.
This is only one of several ways to control mirc based upon the netork connected to. Hope it helps.