Thanks, but I think I can managed, and the current one doesn't seem to give too much trouble.

Only thing I noticed was that you used $dname instead of $sockname in your example, but I worked it out.

Here is the full script if you want to check for errors:
Code:
;=====
;Menus
;=====
menu status,channel {
  MUDclient
  .Connect:dialog -ma MUDclient MUDclient
  .Autologin:dialog -m Autologin Autologin
}

menu @MUDclient* {
  Connect:dialog -m MUDclient MUDclient
  Autologin:dialog -m Autologin Autologin
  Disconnect:closemud
  -
  Clear Buffer:clear @MUDclient
}

;=======
;Dialogs
;=======
dialog MUDclient {
  title "MUDclient"
  size -1 -1 200 135
  edit "mud.wormhole.se", 1, 5 25 190 20, autohs
  text "Port:", 2, 6 47 50 20
  edit "4000", 3, 5 65 190 20, autohs
  button "Connect", 4, 5 95 60 30, ok
  button "Cancel", 5, 135 95 60 30, cancel
  box "Remote Host:", 6, 0 1 200 135
}

dialog Autologin {
  title "Autologin"
  size -1 -1 200 135
  edit %mud.name, 1, 5 25 190 20, autohs
  text "Password:", 2, 6 47 50 20
  edit %mud.password, 3, 5 65 190 20, autohs
  button "OK", 4, 5 95 60 30, ok
  button "Cancel", 5, 135 95 60 30, cancel
  box "Name:", 6, 0 1 200 135
}

on *:dialog:Autologin:sclick:4: {
  %mud.name = $did(1).text
  %mud.password = $did(3).text
}

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 }
}

;===============
;Opening Routine
;===============
on *:sockopen:MUDclient*: {
  if ($color(background) == 0 || $color(background) == 15) {
    %colour = 1
    %mud.bn = 99,01
    %mud.bn2 = 01,00
    %mud.br = 99,04
    %mud.br2 = 00,04
    %mud.bg = 99,03
    %mud.bg2 = 00,03
    %mud.by = 99,08
    %mud.by2 = 00,07
    %mud.bb = 99,02
    %mud.bb2 = 00,02
    %mud.bm = 99,13
    %mud.bm2 = 00,06
    %mud.bc = 99,10
    %mud.bc2 = 00,12
    %mud.bw = 99,15
    %mud.bw2 = 00,01
  }
  else {
    %colour = 15
    %mud.bn = 99,01
    %mud.bn2 = 15,01
    %mud.bw = 99,15
    %mud.bw2 = 01,15
  }
  if ($sockerr > 0) { echo 4 -m @MUDclient- $+ %mud.MUDclient.addy Cannot Connect to %mud.MUDclient.addy | return }
  else { echo 7 -m @MUDclient- $+ %mud.MUDclient.addy Connection Opened to %mud.MUDclient.addy
    if ((%mud.name != $null) && (mud.password != $null)) { sockwrite -nt @MUDclient- $+ %mud.MUDclient.addy %mud.name
      sockwrite -nt @MUDclient- $+ %mud.MUDclient.addy %mud.password
    }
  }
}

;================
;Input Processing
;================
on *:input:@: {
  if (@MUDclient* iswm $active) {
    var %MUDclient = $remove($active,@)
    var %MUDclient2 = $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 %MUDclient2 CommandLock ON | %saymode = $2 | halt }
        else { echo 7 -m %MUDclient2 CommandLock OFF | unset %saymode | halt }
      }
      if $1 == /fw { var %mud_cnt = 1,%mud_total = $len($1)
        while (%mud_cnt <= %mud_total) {
          if ($mid($1,%mud_cnt,1) isnum) {
            var %mud_number = $iif(%mud_number,%mud_number $+ $mid($1,%mud_cnt,1),$mid($1,%mud_cnt,1))
          }
          else var %mud_direction = $mid($1,%mud_cnt,1)
          inc %mud_cnt
          if (%mud_direction) {
            if (!%mud_number) { var %mud_number = 1 }
            while (%mud_number) {
              sockwrite -nt %MUDclient %mud_direction
              dec %mud_number
            }
            unset %mud_number %mud_direction
          }
        }
        halt
      }
      else { return }
    }
    if ($1 == greet || $1 == tell || $1 == whisper || $1 == follow) { if ($2) { aline -ln $2 } }
    if ($sock(%MUDclient).status == $null) { echo 4 -m %MUDclient2 Not Connected | halt }
    else { if (%saymode) { sockwrite -nt %MUDclient %saymode $1- }
      else { sockwrite -nt %MUDclient $1- }
    }
    if (%mud.name != $null) { echo %colour -mi1 %MUDclient2 4[ $+ %mud.name $+ 4] $1- }
    else { echo %colour -mi1 %MUDclient2 4[ $+ $nick $+ 4] $1- }
    halt
  }
}

