nOthello — File Browser

nOthellov1.0b / nOthellov1.0b / nothello.ini

nothello.ini — 54.76 KB — Download this file

[nOthello]
version=1.0b
[aliases]
n0=; nOthello v1.0b by Nabiki^sKnight
n1=; mouse coor -> x,y
n2=nkoxy return $calc($int($calc(($1 - 8) / 32)) + 1) $calc($int($calc(($2 - 8) / 32)) + 1)
n3=; x,y -> center coor
n4=nkosqrcenter return $calc(($1 * 32) - 7) $calc(($2 * 32) - 7)
n5=nkostore {
n6=  if ($chr(32) isin $nofile($script(nothello.ini))) return " $+ $nofile($script(nothello.ini)) $+ nko.ini"
n7=  else return $nofile($script(nothello.ini)) $+ nko.ini
n8=}
n9=nkohost {
n10=  %~nkohost = 1
n11=  :A | if (($gettok(%nkoplayer,%~nkohost,46) != $null) && ($left($gettok(%nkoplayer,%~nkohost,46),1) != @)) { inc %~nkohost 1 | goto A }
n12=  .timer 1 1 unset %~nkohost | return %~nkohost
n13=}
n14=nkocol {
n15=  if (%nkobmp == $null) %nkobmp = x*x*x*x*x*x*x
n16=  if (($gettok(%nkobmp,$1,42) != x) && ($gettok(%nkobmp,$1,42) != $null)) {
n17=    if ($2 != f) return $gettok(%nkobmp,$1,42)
n18=    if ($left($gettok(%nkobmp,$1,42),1) isnum) return $gettok($gettok(%nkobmp,$1,42),5-,32) | return $gettok(%nkobmp,$1,42)
n19=  }
n20=  if ($2 == f) return
n21=  if ($1 == 1) return $gettok(%nko,1,46) | else return $gettok(%nko,2,46)
n22=}
n23=nkoquery {
n24=  if ($window(@nOthello-Info) == $null) nkoinfo n
n25=  if (($1 != 1) || ($line(@nOthello-Info,$line(@nOthello-Info,0)) != $2-)) aline -ph @nOthello-Info $2-
n26=  if (($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) && (($left($2,1) == <) && ($right($2,1) == >))) {
n27=    %~nkoquery = $mid($2,2,$calc($len($2) - 2))
n28=    if ($findtok(%nkoplayer,%~nkoquery,46) != $null) nkomsg u nkoquery $1-
n29=    if ($findtok(%nkoplayer,+ [ $+ [ %~nkoquery ] ] ,46) != $null) nkomsg s nkoquery $1-
n30=    unset %~nkoquery
n31=  }
n32=}
n33=nkomsg {
n34=  if ($gettok(%nko,7,46) == 3) {
n35=    if (($1 == u) || ($1 == 0)) { if ($sock(nOthellou*) != $null) sockwrite -n nOthellou* $2- | elseif ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) nkoquery 0 4***14 No connections to players }
n36=    if ((($1 == s) || ($1 == 0)) && ($sock(nOthellos*) != $null)) sockwrite -n nOthellos* $2-
n37=    if (($1 == h) || ($1 == 0)) { if ($sock(nkoHost) != $null) sockwrite -n nkoHost $2- | elseif ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) nkoquery 0 4*** 14 Not connected to host }
n38=    goto End
n39=  }
n40=  %~nkomsg = 1
n41=  :A | if ($gettok(%nkoplayer,%~nkomsg,46) == $null) goto End
n42=  %~nkomsg1 = $gettok(%nkoplayer,%~nkomsg,46)
n43=  if ($left(%~nkomsg1,1) == @) {
n44=    if (($1 == u) || ($1 == s)) { inc %~nkomsg 1 | goto A }
n45=  }
n46=  elseif ($left(%~nkomsg1,1) == +) {
n47=    if (($1 == s) || ($1 == h)) { inc %~nkomsg 1 | goto A }
n48=  }
n49=  elseif (($1 == h) || ($1 == u)) { inc %~nkomsg 1 | goto A }
n50=  if ($remove($remove(%~nkomsg1,@),+) == $me) { inc %~nkomsg 1 | goto A }
n51=  if ($gettok(%nko,7,46) == 1) {
n52=    if (($chat($remove($remove(%~nkomsg1,@),+)) != $null) && ($chat($remove($remove(%~nkomsg1,@),+)).status != inactive)) .msg = $+ $remove($remove(%~nkomsg1,@),+) 0,0 $2-
n53=    elseif ($remove($remove(%~nkomsg1,@),+) != $me) nkoquery 1 4***14 No DCC connection with $remove($remove(%~nkomsg1,@),+)
n54=  }
n55=  else {
n56=    if ($server != $null) .msg $remove($remove(%~nkomsg1,@),+) 0,0 $2-
n57=    elseif ($remove($remove(%~nkomsg1,@),+) != $me) nkoquery 1 4***14 Not connected
n58=  }
n59=  inc %~nkomsg 1 | goto A
n60=  :End | unset %~nkomsg %~nkomsg1
n61=}
n62=nothello {
n63=  if ($window(@nOthello) != $null) window -ar @nOthello
n64=  %~nkoopen = 344
n65=  if (%nkoplayer == $null) %nko = $puttok(%nko,0,7,46) | elseif ($gettok(%nko,7,46) < 1) unset %nkoplayer
n66=  if ($gettok(%nko,7,46) > 0) {
n67=    if ($2 != $null) { %~nkoopen1 = $readini $script(nothello.ini) nOthello version | if (%~nkoopen1 != $2) nkoquery 0 15» 14Host using v $+ $2 (User: v $+ %~nkoopen1 $+ ) }
n68=    if (($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) && ($1 != 0) && ($1 != $null)) %nkoplayer = $1
n69=    %~nkoopen1 = l9 | if ($window(-1).w > 640) %~nkoopen = 434 | else %~nkoopen = 438
n70=  }
n71=  if ($window(@nOthello) == $null) window -ep $+ %~nkoopen1 +tn @nOthello $gettok(%nko,8,46) %~nkoopen 314 @nOthello Arial Bold 12
n72=  if ($gettok(%nko,7,46) == 0) titlebar @nOthello Mode: Non-IRC
n73=  if ($gettok(%nko,7,46) == 1) titlebar @nOthello Mode: DCC
n74=  if ($gettok(%nko,7,46) == 2) titlebar @nOthello Mode: Query
n75=  if ($gettok(%nko,7,46) == 3) titlebar @nOthello Mode: Socket
n76=  nkoref
n77=  unset %~nkoopen %~nkoopen1
n78=}
n79=nkoini {
n80=  if (($1 == 0) && ($gettok(%nko,7,46) > 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null)) goto End
n81=  %nkoocc1 = 4 5.5 4 | %nkoocc2 = 4 4.5 5 | %nkoturn = 1 | nothello $1
n82=  drawdot @nOthello
n83=  if (($1 == 0) && ($gettok(%nko,7,46) > 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null)) nkomsg 0 nkoini %nkoplayer $readini $script(nothello.ini) nOthello version
n84=  :End
n85=}
n86=nkoboard {
n87=  drawrect -nrf $1 $gettok(%nko,3,46) 0 0 0 $window($1).dw $window($1).dh
n88=  if (($gettok(%nkobmp,5,42) != $null) && ($gettok(%nkobmp,5,42) != x)) {
n89=    %~nkobrd = $nkocol(5,f) | if ($exists($remove(%~nkobrd,")) != $true) { nkoquery 1 4***14 BG: $remove(%~nkobrd,") does not exist | %~nkobrd = 7 | goto A }
n90=    %~nkobrd = $nkocol(5)
n91=  }
n92=  if ($gettok(%nkobmp,6,42) == 1) drawpic -n $1 0 0 %~nkobrd
n93=  elseif ($gettok(%nkobmp,6,42) == 2) drawpic -ns $1 0 0 $window($1).dw $window($1).dh %~nkobrd
n94=  elseif ($gettok(%nkobmp,6,42) == 3) drawpic -ns $1 8 8 255 255 %~nkobrd
n95=  elseif (($gettok(%nkobmp,6,42) == 4) || ($gettok(%nkobmp,6,42) == 5)) nkodrawfill $1 5
n96=  %~nkobrd = 7
n97=  :A | drawline -nr $1 $gettok(%nko,4,46) 1 7 %~nkobrd 264 %~nkobrd
n98=  if ($calc(%~nkobrd + 32) < 289) { inc %~nkobrd 32 | goto A }
n99=  %~nkobrd = 7
n100=  :B | drawline -nr $1 $gettok(%nko,4,46) 1 %~nkobrd 7 %~nkobrd 264
n101=  if ($calc(%~nkobrd + 32) < 289) { inc %~nkobrd 32 | goto B }
n102=  unset %~nkobrd
n103=}
n104=nkotemp {
n105=  window -c @nOthello2 | window -hp +tn @nOthello2 0 0 384 314 @nOthello2 Arial Bold 12
n106=  if ($1 == 0) nkoboard @nOthello2 | else drawcopy -n @nOthello 0 0 344 314 @nOthello2 0 0
n107=  if (($gettok(%nko,6,46) < 1) || ($exists($remove($nkocol(5,f),")) != $true)) {
n108=    drawrect -nrf @nOthello2 $gettok(%nko,3,46) 1 266 3 21 73 | drawrect -nrf @nOthello2 $gettok(%nko,3,46) 1 320 3 21 73
n109=    drawrect -nrf @nOthello2 $gettok(%nko,3,46) 1 287 3 32 4 | drawrect -nrf @nOthello2 $gettok(%nko,3,46) 1 287 72 32 4
n110=  }
n111=  nkodrawdot 0 1 12 305 25
n112=  nkodrawdot 0 2 12 305 57
n113=  if ($exists($remove($nkocol(1,f),")) == $true) drawpic -ncs @nOthello2 344 0 31 31 $nkocol(1)
n114=  if ($exists($remove($nkocol(2,f),")) == $true) drawpic -ncs @nOthello2 344 32 31 31 $nkocol(2)
n115=  drawrect -nr @nOthello2 $gettok(%nko,4,46) 1 287 7 32 64
n116=  drawline -nr @nOthello2 $gettok(%nko,4,46) 1 288 39 319 39
n117=  drawdot @nOthello2
n118=}
n119=; turnnum,x,y
n120=nkodrawpic {
n121=  if ($window(@nOthello2) == $null) nkotemp
n122=  drawcopy -n @nOthello2 $2-3 30 30 @nOthello $2-3
n123=  if ($gettok(%nkobmp,$calc($1 + 2),42) isnum) drawcopy -nt @nOthello2 $gettok(%nkobmp,$calc($1 + 2),42) 344 $calc(($1 - 1) * 32) 30 30 @nOthello $2-3
n124=  else drawcopy -n @nOthello2 344 $calc(($1 - 1) * 32) 30 30 @nOthello $2-3
n125=}
n126=nkodrawfill {
n127=  if ($gettok(%nkobmp,6,42) == 5) %~nkodrawfill5 = 8 8 262 262 | else %~nkodrawfill5 = 0 0 $window($1).dw $window($1).dh
n128=  %~nkodrawfill1 = $pic($remove($nkocol($2,f),")).width | %~nkodrawfill2 = $pic($remove($nkocol($2,f),")).height
n129=  if ((%~nkodrawfill1 == 8) && (%~nkodrawfill2 == 8) && ($left($nkocol($2),1) !isnum)) { drawfill -nrs $1 $gettok(%nko,3,46) $gettok(%nko,3,46) 0 0 $nkocol($2) | goto B }
n130=  drawpic -nc $1 $gettok(%~nkodrawfill5,1-2,32) $nkocol($2)
n131=  %~nkodrawfill = $gettok($nkocol($2),3-4,32)
n132=  if ($left(%~nkodrawfill,1) !isnum) %~nkodrawfill = $gettok(%~nkodrawfill5,1-2,32) %~nkodrawfill1 %~nkodrawfill2 | else %~nkodrawfill = $gettok(%~nkodrawfill5,1-2,32) %~nkodrawfill
n133=  if ($left($gettok($nkocol($2),3,32),1) isnum) %~nkodrawfill1 = $gettok($nkocol($2),3,32)
n134=  if ($left($gettok($nkocol($2),4,32),1) isnum) %~nkodrawfill2 = $gettok($nkocol($2),4,32)
n135=  %~nkodrawfill3 = $gettok(%~nkodrawfill,1,32) | %~nkodrawfill4 = $gettok(%~nkodrawfill5,2,32)
n136=  :A
n137=  if (%~nkodrawfill3 < $gettok(%~nkodrawfill5,3,32)) {
n138=    drawcopy -n $1 %~nkodrawfill $1 %~nkodrawfill3 %~nkodrawfill4
n139=    inc %~nkodrawfill3 %~nkodrawfill1 | goto A
n140=  }
n141=  %~nkodrawfill3 = $gettok(%~nkodrawfill,1,32) | inc %~nkodrawfill4 %~nkodrawfill2 | if (%~nkodrawfill4 < $gettok(%~nkodrawfill5,4,32)) goto A
n142=  :B
n143=  if ($gettok(%nkobmp,6,42) == 5) {
n144=    drawrect -nrf $1 $gettok(%nko,3,46) 1 264 0 $calc( [ $window($1).dw ] - 264) $window($1).dh
n145=    drawrect -nrf $1 $gettok(%nko,3,46) 1 0 264 $window($1).dw $calc( [ $window($1).dh ] - 264)
n146=    drawrect -nrf $1 $gettok(%nko,3,46) 1 0 0 7 $window($1).dh
n147=    drawrect -nrf $1 $gettok(%nko,3,46) 1 0 0 $window($1).dw 7
n148=  }
n149=  unset %~nkodrawfill*
n150=}
n151=; flag,turnnum,size,x,y
n152=nkodrawdot {
n153=  if (0 isin $1) {
n154=    if (($gettok(%nkobmp,$2,42) != x) && ($gettok(%nkobmp,$2,42) != $null)) {
n155=      if ($exists($remove($nkocol($2,f),")) == $true) {
n156=        if ($gettok(%nkobmp,$calc($2 + 2),42) isnum) drawpic -ncts @nOthello2 $gettok(%nkobmp,$calc($2 + 2),42) 288 $calc((($2 - 1) * 32) + 8) 31 31 $nkocol($2)
n157=        else drawpic -ncs @nOthello2 288 $calc((($2 - 1) * 32) + 8) 31 31 $nkocol($2)
n158=        goto End
n159=      }
n160=      else nkoquery 1 4**14 P $+ $2 $+ : $remove($nkocol($2),") does not exist
n161=    }
n162=    drawdot -nr @nOthello2 $gettok(%nko,$2,46) $3- | goto End
n163=  }
n164=  if ($exists($remove($nkocol(5,f),")) == $true) %~nkodrawdot6 = y | else unset %~nkodrawdot6
n165=  if ($exists($remove($nkocol($2,f),")) == $true) %~nkodrawdot5 = y | else unset %~nkodrawdot5
n166=  %~nkodrawdot = 1 | :A
n167=  if ($gettok($4-,%~nkodrawdot,46) == $null) goto C
n168=  if (%~nkodrawdot5 == y) nkodrawpic $2 $calc((($gettok($gettok($4-,%~nkodrawdot,46),1,32) - 1) * 32) + 8) $calc((($gettok($gettok($4-,%~nkodrawdot,46),2,32) - 1) * 32) + 8)
n169=  else {
n170=    :E | %~nkodrawdot1 = %~nkodrawdot1 $calc((($gettok($gettok($4-,%~nkodrawdot,46),1,32) - 1) * 32) + 9) $calc((($gettok($gettok($4-,%~nkodrawdot,46),2,32) - 1) * 32) + 9)
n171=    %~nkodrawdot4 = %~nkodrawdot4 $calc((($gettok($gettok($4-,%~nkodrawdot,46),1,32) - 1) * 32) + 8) $calc((($gettok($gettok($4-,%~nkodrawdot,46),2,32) - 1) * 32) + 8) 30 30
n172=    %~nkodrawdot2 = %~nkodrawdot2 $nkosqrcenter($gettok($4-,%~nkodrawdot,46))
n173=    drawcopy -n @nOthello2 $calc((($gettok($gettok($4-,%~nkodrawdot,46),1,32) - 1) * 32) + 8) $calc((($gettok($gettok($4-,%~nkodrawdot,46),2,32) - 1) * 32) + 8) 31 31 @nOthello $calc((($gettok($gettok($4-,%~nkodrawdot,46),1,32) - 1) * 32) + 8) $calc((($gettok($gettok($4-,%~nkodrawdot,46),2,32) - 1) * 32) + 8)
n174=  }
n175=  inc %~nkodrawdot 1 | goto A
n176=  :C | if (%~nkodrawdot1 == $null) goto End
n177=  if (($gettok(%nkobmp,6,42) == x) || ($gettok(%nkobmp,6,42) == $null) || ($exists($remove($nkocol(5,f),")) != $true)) drawrect -nrf @nOthello $gettok(%nko,3,46) 1 %~nkodrawdot4
n178=  drawdot -nr @nOthello $gettok(%nko,$2,46) $3 %~nkodrawdot2
n179=  :End | unset %~nkodrawdot*
n180=}
n181=nkostat {
n182=  if ($window(@nOthello2) == $null) nkotemp 0
n183=  drawcopy -n @nOthello2 266 3 75 73 @nOthello 266 3
n184=  %~nkostat1 = $gettok(%nkoocc1,0,46) | if (%~nkostat1 == $null) %~nkostat1 = 0
n185=  if ($len(%~nkostat1) < 2) drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 330 15 %~nkostat1
n186=  else drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 325 15 %~nkostat1
n187=  %~nkostat2 = $gettok(%nkoocc2,0,46) | if (%~nkostat2 == $null) %~nkostat2 = 0
n188=  if ($len(%~nkostat2) < 2) drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 330 45 %~nkostat2
n189=  else drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 325 45 %~nkostat2
n190=  if ($calc(%~nkostat1 + %~nkostat2) > $gettok(%nko,10,46)) {
n191=    if ((%~nkostat1 < 1) || (%~nkostat2 < 1) || ($nkoscan(0) == $null)) { nkoresult %~nkostat1 %~nkostat2 | goto End }
n192=  }
n193=  if (%nkoturn == 2) drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 268 45 »» | else drawtext -nor @nOthello $gettok(%nko,5,46) Arial 18 268 15 »»
n194=  :End | unset %~nkostat1 %~nkostat2
n195=}
n196=; x,y,host[$null]/user[1] -> dot
n197=nkodot {
n198=  %~nkodot = $1 $2
n199=  if (($4 != $null) && ((%nkoocc1 != $replace($3,*,$chr(32))) || (%nkoocc2 != $replace($4,*,$chr(32))))) { %nkoocc1 = $replace($3,*,$chr(32)) | %nkoocc2 = $replace($4,*,$chr(32)) | nkoquery 0 4***14 Updating data from host | nkoref }
n200=  if (($findtok(%nkoocc1,%~nkodot,46) != $null) || ($findtok(%nkoocc2,%~nkodot,46) != $null)) { beep 1 | goto End }
n201=  if ($window(@nOthello) == $null) goto End
n202=  if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) %~nkodot1 = $replace(%nkoocc1,$chr(32),*) $replace(%nkoocc2,$chr(32),*)
n203=  if (%nkoturn == 1) %~nkodot2 = 2 | else %~nkodot2 = 1
n204=  %~nkoinvalid = y | nkoflip $1 $2 1 $nkosurr($1,$2,%~nkodot2)
n205=  if (%~nkoinvalid == $null) {
n206=    if (%nkoscan != $null) {
n207=      %~nkodot3 = 1
n208=      :A | if ($gettok(%nkoscan,%~nkodot3,46) != $null) { drawcopy -n @nOthello2 $gettok(%nkoscan,%~nkodot3,46) 30 30 @nOthello $gettok(%nkoscan,%~nkodot3,46) | inc %~nkodot3 1 | goto A }
n209=      unset %nkoscan
n210=    }
n211=    nkodrawdot 1 %nkoturn 12 $1 $2
n212=    nkodrawtext 1 14 267 100 Last Move:
n213=    nkodrawtext 0 14 272 112 $chr($calc($1 + 64)) $2
n214=    if (($3 == $null) && ($gettok(%nko,7,46) > 0)) {
n215=      if ($findtok(%nkoplayer, @ [ $+ [ $me ] ] ,46) != $null) nkomsg 0 nkodot $1-2 %~nkodot1 | else nkomsg h nkodot $1-2 0
n216=    }
n217=    if (($3 == 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null)) nkomsg s nkodot $1-2 %~nkodot1 0
n218=    %nkoocc [ $+ [ %nkoturn ] ] = $addtok(%nkoocc [ $+ [ %nkoturn ] ] ,%~nkodot,46)
n219=    if (%nkoturn == 1) %nkoturn = 2 | else %nkoturn = 1
n220=    nkostat
n221=    drawdot -h @nOthello
n222=  }
n223=  if ($gettok(%nko,12,46) == 1) beep 1
n224=  :End | unset %~nkodot %~nkodot1 %~nkodot2 %~nkodot3 %~nkoinvalid | window -c @nOthello-Tmp
n225=}
n226=; x,y,0[chk only]
n227=nkoflip {
n228=  if (%nkoturn == 1) %~nkoflp4 = 2 | else %~nkoflp4 = 1
n229=  %~nkoocc1 = %nkoocc1 | %~nkoocc2 = %nkoocc2 | %~nkoflp7 = 1 | %~nkoflp6 = 4
n230=  :X | %~nkoflp = $gettok($4,%~nkoflp7,46) | if (%~nkoflp == $null) goto D
n231=  %~nkoflp3 = 1 | :A
n232=  if (%~nkoflp == e) { %~nkoflp5 = $calc($1 + %~nkoflp3) | %~nkoflp1 = %~nkoflp5 $2 }
n233=  if (%~nkoflp == w) { %~nkoflp5 = $calc($1 - %~nkoflp3) | %~nkoflp1 = %~nkoflp5 $2 }
n234=  if (%~nkoflp == n) { %~nkoflp5 = $calc($2 - %~nkoflp3) | %~nkoflp1 = $1 %~nkoflp5 }
n235=  if (%~nkoflp == s) { %~nkoflp5 = $calc($2 + %~nkoflp3) | %~nkoflp1 = $1 %~nkoflp5 }
n236=  if (%~nkoflp == ne) { %~nkoflp5 = $calc($1 + %~nkoflp3) | %~nkoflp6 = $calc($2 - %~nkoflp3) | %~nkoflp1 = %~nkoflp5 %~nkoflp6 }
n237=  if (%~nkoflp == sw) { %~nkoflp5 = $calc($1 - %~nkoflp3) | %~nkoflp6 = $calc($2 + %~nkoflp3) | %~nkoflp1 = %~nkoflp5 %~nkoflp6 }
n238=  if (%~nkoflp == nw) { %~nkoflp5 = $calc($1 - %~nkoflp3) | %~nkoflp6 = $calc($2 - %~nkoflp3) | %~nkoflp1 = %~nkoflp5 %~nkoflp6 }
n239=  if (%~nkoflp == se) { %~nkoflp5 = $calc($1 + %~nkoflp3) | %~nkoflp6 = $calc($2 + %~nkoflp3) | %~nkoflp1 = %~nkoflp5 %~nkoflp6 }
n240=  if ($findtok(%~nkoocc [ $+ [ %nkoturn ] ] ,%~nkoflp1,46) == $null) {
n241=    if ($findtok(%~nkoocc [ $+ [ %~nkoflp4 ] ] ,%~nkoflp1,46) == $null) { inc %~nkoflp7 1 | goto X }
n242=    if ((%~nkoflp5 < 8) && (%~nkoflp5 > 1) && (%~nkoflp6 < 8) && (%~nkoflp6 > 1)) { inc %~nkoflp3 1 | goto A }
n243=  }
n244=  else {
n245=    :B | dec %~nkoflp3 1
n246=    if (%~nkoflp3 < 1) { inc %~nkoflp7 1 | goto X }
n247=    if (%~nkoflp == e) %~nkoflp1 = $calc($1 + %~nkoflp3) $2
n248=    if (%~nkoflp == w) %~nkoflp1 = $calc($1 - %~nkoflp3) $2
n249=    if (%~nkoflp == n) %~nkoflp1 = $1 $calc($2 - %~nkoflp3)
n250=    if (%~nkoflp == s) %~nkoflp1 = $1 $calc($2 + %~nkoflp3)
n251=    if (%~nkoflp == ne) %~nkoflp1 = $calc($1 + %~nkoflp3) $calc($2 - %~nkoflp3)
n252=    if (%~nkoflp == sw) %~nkoflp1 = $calc($1 - %~nkoflp3) $calc($2 + %~nkoflp3)
n253=    if (%~nkoflp == nw) %~nkoflp1 = $calc($1 - %~nkoflp3) $calc($2 - %~nkoflp3)
n254=    if (%~nkoflp == se) %~nkoflp1 = $calc($1 + %~nkoflp3) $calc($2 + %~nkoflp3)
n255=    if ($findtok(%~nkoocc [ $+ [ %~nkoflp4 ] ] ,%~nkoflp1,46) != $null) {
n256=      unset %~nkoinvalid | if ($3 == 0) goto End
n257=      nkodrawdot 1 %nkoturn 12 %~nkoflp1
n258=      %nkoocc [ $+ [ %~nkoflp4 ] ] = $remtok(%nkoocc [ $+ [ %~nkoflp4 ] ] ,%~nkoflp1,46)
n259=      %nkoocc [ $+ [ %nkoturn ] ] = $addtok(%nkoocc [ $+ [ %nkoturn ] ] ,%~nkoflp1,46)
n260=    }
n261=    goto B
n262=  }
n263=  inc %~nkoflp7 1 | goto X
n264=  :D | if ($3 == $null) drawdot @nOthello
n265=  :End | unset %~nkoflp* %~nkoocc1 %~nkoocc2 %~nkosurr2
n266=}
n267=; 0[chk only]
n268=nkoscan {
n269=  %~nkoscan5 = y
n270=  if (($gettok(%nkoocc1,0,46) < 1) || ($gettok(%nkoocc2,0,46) < 1) || ($calc($gettok(%nkoocc1,0,46) + $gettok(%nkoocc2,0,46)) > 63)) goto End
n271=  %~nkoscan1 = 1 | %~nkoscan2 = 1 | if (%nkoturn == 1) %~nkoscan4 = 2 | else %~nkoscan4 = 1
n272=  :A | %~nkoscan3 = %~nkoscan1 %~nkoscan2
n273=  if (($findtok(%nkoocc1,%~nkoscan3,46) == $null) && ($findtok(%nkoocc2,%~nkoscan3,46) == $null) && ($nkosurr(%~nkoscan1,%~nkoscan2,%~nkoscan4) != $null)) {
n274=    %~nkoinvalid = y | nkoflip %~nkoscan1 %~nkoscan2 0 %~nkosurr2
n275=    if (%~nkoinvalid == $null) {
n276=      if ($1 == 0) { unset %~nkoscan1 %~nkoscan2 %~nkoscan3 %~nkoscan4 %~nkoscan5 | return y }
n277=      drawdot -nr @nOthello $gettok(%nko,5,46) 2 $nkosqrcenter(%~nkoscan1,%~nkoscan2) | unset %~nkoscan5
n278=      %~nkoscan6 = $calc(((%~nkoscan1 - 1) * 32) + 8) $calc(((%~nkoscan2 - 1) * 32) + 8) | %nkoscan = $addtok(%nkoscan,%~nkoscan6,46)
n279=    }
n280=  }
n281=  if (%~nkoscan1 < 8) { inc %~nkoscan1 1 | goto A } | elseif (%~nkoscan2 < 8) { inc %~nkoscan2 1 | %~nkoscan1 = 1 | goto A }
n282=  drawdot @nOthello
n283=  :End
n284=  if (%~nkoscan5 == y) {
n285=    %~nkoscan1 = $gettok(%nkoocc1,0,46) | if (%~nkoscan1 == $null) %~nkoscan1 = 0
n286=    %~nkoscan2 = $gettok(%nkoocc2,0,46) | if (%~nkoscan2 == $null) %~nkoscan2 = 0
n287=    nkoresult %~nkoscan1 %~nkoscan2 0
n288=  }
n289=  unset %~nkoscan* %~nkoinvalid
n290=}
n291=nkoresult {
n292=  %~nkoresult = $nofile($script(nothello.ini)) $+ win.bmp
n293=  if ($exists(%~nkoresult) != $true) { nkoquery 1 4***14 WinPic: %~nkoresult does not exist | goto End }
n294=  if ($1 == $2) nkodrawtext 1 18 267 100 Tie game!
n295=  else { if ($1 > $2) drawpic -nts @nOthello 0 266 17 19 18 " $+ %~nkoresult $+ " | else drawpic -nts @nOthello 0 266 47 19 18 " $+ %~nkoresult $+ " }
n296=  :End
n297=  if ($3 == 0) drawdot @nOthello | unset %~nkoresult
n298=}
n299=; x,y,otherside
n300=nkosurr {
n301=  unset %~nkosurr2
n302=  %~nkosurr = $calc($1 + 1) $2 | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = e
n303=  %~nkosurr = $1 $calc($2 + 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ s
n304=  %~nkosurr = $calc($1 - 1) $2 | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ w
n305=  %~nkosurr = $1 $calc($2 - 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ n
n306=  %~nkosurr = $calc($1 + 1) $calc($2 + 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ se
n307=  %~nkosurr = $calc($1 - 1) $calc($2 - 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ nw
n308=  %~nkosurr = $calc($1 + 1) $calc($2 - 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ ne
n309=  %~nkosurr = $calc($1 - 1) $calc($2 + 1) | if ($findtok(%nkoocc [ $+ [ $3 ] ] ,%~nkosurr,46) != $null) %~nkosurr2 = %~nkosurr2 $+ . $+ sw
n310=  unset %~nkosurr | return %~nkosurr2
n311=}
n312=nkorefp {
n313=  if ($window(@nOthello) == $null) goto End
n314=  if ($calc( [ $window(@nOthello).w ] - [ $window(@nOthello).dw ] ) > 2) clear -l @nOthello
n315=  if ($1 != $null) %nkoplayer = $1
n316=  %~nkorefp = 1
n317=  :A
n318=  if ($gettok(%nkoplayer,%~nkorefp,46) != $null) {
n319=    if (%~nkorefp < 4) aline -l 0 @nOthello $chr(160)
n320=    if ($left($gettok(%nkoplayer,%~nkorefp,46),1) == @) aline -l 10 @nOthello $remove($gettok(%nkoplayer,%~nkorefp,46),@)
n321=    elseif ($left($gettok(%nkoplayer,%~nkorefp,46),1) == +) aline -l 14 @nOthello $remove($gettok(%nkoplayer,%~nkorefp,46),+)
n322=    else aline -l 15 @nOthello $gettok(%nkoplayer,%~nkorefp,46)
n323=    inc %~nkorefp 1 | goto A
n324=  }
n325=  unset %~nkorefp
n326=  :End
n327=}
n328=nkoref {
n329=  %~nkoref = $remove($nkocol(1,f),")
n330=  %~nkoref1 = $remove($nkocol(2,f),")
n331=  if ((($exists(%~nkoref) != $true) && (%~nkoref != $null)) || (($exists(%~nkoref1) != $true) && (%~nkoref1 != $null))) {
n332=    if (($exists(%~nkoref) != $true) && (%~nkoref != $null)) nkoquery 1 4***14 P1: %~nkoref does not exist
n333=    if (($exists(%~nkoref1) != $true) && (%~nkoref1 != $null)) nkoquery 1 4***14 P2: %~nkoref1 does not exist
n334=    unset %~nko* | halt
n335=  }
n336=  if (($1 == 1) && (($findtok(%nkoplayer,$2,46) != $null) || ($findtok(%nkoplayer,+ [ $+ [ $2 ] ] ,46) != $null))) {
n337=    if (($gettok(%nko,7,46) == 1) && ($chat($2) != $null) && ($chat($2).status != inactive)) .msg =$2 0,0 nkoref 0 $replace(%nkoocc1,$chr(32),*) $replace(%nkoocc2,$chr(32),*) %nkoturn %nkoplayer
n338=    if (($gettok(%nko,7,46) == 2) && ($server != $null)) .msg $2 0,0 nkoref 0 $replace(%nkoocc1,$chr(32),*) $replace(%nkoocc2,$chr(32),*) %nkoturn %nkoplayer
n339=    if ($gettok(%nko,7,46) == 3) {
n340=      if ($sock(nOthellou [ $+ [ $2 ] ] ) != $null) sockwrite -n nOthellou [ $+ [ $2 ] ] nkoref 0 $replace(%nkoocc1,$chr(32),*) $replace(%nkoocc2,$chr(32),*) %nkoturn %nkoplayer
n341=      if ($sock(nOthellos [ $+ [ $2 ] ] ) != $null) sockwrite -n nOthellos [ $+ [ $2 ] ] nkoref 0 $replace(%nkoocc1,$chr(32),*) $replace(%nkoocc2,$chr(32),*) %nkoturn %nkoplayer
n342=    }
n343=    halt
n344=  }
n345=  if (($gettok(%nko,7,46) > 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null)) {
n346=    if ($1 == 0) { %nkoocc1 = $replace($2,*,$chr(32)) | %nkoocc2 = $replace($3,*,$chr(32)) | %nkoturn = $4 | %nkoplayer = $5 }
n347=  }
n348=  if ($window(@nOthello) == $null) goto End
n349=  nkorefp
n350=  nkoboard @nOthello
n351=  nkotemp
n352=  nkostat
n353=  nkodrawdot 1 1 12 %nkoocc1
n354=  nkodrawdot 1 2 12 %nkoocc2
n355=  if ($window(@nOthello) != $null) drawdot @nOthello
n356=  :End | unset %nkoscan %~nkoref %~nkoref1 | window -c @nOthello-Tmp
n357=}
n358=nkomode {
n359=  if (($gettok(%nko,7,46) == $1) && ($1 != 0)) { if ($?="Re-do player list? (Y/N)" != y) goto End | %~nkomode3 = y }
n360=  elseif ($gettok(%nko,7,46) > 0) { if ($?="Confirm mode change? (Y/N)" != y) goto End }
n361=  if ($gettok(%nko,7,46) == 3) nkosockclose 1
n362=  if ($1 == 0) { unset %nkoplayer | goto C }
n363=  if ((%nkoplayer != $null) && (%~nkomode3 == $null)) goto C
n364=  unset %nkoplayer
n365=  :H | %~nkomode = $?="Host name:"
n366=  if (%~nkomode == $null) goto End
n367=  if (($chr(32) isin %~nkomode) || (@ isin %~nkomode) || (+ isin %~nkomode) || (. isin %~nkomode)) goto H
n368=  if (%~nkomode != $me) goto B
n369=  :A | if (%~nkomode2 == $null) %~nkomode1 = $?="Player name:" | else %~nkomode1 = $?="Spectator name:"
n370=  if (($chr(32) isin %~nkomode1) || (@ isin %~nkomode1) || (+ isin %~nkomode1)) goto A
n371=  if ((%~nkomode1 == $null) && (%~nkomode2 != $null)) goto B
n372=  if (%~nkomode1 != $null) {
n373=    if (%~nkomode2 == $null) %~nkomode2 = + $+ %~nkomode1 | else %~nkomode2 = %~nkomode2 $+ . $+ %~nkomode1
n374=  }
n375=  goto A
n376=  :B | if (%~nkomode2 != $null) %nkoplayer = @ $+ %~nkomode $+ . $+ %~nkomode2 | else %nkoplayer = @ $+ %~nkomode
n377=  :C | %nko = $puttok(%nko,$1,7,46)
n378=  if ($gettok(%nko,7,46) == 3) {
n379=    if (%~nkomode == $me) {
n380=      if ($sock(nkostart) == $null) { if ($?="Begin listening to Port [ $gettok(%nko,11,46) ] $+ ? (Y/N)" == y) nkosocklisten }
n381=      nkoquery 15» 14Currently listening to Port $gettok(%nko,11,46)
n382=    }
n383=    else nkosockhost %~nkomode
n384=  }
n385=  window -c @nOthello | nothello
n386=  :End | unset %~nkomode %~nkomode1 %~nkomode2 %~nkomode3
n387=}
n388=nkosetp {
n389=  if ($gettok(%nko,7,46) < 1) halt
n390=  if ($findtok(%nkoplayer,@ [ $+ [ $2 ] ] ,46) != $null) %~nkosetp3 = @
n391=  elseif ($findtok(%nkoplayer,+ [ $+ [ $2 ] ] ,46) != $null) %~nkosetp3 = +
n392=  %~nkosetp1 = 1
n393=  :A | %~nkosetp = $gettok(%nkoplayer,%~nkosetp1,46)
n394=  if ((%~nkosetp != $null) && ($left(%~nkosetp,1) != $1)) { inc %~nkosetp1 1 | goto A }
n395=  %~nkosetp2 = $1 $+ $2
n396=  if (%~nkosetp != $null) {
n397=    %nkoplayer = $puttok(%nkoplayer,%~nkosetp2,%~nkosetp1,46)
n398=    %~nkosetp2 = %~nkosetp3 $+ $2
n399=    %~nkosetp4 = $findtok(%nkoplayer,%~nkosetp2,46)
n400=    %~nkosetp2 = %~nkosetp3 $+ $remove(%~nkosetp,$1)
n401=    %nkoplayer = $puttok(%nkoplayer,%~nkosetp2,%~nkosetp4,46)
n402=  }
n403=  else %nkoplayer = $instok(%nkoplayer,%~nkosetp2,1,46)
n404=  nkorefp | nkomsg 0 nkorefp %nkoplayer
n405=  :End | unset %~nkosetp %~nkosetp1 %~nkosetp2 %~nkosetp3 %~nkosetp4
n406=}
n407=nkodrawtext {
n408=  if ($1 == 1) nkoclear
n409=  drawtext -nor @nOthello $gettok(%nko,5,46) Arial $2-
n410=  if ($1 == 2) { drawdot @nOthello | .timer 1 2 nkoclear }
n411=}
n412=nkoclear drawcopy @nOthello2 264 100 76 60 @nOthello 264 100

[script]
n0=; nOthello v1.0b by Nabiki^sKnight
n1=on 1:load:{
n2=  .load -a " $+ $script(nothello.ini) $+ " | .load -a " $+ $scriptdirnothell2.ini" | echo -s 10Type /nOthello to open the game window. Read the documentation for details.
n3=  .ial on | echo -s 14The mIRC internal address list (IAL) has been turned on. Type /IAL off to turn it off.
n4=  if ($exists($scriptdirnko.ini) == $true) halt
n5=  writeini " $+ $scriptdirnko.ini" ?Theme o 1.2.3.4
n6=  writeini " $+ $scriptdirnko.ini" ?Theme 1 Default
n7=  writeini " $+ $scriptdirnko.ini" ?Theme Default 1
n8=  writeini " $+ $scriptdirnko.ini" ?Theme 2 Popping Discs
n9=  writeini " $+ $scriptdirnko.ini" ?Theme Popping*Discs 2
n10=  writeini " $+ $scriptdirnko.ini" ?Theme 3 Nabiki Board
n11=  writeini " $+ $scriptdirnko.ini" ?Theme Nabiki*Board 3
n12=  writeini " $+ $scriptdirnko.ini" ?Theme 4 Ranma1/2 Discs
n13=  writeini " $+ $scriptdirnko.ini" ?Theme Ranma1/2*Discs 4
n14=  writeini " $+ $scriptdirnko.ini" ?Theme1 BMP x*x*x*x*x*x*x
n15=  writeini " $+ $scriptdirnko.ini" ?Theme1 Color 0.16777215.8421376.16777215.12632256.0
n16=  writeini " $+ $scriptdirnko.ini" ?Theme2 BMP 0 0 31 31 $scriptdirpieces.bmp*62 0 31 31 $scriptdirpieces.bmp*x*x* $+ $scriptdirbgrand.bmp*5*x
n17=  writeini " $+ $scriptdirnko.ini" ?Theme2 Color 0.16777215.8421504.16777215.12632256.0
n18=  writeini " $+ $scriptdirnko.ini" ?Theme3 BMP x*x*x*x* $+ $scriptdirnabiki.bmp*3*x
n19=  writeini " $+ $scriptdirnko.ini" ?Theme3 Color 8421504.8388736.0.16777215.12632256.0
n20=  writeini " $+ $scriptdirnko.ini" ?Theme4 BMP $scriptdirnabiki.bmp* $+ $scriptdirranma.bmp*11917039*11917039* $+ $scriptdirbgssqr.bmp*4*x
n21=  writeini " $+ $scriptdirnko.ini" ?Theme4 Color 8421504.8388736.8388608.16777215.33023.0
n22=  echo -s 14Theme file nko.ini created
n23=}
n24=on 1:start:{
n25=  if (%nkoocc1 == $null) %nkoocc1 = 4 5.5 4 | if (%nkoocc2 == $null) %nkoocc2 = 4 4.5 5 | if (%nkoturn == $null) %nkoturn = 1
n26=  if ($gettok(%nko,0,46) < 12) {
n27=    if ($window(-1).w < 800) %nko = 0.16777215.8421504.16777215.12632256.0.0.0 0.200 0 335 315.16.5000.1
n28=    else %nko = 0.16777215.8421504.16777215.12632256.0.0.0 0.435 0 335 315.16.5000.1
n29=  }
n30=}
n31=on 1:chat:0,0 nko*:nkodo $nick c $2-
n32=on 1:text:0,0 nko*:?:nkodo $nick q $2-
n33=alias nkodo {
n34=  if ($findtok(nkoini.nkodot.nkoquery.nkoref.nkorefp,$3,46) == $null) goto End
n35=  if ($findtok(%nkoplayer,@ [ $+ [ $1 ] ] ,46) != $null) {
n36=    if (($2 == c) && ($gettok(%nko,7,46) != 1)) %nko = $puttok(%nko,1,7,46)
n37=    if (($2 == q) && ($gettok(%nko,7,46) != 2)) %nko = $puttok(%nko,2,7,46)
n38=    if (($2 == s) && ($gettok(%nko,7,46) != 3)) %nko = $puttok(%nko,3,7,46)
n39=    $3-
n40=    goto End
n41=  }
n42=  if (($3 == nkoini) || ($3 == nkorefp)) { nkoquery 0 4***14 $1 is not set as the host but requested a host command:10 $2- | goto End }
n43=  if (($findtok(%nkoplayer,+ [ $+ [ $1 ] ] ,46) != $null) || ((($3 == nkoref) || ($3 == nkoquery)) && ($findtok(%nkoplayer,$1,46) != $null))) $3- | else { nkoquery 0 4***14 $1 requested a player command:10 $3- }
n44=  :End
n45=}
n46=on 1:nick:{
n47=  if (($findtok(%nkoplayer,@ [ $+ [ $newnick ] ] ,46) != $null) || ($findtok(%nkoplayer,+ [ $+ [ $newnick ] ] ,46) != $null) || ($findtok(%nkoplayer,$newnick,46) != $null)) halt
n48=  %~nkonick = @ [ $+ [ $newnick ] ]
n49=  if ($findtok(%nkoplayer,@ [ $+ [ $nick ] ] ,46) != $null) { %nkoplayer = $reptok(%nkoplayer,@ [ $+ [ $nick ] ] ,%~nkonick,1,46) | nkorefp }
n50=  %~nkonick = + [ $+ [ $newnick ] ]
n51=  if ($findtok(%nkoplayer,+ [ $+ [ $nick ] ] ,46) != $null) { %nkoplayer = $reptok(%nkoplayer,+ [ $+ [ $nick ] ] ,%~nkonick,1,46) | nkorefp }
n52=  if ($findtok(%nkoplayer,$nick,46) != $null) { %nkoplayer = $reptok(%nkoplayer,$nick,$newnick,1,46) | nkorefp }
n53=  unset %~nkonick
n54=}
n55=on 1:close:@nOthello:{
n56=  %~nkoclose = $window(@nOthello).x $window(@nOthello).y | %nko = $puttok(%nko,%~nkoclose,8,46) | unset %~nkoclose
n57=  window -c @nOthello2
n58=}
n59=on 1:close:@nOthello2:if ($window(@nOthello) != $null) .timer 1 1 nkotemp 0
n60=on 1:close:@nOthello-Info:%~nkoclose = $window(@nOthello-Info).x $window(@nOthello-Info).y $window(@nOthello-Info).w $window(@nOthello-Info).h | %nko = $puttok(%nko,%~nkoclose,9,46) | unset %~nkoclose
n61=on 1:close:@nOthello-BMPT:unset %nkobmpt
n62=on 1:close:@nOthello-BMPBG:unset %nkobmpaxy %nkobmpa
n63=on 1:close:@nOthello-Thm1:nkothmshow c
n64=on 1:close:=:{
n65=  if (($gettok(%nko,7,46) == 1) && (($findtok(%nkoplayer,@ [ $+ [ $nick ] ] ,46) != $null) || ($findtok(%nkoplayer,+ [ $+ [ $nick ] ] ,46) != $null) || ($findtok(%nkoplayer,$nick,46) != $null))) {
n66=    if ($window(@nOthello) != $null) {
n67=      nkodrawtext 1 14 267 100 Lost DCC | nkodrawtext 0 14 267 110 connection: | nkodrawtext 2 14 267 120 $nick
n68=    }
n69=    else nkoquery 0 4***14 Lost DCC connection:10 $nick
n70=  }
n71=}
n72=on 1:input:@nOthello,@nOthello-Info:{
n73=  if ($left($1,1) == /) { $1- | halt }
n74=  if ($gettok(%nko,7,46) < 1) halt
n75=  if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) nkomsg 0 nkoquery 0 < $+ $me $+ > $1-
n76=  elseif (($findtok(%nkoplayer,+ [ $+ [ $me ] ] ,46) != $null) || ($findtok(%nkoplayer,$me,46) != $null)) nkomsg h nkoquery 0 < $+ $me $+ > $1- | else halt
n77=  aline -p @nOthello-Info < $+ $me $+ > $1-
n78=  if ($window(@nOthello-Info) == $null) nkoinfo
n79=  halt
n80=}
n81=#nkomidi off
n82=on 1:midiend:if ($exists($remove($gettok(%nkobmp,7,42),")) == $true) splay $gettok(%nkobmp,7,42) | else nkoquery 4***14 $remove($gettok(%nkobmp,7,42),") does not exist
n83=#nkomidi end
n84=ctcp 1:.nOthello:ctcpreply $nick .nOthello 1nOthello14 v $+ $readini $scriptdirnothello.ini nOthello version 15by 14Nab1iki14^sKni1ght
n85=alias nkounload {
n86=  if ($?="Unload nOthello? (Y/N)" != y) halt
n87=  unset %nko %nkobmp %nkoocc1 %nkoocc2 %nkoturn %nkopoptog %nkobmpt %nkothm %nkoplayer %nkobmpaxy %nkobmpa
n88=  window -c @nOthello | window -c @nOthello-Info | window -c @nOthello-BMP | window -c @nOthello-BMPT | window -c @nOthello-Thm1 | window -c @nOthello-View
n89=  echo 4 -s $timestamp nOthello has been unloaded
n90=  .unload -a nothell2.ini
n91=  .unload -a nothello.ini
n92=  .timer 1 1 .unload -rs nothello.ini
n93=}
n94=alias nkoconnect {
n95=  if ($gettok(%nko,7,46) == 3) { nkosockhost | goto End }
n96=  if ($gettok(%nko,7,46) == 2) { if ($server == $null) server | goto End }
n97=  %~nkoconnect = $remove($gettok(%nkoplayer,$nkohost,46),@)
n98=  if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) {
n99=    if (($chat(%~nkoconnect).status == inactive) || ($chat(%~nkoconnect) == $null)) dcc chat %~nkoconnect | else nkoquery 0 4***14 Already connected to host
n100=    goto End
n101=  }
n102=  %~nkoconnect = 1
n103=  :A | if ($gettok(%nkoplayer,%~nkoconnect,46) == $null) goto End
n104=  if ($left($gettok(%nkoplayer,%~nkoconnect,46),1) == @) { inc %~nkoconnect 1 | goto A }
n105=  %~nkoconnect1 = $remove($gettok(%nkoplayer,%~nkoconnect,46),+)
n106=  if (($chat(%~nkoconnect1) == $null) && (%~nkoconnect1 != $me)) dcc chat %~nkoconnect1
n107=  inc %~nkoconnect 1 | goto A
n108=  :End | unset %~nkoconnect %~nkoconnect1
n109=}
n110=alias nkobufsave {
n111=  :A | %~nkobufsave = $dir="File to save to: (no spaces)" *.txt
n112=  if (%~nkobufsave == $null) {
n113=    :B | %~nkobufsave = $?="Path and filename: (no spaces; no extension)"
n114=    if (%~nkobufsave == $null) goto End
n115=    %~nkobufsave = %~nkobufsave $+ .txt
n116=    if ($exists($nofile(%~nkobufsave)) != $true) goto B
n117=  }
n118=  if ($right(%~nkobufsave,4) != .txt) goto A
n119=  if ($chr(32) isin %~nkobufsave) goto A
n120=  if ($exists(%~nkobufsave) == $true) {
n121=    :C | %~nkobufsave1 = $?="File exists. Overwrite, Append or Cancel? (O/A/C)"
n122=    if (%~nkobufsave1 == a) %~nkobufsave1 = -a
n123=    elseif (%~nkobufsave1 == c) goto End
n124=    elseif (%~nkobufsave1 != o) goto C
n125=  }
n126=  savebuf %~nkobufsave1 @nOthello-Info %~nkobufsave
n127=  aline -p @nOthello-Info 14Buffer saved to:10 %~nkobufsave
n128=  :End | unset %~nkobufsave %~nkobufsave1
n129=}
n130=alias nkobufview {
n131=  if ($window(@nOthello-View) == $null) window @nOthello-View $gettok(%nko,9,46) @nOthello-View Arial Bold 12
n132=  :A | %~nkobufview = $dir="Buffer to view: (no spaces)" *.txt
n133=  if (%~nkobufview == $null) goto End
n134=  if ($chr(32) isin %~nkobufview) goto A
n135=  aline @nOthello-View 15 $str(·,100)
n136=  aline @nOthello-View 14 Date/Time: $fulltime
n137=  aline @nOthello-View 14 File:10 %~nkobufview
n138=  aline @nOthello-View 15 $str(·,100)
n139=  loadbuf -p @nOthello-View %~nkobufview
n140=  :End | unset %~nkobufview
n141=}
n142=alias nkochng {
n143=  if ($1 != x) %~nkochng1 = ( $+ $1 $+ - $+ $2 $+ )
n144=  :A | %~nkochng = $?="Enter [ $5- ] [ %~nkochng1 $+ ] :"
n145=  if (%~nkochng == $null) goto End
n146=  if ($1 == x) { if ((1 \\ %~nkochng) || (%~nkochng < 1)) goto A }
n147=  elseif ((%~nkochng > $2) || (%~nkochng < $1)) goto A
n148=  %nko = $puttok(%nko,%~nkochng,$3,46)
n149=  if (1 isin $4) nkoref
n150=  :End | unset %~nkochng %~nkochng1
n151=}
n152=alias nkohlp {
n153=  if ($1 == d) run $scriptdirnothello.doc
n154=  %~nkohlp = $readini " $mircini " files browser
n155=  if (%~nkohlp == $null) {
n156=    %~nkohlp = $dir="Browser:" *.exe
n157=    if (%~nkohlp == $null) halt
n158=    writeini " $mircini " files browser %~nkohlp
n159=  }
n160=  run %~nkohlp http://www.geocities.com/Tokyo/Flats/3498
n161=}
n162=alias nkoswturn {
n163=  if ($gettok(%nko,7,46) < 1) halt
n164=  if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) { nkoquery 4***14 You're not the host | halt }
n165=  %nkoplayer = $gettok(%nkoplayer,2,46) $+ . $+ $gettok(%nkoplayer,1,46) $+ . $+ $gettok(%nkoplayer,3-,46)
n166=  nkorefp
n167=  nkomsg 0 nkorefp %nkoplayer
n168=}
n169=alias nkoaddp {
n170=  if ($gettok(%nko,7,46) < 1) halt
n171=  :A | %~nkoaddp = $?="Name:"
n172=  if (%~nkoaddp == $null) goto End
n173=  if (($findtok(%nkoplayer,+ [ $+ [ %~nkoaddp ] ] ,46) != $null) || ($findtok(%nkoplayer,@ [ $+ [ %~nkoaddp ] ] ,46) != $null) || ($findtok(%nkoplayer,%~nkoaddp,46) != $null)) goto A
n174=  %nkoplayer = $addtok(%nkoplayer,%~nkoaddp,46) | %~nkoaddp1 = y
n175=  goto A
n176=  :End
n177=  if (%~nkoaddp1 == y) { nkorefp | nkomsg 0 nkorefp %nkoplayer }
n178=  unset %~nkoaddp %~nkoaddp1
n179=}
n180=alias nkodelp {
n181=  if (($gettok(%nko,7,46) < 1) || ($sline(@nOthello,1) == $null)) halt
n182=  if ($gettok(%nko,7,46) == 3) { nkosockclose 0 | goto End }
n183=  %~nkodelp = 1
n184=  :A | if ($sline(@nOthello,%~nkodelp) == $null) goto End
n185=  if (($sline(@nOthello,%~nkodelp).ln > 5) && ($sline(@nOthello,%~nkodelp) != $chr(160))) %nkoplayer = $remtok(%nkoplayer,$sline(@nOthello,%~nkodelp),46)
n186=  if ($gettok(%nko,7,46) == 1) {
n187=    if (($chat($sline(@nOthello,%~nkodelp)) != $null) && ($chat($sline(@nOthello,%~nkodelp)).status != inactive))  .msg = $+ $sline(@nOthello,%~nkodelp) 0,0 nkoquery 0 4***14 Removed from host's user list
n188=    else nkoquery 0 4***14 No DCC connection with $sline(@nOthello,%~nkodelp)
n189=  }
n190=  if ($gettok(%nko,7,46) == 2) {
n191=    if ($server != $null) .msg $sline(@nOthello,%~nkodelp) 0,0 nkoquery 0 4***14 Removed from host's user list | else nkoquery 0 4***14 Not connected
n192=  }
n193=  inc %~nkodelp 1 | goto A
n194=  :End
n195=  nkorefp | nkomsg 0 nkorefp %nkoplayer | unset %~nkodelp
n196=}
n197=alias nkodclick {
n198=  if (($1 > 287) && ($1 < 319) && ($2 > 7) && ($2 < 39)) nkobmp 1
n199=  elseif (($1 > 287) && ($1 < 319) && ($2 > 40) && ($2 < 72)) nkobmp 2
n200=  nkoquery 0 15» 14RGB code for ( $+ $1 $+ , $+ $2 $+ ):10 $rgb($getdot($active,$1,$2)) ::: $rgb($getdot($active,$calc($1 + 1),$calc($2 + 1)))
n201=}
n202=alias nkoinfo {
n203=  if (%nkopoptog == $null) %nkopoptog = 0.0.0
n204=  if ($window(@nOthello-Info) != $null) { if ($1 != n) window -ar @nOthello-Info | clear -l @nOthello-Info }
n205=  else window -el9 $+ $1 @nOthello-Info $gettok(%nko,9,46) @nOthello-Info Arial Bold 12
n206=  if ($line(@nOthello-Info,0) < 1) { aline -p @nOthello-Info 10nOthello v $+ $readini $script(nothello.ini) nOthello version by Nabiki^sKnight | aline @nOthello-Info 15 $+ $str(·,$int($calc( [ $window(@nOthello-Info).dw ] / 3))) }
n207=  aline -l 21 @nOthello-Info 8,1|||-- Bitmaps --|||
n208=  if ($gettok(%nkopoptog,1,46) == 0) goto B
n209=  %~nkoinfo = $gettok(%nkobmp,1,42)
n210=  if ((%~nkoinfo == $null) || (%~nkoinfo == x)) { aline -l 21 @nOthello-Info P1: 4none | goto P1 }
n211=  else {
n212=    if ($gettok(%~nkoinfo,1,32) isnum) aline -l 21 @nOthello-Info P1:10 $remove($gettok(%~nkoinfo,5-,32),") ( $+ $calc(($gettok(%~nkoinfo,1,32) + 31) / 31) $+ , $+ $calc(($gettok(%~nkoinfo,2,32) + 31) / 31) $+ )
n213=    else aline -l 21 @nOthello-Info P1:10 $remove(%~nkoinfo,") (Fit)
n214=  }
n215=  %~nkoinfo = $gettok(%nkobmp,3,42)
n216=  if ((%~nkoinfo == $null) || (%~nkoinfo == x)) %~nkoinfo = 4none | else %~nkoinfo = $rgb(%~nkoinfo)
n217=  aline -l 21 @nOthello-Info P1T:10 %~nkoinfo
n218=  :P1
n219=  %~nkoinfo = $gettok(%nkobmp,2,42)
n220=  if ((%~nkoinfo == $null) || (%~nkoinfo == x)) { aline -l 21 @nOthello-Info P2: 4none | goto P2 }
n221=  else {
n222=    if ($gettok(%~nkoinfo,1,32) isnum) aline -l 21 @nOthello-Info P2:10 $remove($gettok(%~nkoinfo,5-,32),") ( $+ $calc(($gettok(%~nkoinfo,1,32) + 31) / 31) $+ , $+ $calc(($gettok(%~nkoinfo,2,32) + 31) / 31) $+ )
n223=    else aline -l 21 @nOthello-Info P2:10 $remove(%~nkoinfo,") (Fit)
n224=  }
n225=  %~nkoinfo = $gettok(%nkobmp,4,42)
n226=  if ((%~nkoinfo == $null) || (%~nkoinfo == x)) %~nkoinfo = 4none | else %~nkoinfo = $rgb(%~nkoinfo)
n227=  aline -l 21 @nOthello-Info P2T:10 %~nkoinfo
n228=  :P2
n229=  if (($gettok(%nkobmp,5,42) == $null) || ($gettok(%nkobmp,5,42) == x)) { aline -l 21 @nOthello-Info BG: 4none | goto BG }
n230=  else aline -l 21 @nOthello-Info BG:10 $remove($nkocol(5,f),")
n231=  %~nkoinfo = $gettok(%nkobmp,6,42) | if (%~nkoinfo < 1) %~nkoinfo = Tile | elseif (%~nkoinfo == 1) %~nkoinfo = Normal | elseif (%~nkoinfo == 2) %~nkoinfo = Fit Window | else %~nkoinfo = Fit Board
n232=  aline -l 21 @nOthello-Info BGType:10 %~nkoinfo
n233=  if ($left($gettok(%nkobmp,5,42),1) isnum) {
n234=    %~nkoinfo = $gettok($gettok(%nkobmp,5,42),1-4,32)
n235=    %~nkoinfo1 = $calc($gettok(%~nkoinfo,3,32) + $gettok(%~nkoinfo,1,32)) $calc($gettok(%~nkoinfo,4,32) + $gettok(%~nkoinfo,2,32))
n236=    aline -l 21 @nOthello-Info BGArea:10 $replace($gettok(%~nkoinfo,1-2,32),$chr(32),$chr(44)) to $replace(%~nkoinfo1,$chr(32),$chr(44))
n237=  }
n238=  else aline -l 21 @nOthello-Info BGArea:10 Full
n239=  :BG
n240=  if ($gettok(%nko,6,46) == 0) %~nkoinfo = off | else %~nkoinfo = on
n241=  aline -l 21 @nOthello-Info TextAreaFill:10 %~nkoinfo
n242=  :B | aline -l 21 @nOthello-Info 8,1|||-- Colors --|||
n243=  if ($gettok(%nkopoptog,2,46) == 0) goto C
n244=  aline -l 21 @nOthello-Info P1:10 $rgb($gettok(%nko,1,46))
n245=  aline -l 21 @nOthello-Info P2:10 $rgb($gettok(%nko,2,46))
n246=  aline -l 21 @nOthello-Info BG:10 $rgb($gettok(%nko,3,46))
n247=  aline -l 21 @nOthello-Info Grid:10 $rgb($gettok(%nko,4,46))
n248=  aline -l 21 @nOthello-Info Text:10 $rgb($gettok(%nko,5,46))
n249=  :C | aline -l 21 @nOthello-Info 8,1|||-- Others --|||
n250=  if ($gettok(%nkopoptog,3,46) == 0) goto End
n251=  if (($gettok(%nkobmp,7,42) != x) && ($gettok(%nkobmp,7,42) != $null)) %~nkoinfo = $gettok(%nkobmp,7,42) | else %~nkoinfo = 4none
n252=  aline -l 21 @nOthello-Info MidiFile:10 %~nkoinfo
n253=  aline -l 21 @nOthello-Info TurnBeep:10 $nkotog(12)
n254=  aline -l 21 @nOthello-Info Port:10 $gettok(%nko,11,46)
n255=  aline -l 21 @nOthello-Info ScanLevel:10 $gettok(%nko,10,46)
n256=  :End | unset %~nkoinfo %~nkoinfo1
n257=}
n258=alias nkotog {
n259=  if ($gettok(%nko,$1,46) == 1) {
n260=    if ($2 == $null) return on
n261=    %nko = $puttok(%nko,0,$1,46)
n262=  }
n263=  else {
n264=    if ($2 == $null) return off
n265=    %nko = $puttok(%nko,1,$1,46)
n266=  }
n267=}
n268=alias nkopoptog if ($gettok(%nkopoptog,$1,46) == 0) %nkopoptog = $puttok(%nkopoptog,1,$1,46) | else %nkopoptog = $puttok(%nkopoptog,0,$1,46)
n269=alias nkoinfopop {
n270=  if ($2 == P1T:) { nkobmp 1 t | goto End }
n271=  if ($2 == P2T:) { nkobmp 2 t | goto End }
n272=  if ($2 == BGType:) { nkobmpbgt | goto End }
n273=  if ($2 == Grid:) { nkocolor grid 4 | goto End }
n274=  if ($2 == Text:) { nkocolor text 5 }
n275=  if ($2 == Port:) { nkochng x x 11 0 port to listen to | goto End }
n276=  if ($2 == ScanLevel:) { nkochng 4 64 10 0 scan level | goto End }
n277=  if ($2 == BGArea:) { nkobmpbga | goto End }
n278=  if ($2 == MidiFile:) { nkomidi | goto End }
n279=  if ($2 == TurnBeep) { nkotog 12 0 | goto End }
n280=  if ($2 == TextAreaFill:) {
n281=    if ($gettok(%nko,6,46) == 0) %nko = $puttok(%nko,1,6,46) | else %nko = $puttok(%nko,0,6,46)
n282=    nkoref | goto End
n283=  }
n284=  %~nkoinfo = |||-- Bitmaps --||| | if ($2- == %~nkoinfo) { nkopoptog 1 | goto End }
n285=  %~nkoinfo = |||-- Colors --||| | if ($2- == %~nkoinfo) { nkopoptog 2 | goto End }
n286=  %~nkoinfo = |||-- Others --||| | if ($2- == %~nkoinfo) { nkopoptog 3 | goto End }
n287=  %~nkoinfo = 1 | %~nkoinfo1 = |||-- Colors --|||
n288=  :A | if (($strip($line(@nOthello-Info,%~nkoinfo,1)) != %~nkoinfo1) && ($line(@nOthello-Info,%~nkoinfo,1) != $null)) { inc %~nkoinfo 1 | goto A }
n289=  if ($2 == P1:) {
n290=    if ($1 < %~nkoinfo) { unset %~nkoinfo* | nkobmp 1 } | else { unset %~nkoinfo* | nkocolor Player1 1 }
n291=    goto End
n292=  }
n293=  if ($2 == P2:) {
n294=    if ($1 < %~nkoinfo) { unset %~nkoinfo* | nkobmp 2 } | else { unset %~nkoinfo* | nkocolor Player2 2 }
n295=    goto End
n296=  }
n297=  if ($2 == BG:) {
n298=    if ($1 < %~nkoinfo) { unset %~nkoinfo* | nkobmpbg } | else { unset %~nkoinfo* | nkocolor background 3 }
n299=    goto End
n300=  }
n301=  :End | unset %~nkoinfo* | nkoinfo
n302=}
n303=alias nkopop {
n304=  if (($1 == &Restart) && (($gettok(%nko,7,46) < 1) || ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null))) return $1
n305=  if (($1 == Re&fresh) && (($gettok(%nko,7,46) < 1) || (%nkoplayer != $null))) return $1
n306=  if ($1 == &Connect) {
n307=    if ($gettok(%nko,7,46) == 3) { if (($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) && ($sock(nkoHost) == $null)) return $1- }
n308=    if ((($gettok(%nko,7,46) == 2) && ($server == $null)) || ($gettok(%nko,7,46) == 1)) return $1-
n309=  }
n310=  if (($1 == Soc&kets) && ($gettok(%nko,7,46) == 3)) return $1-
n311=  if ($1 == &Disconnect) {
n312=    if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) { if ($sock(nkoHost) != $null) return $1 }
n313=    elseif ($sock(nOthello*) != $null) return $1
n314=  }
n315=  if ($1 == &Listen) {
n316=    if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) { if ($sock(nkostart) == $null) return $1 (off) | else return $1 (on) }
n317=  }
n318=  if (($1 == &Names) && ($gettok(%nko,7,46) > 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null)) return $1
n319=  if ($1 == names) {
n320=    if (($sline(@nOthello,1).ln > $2) && (($gettok(%nko,7,46) != 3) || ($3 != &Host))) return $3
n321=  }
n322=  if ($1 == midi) {
n323=    if (($gettok(%nkobmp,7,42) != x) && ($gettok(%nkobmp,7,42) != $null)) {
n324=      if (($group(#nkomidi) == on) && ($inmidi == $true)) return &Stop
n325=      if ($group(#nkomidi) == off) return &Play
n326=    }
n327=  }
n328=  if ($1 == &Look) {
n329=    if (($2 == m) && ($width($3-,Arial,12,1,0) > 91)) return $1
n330=    if (($2 == i) && ($width($3-,Arial,12,1,0) > 88)) return $1
n331=  }
n332=  if ($1 == mode) {
n333=    if ($2 == d) && ($gettok(%nko,7,46) == 1) return «
n334=    if ($2 == q) && ($gettok(%nko,7,46) == 2) return «
n335=    if ($2 == s) && ($gettok(%nko,7,46) == 3) return «
n336=    if ($2 == n) && ($gettok(%nko,7,46) == 0) return «
n337=  }
n338=}
n339=menu @nOthello {
n340=  dclick:if ($inrect($mouse.x,$mouse.y,8,8,254,254) != $true) nkodclick $mouse.x $mouse.y | else { nkomovechk | nkodot $nkoxy($mouse.x,$mouse.y) }
n341=  &Info:nkoinfo
n342=  -
n343=  &Game
n344=  . $nkopop(&Restart) :nkomovechk 0 | nkoini 0
n345=  . $nkopop(Re&fresh) :{
n346=    if (($gettok(%nko,7,46) > 0) && ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) && ($?="Send to host for update? (Y/N)" != n)) nkomsg h nkoref 1 $me
n347=    else nkoref
n348=  }
n349=  .&Scan:nkoscan
n350=  M&idi
n351=  . $nkopop(midi) :nkomidiplay
n352=  . &Change:nkomidi
n353=  -
n354=  &Mode
n355=  .&DCC $nkopop(mode,d) :nkomode 1
n356=  .&Query $nkopop(mode,q) :nkomode 2
n357=  .&Socket $nkopop(mode,s) :nkomode 3
n358=  .-
n359=  .&Non-Net $nkopop(mode,n) :nkomode 0
n360=  $nkopop(&Names)
n361=  .&Switch:nkoswturn
n362=  .&Add:nkoaddp
n363=  . $nkopop(names,5,&Delete) :nkodelp
n364=  .-
n365=  . $nkopop(names,1,&Host) :nkosetp @ $sline(@nOthello,1)
n366=  . $nkopop(names,1,&Player) :nkosetp + $sline(@nOthello,1)
n367=  $nkopop(&Connect) :nkoconnect
n368=  $nkopop(Soc&kets)
n369=  .Show:nkosockshow
n370=  . $nkopop(&Listen) :nkosocklisten
n371=  . $nkopop(&Disconnect) :nkosockclose
n372=  -
n373=  $nkopop(&Look,m,$sline(@nOthello,1))
n374=  . $sline(@nOthello,1) :query $sline(@nOthello,1)
n375=}
n376=menu @nOthello-Info {
n377=  dclick:{
n378=    if ($line(@nOthello-Info,$1,1) == $null) {
n379=      %~nkodclick = nOthello v $+ $readini $script(nothello.ini) nOthello version by Nabiki^sKnight
n380=      if (($line(@nOthello-Info,0) < 2) && ($strip($line(@nOthello-Info,1)) == %~nkodclick)) window -c @nOthello-Info
n381=      else { clear | aline -p @nOthello-Info 10nOthello v $+ $readini $script(nothello.ini) nOthello version by Nabiki^sKnight | aline @nOthello-Info 15 $+ $str(·,$int($calc( [ $window(@nOthello-Info).dw ] / 3))) }
n382=      unset %~nkodclick
n383=    }
n384=    else nkoinfopop $1 $strip($line(@nOthello-Info,$1,1))
n385=  }
n386=  B&oard:nothello
n387=  -
n388=  &Buffer
n389=  .&Save:nkobufsave
n390=  .&View:nkobufview
n391=  &Theme
n392=  .&Show:nkothmshow
n393=  .-
n394=  .&Load:nkothmload
n395=  .&Save:nkothmsave
n396=  .&Delete:nkothmdel
n397=  .-
n398=  .&BMP:nkobmpshow
n399=  -
n400=  &Help
n401=  .Document:nkohlp d
n402=  .Homepage:nkohlp h
n403=  -
n404=  &Unload:nkounload
n405=  -
n406=  &Clear:{
n407=    %~nkoclear = nOthello v $+ $readini $script(nothello.ini) nOthello version by Nabiki^sKnight
n408=    if (($line(@nOthello-Info,0) > 1) || ($strip($line(@nOthello-Info,1)) != %~nkodclick)) { clear | aline -p @nOthello-Info 10nOthello v $+ $readini $script(nothello.ini) nOthello version by Nabiki^sKnight | aline @nOthello-Info 15 $+ $str(·,$int($calc( [ $window(@nOthello-Info).dw ] / 3))) }
n409=    unset %~nkoclear
n410=  }
n411=  -
n412=  $nkopop(&Look,I,$strip($sline(@nOthello-Info,1)))
n413=  . $gettok($strip($sline(@nOthello-Info,1)),2-,32) :nkoinfopop $sline(@nOthello-Info,1).ln $strip($sline(@nOthello-Info,1))
n414=}
n415=menu menubar {
n416=  nOthello
n417=  .Board:nothello
n418=  .Info:nkoinfo
n419=}
n420=menu @nOthello-Thm1 {
n421=  dclick:nkothmshow c
n422=}
n423=menu @nOthello-BMP,@nOthello-View {
n424=  dclick:window -c $active
n425=}
n426=menu @nOthello-BMPT {
n427=  dclick:nkobmptrans $mouse.x $mouse.y
n428=}
n429=menu @nOthello-BMPBG {
n430=  dclick:nkobmpbga2 $mouse.x $mouse.y
n431=}
n432=alias nkosockshow {
n433=  %~nkosockshow1 = 1 | nkoquery 0 15» 14nOthello Sockets:
n434=  if ($sock(nkostart) != $null) { nkoquery 1 10 nkostart | unset %~nkosockshow1 }
n435=  if ($sock(nkoHost) != $null) { nkoquery 1 10 nkoHost | unset %~nkosockshow1 }
n436=  %~nkosockshow = 1
n437=  :A | if ($sock(nOthello*,%~nkosockshow) != $null) { nkoquery 1 10 $sock(nOthello*,%~nkosockshow) | inc %~nkosockshow 1 | unset %~nkosockshow1 | goto A }
n438=  if (%~nkosockshow1 != $null) nkoquery 1 4 None
n439=  unset %~nkosockshow
n440=}
n441=alias nkosocklisten {
n442=  if ($sock(nkostart) == $null) {
n443=    if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) != $null) socklisten nkostart $gettok(%nko,11,46) | else nkoquery 0 4***14 You're not the host
n444=  }
n445=  else { sockclose nkostart | nkoquery 0 15» 14Socket is now closed }
n446=}
n447=raw 311:*:if (%nkosockhost == $2) { editbox @nOthello $2 IP found: $4 | unset %nkosockhost }
n448=alias nkosockhost {
n449=  if ($1 != $null) %nkosockhost = $1 | else %nkosockhost = $remove($gettok(%nkoplayer,$nkohost,46),@)
n450=  %~nkosockopen = $ial( [ %nkosockhost $+ !*@* ] ,1).host
n451=  if (%~nkosockopen == $null) {
n452=    if ($server != $null) { nkoquery 0 15»14 Trying to get Host IP | .whois %nkosockhost }
n453=    %~nkosockopen = $?="Enter Host IP:"
n454=    if (%~nkosockopen == $null) goto End
n455=  }
n456=  else unset %nkosockhost
n457=  nkoquery 0 15» 14Connecting to:10 %~nkosockopen (Port $gettok(%nko,11,46) $+ )
n458=  sockopen nkoHost %~nkosockopen $gettok(%nko,11,46)
n459=  :End | unset %~nkosockopen
n460=}
n461=on 1:socklisten:nkostart:{
n462=  if ($sockerr > 0) { nkoquery 0 4*** 14Socket error (connection request) | halt }
n463=  nkoquery 0 15» 14Connection request from:10 $sock($sockname).ip
n464=  sockaccept nkotemp
n465=  %~nkosocklisten = nOthello [ $+ [ $sock(nkotemp).ip ] ]
n466=  sockrename nkotemp %~nkosocklisten
n467=  unset %~nkosocklisten
n468=}
n469=on 1:sockopen:nkoHost:{
n470=  if ($sockerr > 0) { nkoquery 0 4*** 14Cannot connect to host | halt }
n471=  nkoquery 0 15» 14Connected:10 $sock($sockname).ip
n472=  sockwrite -n $sockname GiveNick $ip $me
n473=}
n474=on 1:sockread:nOthello*:{
n475=  if ($sockerr > 0) { nkoquery 0 4*** 14Socket error (data reading) | return }
n476=  :A | sockread %~nkosockread
n477=  if ($sockbr == 0) goto End
n478=  if ($gettok(%~nkosockread,1,32) == GiveNick) {
n479=    if ($findtok(%nkoplayer,+ [ $+ [ $gettok(%~nkosockread,3,32) ] ] ,46) != $null) {
n480=      %~nkosockread1 = nOthello [ $+ [ $gettok(%~nkosockread,2,32) ] ]
n481=      %~nkosockread2 = nOthellou [ $+ [ $gettok(%~nkosockread,3,32) ] ]
n482=      sockrename %~nkosockread1 %~nkosockread2
n483=      nkoquery 0 15» 14Connected: $gettok(%~nkosockread,3,32)
n484=    }
n485=    if ($findtok(%nkoplayer,$gettok(%~nkosockread,3,32),46) != $null) {
n486=      %~nkosockread1 = nOthello [ $+ [ $gettok(%~nkosockread,2,32) ] ]
n487=      %~nkosockread2 = nOthellos [ $+ [ $gettok(%~nkosockread,3,32) ] ]
n488=      sockrename %~nkosockread1 %~nkosockread2
n489=      nkoquery 0 15» 14Connected: $gettok(%~nkosockread,3,32)
n490=    }
n491=  }
n492=  else nkodo $right($sockname,$calc($len($sockname) - 9)) s %~nkosockread
n493=  goto A
n494=  :End | unset %~nkosockread %~nkosockread1 %~nkosockread2
n495=}
n496=on 1:sockread:nkoHost:{
n497=  if ($sockerr > 0) { nkoquery 0 4*** 14Socket error (data reading) | return }
n498=  :A | sockread %~nkosockread
n499=  if ($sockbr == 0) goto End
n500=  nkodo $remove($gettok(%nkoplayer,$nkohost,46),@) s %~nkosockread
n501=  goto A
n502=  :End | unset %~nkosockread %~nkosockread1 %~nkosockread2
n503=}
n504=alias nkosockclose {
n505=  if ($sockerr > 0) { nkoquery 0 4*** 14Socket error (connection closing) | return }
n506=  if ($sock(nkoHost) != $null) {
n507=    sockclose nkoHost
n508=    nkoquery 0 15» 14Closed connection to host
n509=    goto End
n510=  }
n511=  if ($findtok(%nkoplayer,@ [ $+ [ $me ] ] ,46) == $null) goto End
n512=  if ($sline(@nOthello,1) == $null) {
n513=    if ($?="Disconnect from all? (Y/N)" != y) goto End
n514=    sockclose nOthello* | sockclose nkostart | nkoquery 0 15» 14Socket connections closed | goto End
n515=  }
n516=  if ($1 == 1) { sockclose nOthello* | sockclose nkostart | nkoquery 0 15» 14Socket connections closed | goto End }
n517=  if ($1 != 0) { if ($?="Disconnect from selected? (Y/N)" != y) goto End }
n518=  %~nkosockclose = 1
n519=  :A | if ($sline(@nOthello,%~nkosockclose) == $null) goto End
n520=  if (($sline(@nOthello,%~nkosockclose) == $chr(160)) || (($sline(@nOthello,%~nkosockclose).ln < 5) && ($1 == 0))) { inc %~nkosockclose 1 | goto A }
n521=  if (($sock(nOthellou [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] ) != $null) || ($sock(nOthellos [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] ) != $null)) {
n522=    if ($findtok(%nkoplayer,+ [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] ,46) != $null) { %~nkosockclose1 = + [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] | sockclose nOthellou [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] }
n523=    else { %~nkosockclose1 = $sline(@nOthello,%~nkosockclose) | sockclose nOthellos [ $+ [ $sline(@nOthello,%~nkosockclose) ] ] }
n524=    %nkoplayer = $remtok(%nkoplayer,%~nkosockclose1,46)
n525=    nkoquery 0 15» 14Closed connection to $sline(@nOthello,%~nkosockclose)
n526=  }
n527=  inc %~nkosockclose 1 | goto A
n528=  :End
n529=  if ($gettok(%nkoplayer,0,46) > 1) { nkorefp | nkomsg 0 nkorefp %nkoplayer }
n530=  else { unset %nkoplayer | %nko = $puttok(%nko,0,7,46) | window -c @nOthello | nothello }
n531=  unset %~nkosockclose
n532=}
n533=on 1:sockwrite:nOthello*:if ($sockerr > 0) nkoquery 0 4*** 14Socket error (data sending)
n534=on 1:sockwrite:nkoHost:if ($sockerr > 0) nkoquery 0 4*** 14Socket error (data sending)
n535=on 1:sockclose:nOthello*:nkoquery 0 4*** 14Lost connection to $right($sockname,$calc($len($sockname) - 9))
n536=on 1:sockclose:nkoHost:nkoquery 0 4*** 14Lost connection to host