Try changing $network to $!network

The difference between the two is that $network gets evaluated on the first call of scon, thus it is set to the network name that the code is called from. Using $!network makes mIRC evaluate $network for each network encountered.