;===========================================
;Reading, Processing and Outputting Routines
;===========================================
on *:sockread:*: {
  if (MUDclient* !iswm $sockname) { return }
  var %MUDclient = $sockname
  var %MUDclient2 = @ $+ %MUDclient
  :nextread
  if ($sockerr > 0) { echo 4 -m %MUDclient2 Connection to $remove(%MUDclient,MUDclient-) Lost | return }
  else {
    sockread -nf %mud.info
    if ($sockbr == 0) { return }
    if (!%mud.info) { %mud.info = $chr(160) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }
    if ( isin %mud.info) { %mud.info = $remove(%mud.info,) }

    %mud.info2 = $ansi2mirc(%mud.info)
    if (%space == $chr(160) && !%mud.info2) { unset %space | goto nextread }
    if (!%mud.info2) { %mud.info2 = $chr(160) }
    if (%colour = 1) { %mud.info2 = $replace(%mud.info2,08,07,13,06,15,14,09,03,11,12,00,01)
      %mud.info2 = $replace(%mud.info2,%mud.bn,%mud.bn2,%mud.br,%mud.br2,%mud.bg,%mud.bg2,%mud.by,%mud.by2,%mud.bb,%mud.bb2,%mud.bm,%mud.bm2,%mud.bc,%mud.bc2,%mud.bw,%mud.bw2)
    }
    if (%colour = 15) { %mud.info2 = $replace(%mud.info2,%mud.bn,%mud.bn2,%mud.bw,%mud.bw2,02,12) }
    %friend = $strip(%mud.info2)
    if (says isincs %friend || states isincs %friend || asks isincs %friend || chats isincs %friend || questions isincs %friend || whispers isincs %friend || tells isincs %friend || grats isincs %friend || walks isincs %friend) {
      %friend = $gettok(%friend,1,32)
      if (%friend != some && %friend isalnum && $len(%friend) > 3) { aline -ln %MUDclient2 %friend }
      unset %friend
    }
    if (%mud.info2 != $chr(160)) { %mud.info2 = $chr(160) $+ %mud.info2 }
    $dll($scriptdirspaces.dll, echo, %colour -mi1 %MUDclient2 %mud.info2)
    %space = %mud.info2
    unset %mud.info %mud.info2
    goto nextread
  }
}

;================
;Closing Routines
;================
on *:sockclose:MUDclient*: {
  if (@MUDclient* iswm $active) {
    var %MUDclient = $active
    echo 4 -m %MUDclient Connection to $remove(%MUDclient,@MUDclient-) Closed.
  }
}

alias closemud {
  if (@MUDclient* iswm $active) {
    var %MUDclient = $remove($active,@)
    var %MUDclient2 = $active
    if ($sock(%MUDclient).status == $null) { halt }
    sockwrite -nt %MUDclient quit
    sockclose %MUDclient | echo 4 -m %MUDclient2 Connection to $remove(%MUDclient,MUDclient-) Closed.
  }
}
on *:CLOSE:@MUDclient*: {
  if (@MUDclient* iswm $active) {
    var %MUDclient = $remove($active,@)
    if ($sock(%MUDclient).status != $null) { sockwrite -nt %MUDclient quit | sockclose %MUDclient }
  }
}


GigIRC Network Admin
irc.gigirc.com