Code:
on *:connect: { getip }

alias getip {
  if ($sock(getip)) { sockclose getip } 
  sockopen getip www.whatismyip.com 80
  sockmark getip $1
}

on *:sockopen:getip:{
  if ($sockerr) { echo -snc info * [GetIP] Cannot resolve your ip: $sock($sockname).wsmsg | return }
  sockwrite $sockname GET $+(/automation/n09230945.asp HTTP/1.0,$lf,HOST: $sock($sockname).addr,$str($lf,2))  
}

on *:sockread:getip:{
  sockread -f &a
  var %s = $gettok($bvar(&a,1-).text,-1,10), %r =  /^(?:\d{1,3}\.){3}\d{1,3}$/
  if (!$regex(%s,%r)) { echo -snc info * [GetIP] Error parsing socket reply: $bvar(&a,1-).text }
  else {
    set -e %external.ip %s
    if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) {
      .localinfo $host %s
      echo -snc info * [GetIP] Resolved external IP: %s (set at 'local info')
    }
  }
}

#set.ip.auto off
#set.ip.auto end

menu status {
  Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
  .$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
  ..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
  .&Set 'local info' to ext. IP now : { getip verbose }
  .-
  .External IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : clipboard %external.ip
  .Local info IP $+ $chr(58) $ip : clipboard $ip
  .-
  .&Reset 'local info'
  ..&normal (winsock) lookup : localinfo -h
  ..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
}
Does this work for you?