I'm not at home, but here's something quick that may get you started. I'm only showing part of your script to get you started. If you need more after I'm home, I'll do more.

Code:
on *:dialog:MUDclient:sclick:4: {
  %mud.MUDclient.addy = $did(1).text
  %mud.MUDclient.port = $did(3).text
  %mud.MUDclient.info $1-
  sockopen MUDclient- $+ $did(1).text $did(1).text $did(3).text
  window -HexSl12k[9] +bestxn @MUDclient- $+ $did(1).text Fixedsys 9
  var %i = $lines($scriptdir\MUDclienttab.cfg)
  var %b = 1
  while %b < %i {
    %gimme = $read($scriptdir\MUDclienttab.cfg,%b)
    iline -ln @MUDclient- $+ $did(1).text %b %gimme
    inc %b
  }
  echo 7 -m @MUDclient- $+ $did(1).text Connecting to $did(1).text on port $did(3).text
  if ($sock(MUDclient- $+ $did(1).text).status == active) { echo 7 -m @MUDclient- $+ $did(1).text Already Connected }
}


Code:
on *:input:@: {
  if (@MUDclient* iswm $active) {
    var %MUDclient = $remove($active,@)
    if ($left($1-,1) == /) { if $1 == /s { sockwrite -nt %MUDclient /s | halt }
      if $1 == /h { sockwrite -nt %MUDclient /h | halt }
      if $1 == /r { sockwrite -nt %MUDclient $cr | halt }
      if $1 == /lock { if (!%saymode && $2) { echo 7 -m @ $+ %MUDclient CommandLock ON | %saymode = $2 | halt }


Code:
on *:sockread:*: {
  if (MUDclient* !iswm $dname) { return }
  var %MUDclient = $dname
  :nextread
  if ($sockerr > 0) { echo 4 -m @ $+ %MUDclient Connection to $remove(%MUDclient,MUDclient-) Lost | return }


Note in the last line that I changed it so that it isn't using the address variable. That is because your address variable will change if you connect to more MUDs. By setting the variable based on the socket or @window, it will not matter how many MUDs are open.


Invision Support
#Invision on irc.irchighway.net