alias tankslist tanklist
alias -l O0OO00OO {
  var %tanks.OOO0O00O = $getdot(@Tanks color,$1,$2), %tanks.O00OOO0O = $calc(20+8*%tanks.O00O0000), %tanks.O0000O00 = $calc(8*%tanks.OO0O0O0O -53)
  if ($3 != 1) if (%tanks.OOO0O00O == %tanks.15) return
  if ($1 < %tanks.O00OOO0O) {
    if ($3) drawrect -rf @Tanks color %tanks.OOO0O00O 1 $calc(1+%tanks.O00OOO0O) %tanks.O0000O00 62 62
    return $int($calc(($1 -10)/8)) $+ , $+ $int($calc(($2 -10)/8))
  }
  elseif ($3) drawrect -rf @Tanks color %tanks.15 1 $calc(1+%tanks.O00OOO0O) %tanks.O0000O00 62 62
}
alias -l OO0OOOO0 {
  if (* !iswm $window(@Tanks)) return
  var %tanks.O0OOOOOO, %tanks.OOO0O00O, %tanks.OO00O00O = %tanks.OO0OOOOO [ $+ [ %tanks.OOO00O00 ] ] , %tanks.O0O0OO00 = $iif(%tanks.OO00OOOO,%tanks.OO00000O,0), %tanks.O0O00OOO = %tanks.O00O0O00. [ $+ [ %tanks.OOO00O00 ] ] , %tanks.OO0OOO0O, %tanks.O0O00OO0 = %tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.O00OO0OO [ $+ [ %tanks.O0O00OOO ] ] !isnum) || (%tanks.O0OO0O00 [ $+ [ %tanks.O0O00OOO ] ] < 1) || (%tanks.OO00O00O !isnum) {
    var %tanks.O0OO0000
    tokenize 32 %tanks.O00O000O
    while ($1) {
      if (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) && ($1 != %tanks.OOO00O00) %tanks.O0OO0000 = %tanks.O0OO0000 $1
      tokenize 32 $2-
    }
    %tanks.O0O00OOO = $gettok(%tanks.O0OO0000,$rand(1,$numtok(%tanks.O0OO0000,32)),32)
    %tanks.O00O0O00. [ $+ [ %tanks.OOO00O00 ] ] = %tanks.O0O00OOO
    %tanks.OO0OOO0O = 1
  }
  if (%tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ] < %tanks.OOO000O0 [ $+ [ %tanks.O0O00OOO ] ] ) var %tanks.O0OOOOOO = 1
  %tanks.OOO0O00O = $iif(%tanksmode & 1 && %tanks.O0O00OO0 < 4 || %tanks.O0O00OO0 == 0,$calc(53 + 9 * %tanks.O0O00OO0 / 3),66)
  %tanks.OOO0O00O = $iif(%tanks.O0OOOOOO != 1,180-) %tanks.OOO0O00O + %tanks.O0O0OO00 / 99 * $iif($iif(%tanks.O0OOOOOO,$calc(0-%tanks.O0O0OO00),%tanks.O0O0OO00) > 0,17,14)
  %tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] = $round($calc(%tanks.OOO0O00O),0)
  var %tanks.O00OOO0O = %tanks.OOO000O0 [ $+ [ %tanks.O0O00OOO ] ] - %tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ] , %tanks.O0000O00 = %tanks.OO00O0O0 [ $+ [ %tanks.O0O00OOO ] ] - %tanks.OO00O0O0 [ $+ [ %tanks.OOO00O00 ] ]
  var %tanks.O0OOO0O0 = %tanks.O000O0O0 [ $+ [ %tanks.OOO00O00 ] ] - %tanks.O00OOO0O, %tanks.O000OO00 = %tanks.O0OO0OO0 [ $+ [ %tanks.OOO00O00 ] ] - %tanks.O0000O00
  if (%tanks.OO00O00O !isnum) || (%tanks.OO0OOO0O) || ($calc($iif(%tanks.O0OOOOOO,0-) (%tanks.O0OOO0O0 + %tanks.O00OOO0O / 2)) > 0) {
    %tanks.O0OOO0O0 = 0
    %tanks.O000OO00 = 0 - %tanks.O0000O00
    %tanks.OO00O00O = $round($calc($iif(%tanksmode & 1 || %tanks.O0O00OO0 == 0,$calc(80 + 5 * %tanks.O0O00OO0),100) * $sqrt($abs($calc(%tanks.O00OOO0O / %tankswidth)))),0)
    %tanks.OO0OOO0O = 1
  }
  $iif(%tanks.O0OOOOOO,dec,inc) %tanks.OO00O00O $round($calc(%tanks.O0OOO0O0 / 8),0)
  inc %tanks.OO00O00O $round($calc(%tanks.O000OO00 / 20),0)
  if (%tanks.O0O00OO0 == 0) inc %tanks.OO00O00O $iif($iif(%tanks.O0OOOOOO,$calc(0-%tanks.O0O0OO00),%tanks.O0O0OO00) > 0,$calc($rand(0,4) - 2),$calc($rand(0,6) - 3))
  if (%tanks.OO00O00O > 100) %tanks.OO00O00O = 100
  if (%tanks.OO00O00O < 0) %tanks.OO00O00O = 0
  if (%tanks.OO0OOO0O != 1) && (%tanks.O0OOO0O0 >= -40) && (%tanks.O0OOO0O0 <= 40) && (%tanks.O000OO00 >= -38) && (%tanks.O000OO00 <= 30) && (%tanks.OO00O00O isnum) {
    if (%tanks.O0O00OO0 == 2) %tanks.OOO0O000 = $rand(1,3)
    if (%tanks.O0O00OO0 == 3) %tanks.OOO0O000 = $rand(2,5)
    if (%tanks.O0O00OO0 == 4) %tanks.OOO0O000 = 5
    if (%tanks.OOO0O000 < 1) %tanks.OOO0O000 = 1
    if ($O00OOOOO < %tanks.OOO0O000) %tanks.OOO0O000 = $ifmatch
  }
  tokenize 32 %tanks.O00O000O
  %tanks.O0O0OO00 = 1
  while (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) {
    if ($1 != %tanks.OOO00O00) if ($O00OOOOO($1) > %tanks.O0O0OO00) %tanks.O0O0OO00 = $ifmatch
    tokenize 32 $2-
  }
  var %tanks.OO000OOO = %tanks.O0O0O000 [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.OO0O0O00 & 1) %tanks.OO000OOO = 100
  while (%tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ] <= %tanks.O0O0OO00) || (%tanks.OO00O00O > %tanks.OO000OOO) && (%tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] >= 30) && (%tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ] < 10) {
    O0O0O000 O00000OO
    inc %tanks.OO000OOO 10
  }
  %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ] = %tanks.OO00O00O
  O000O00O 1
  O0000OO0
  OOO0O0OO
}
on *:close:@tanksO0000000:O0000O0O
dialog tankschat {
  title "Tanks - Enter a message."
  option dbu
  size -1 -1 160 20
  edit "", 2, 4 5 122 11, autohs result limit 200
  button "&Send", 3, 131 5 25 11, ok
  list 1,0 0 0 0,hidedisable
}
alias -l OOOO0000 {
  .timertanks* off
  %tanksremove = %tanksid
  %tanksid = $ticks
  if ($version == 6.02) window -hp @tanksO00000OO
  else {
    var %tanks.O00OOOOO = $iif(%tanksnoxy || * * !iswm %tanksxy,-1 -1,%tanksxy)
    window -hBdfp +Ld @tanksO00000OO %tanks.O00OOOOO 100 17
    window -h @tanksO00000OO %tanks.O00OOOOO 100 17
  }
  window -hl @tanksO0000O0O
  var %tanks.O00OOO0O, %tanks.O0000O00, %tanks.O000OOOO = $scriptdir $+ tanks.bmp
  OO0OO000
  if ($pic(%tanks.O000OOOO).width $pic(%tanks.O000OOOO).height != 367 148) {
    OO000O00 $iif($isfile(%tanks.O000OOOO),Incorrect Tanks file:,Tanks file missing:) tanks.bmp
    O0000O0O
    downloadtanks
    return return
  }
  %tanksbmp = " $+ %tanks.O000OOOO $+ "
  %tanks.O00O0000 = 30
  %tanks.OO0O0O0O = 10
  if (%tankstitle !isnum) %tankstitle = 15
  window -Bhpf +d @tanksO000000O -1 -1 %tanks.O00O0000 %tanks.OO0O0O0O
  window -f @tanksO000000O -1 -1 %tanks.O00O0000 %tanks.OO0O0O0O
  drawpic -c @tanksO000000O 0 0 150 104 %tanks.O00O0000 %tanks.OO0O0O0O %tanksbmp
  %tanks.O0OOOOO0 = 5 11 13 10 8 18 3 17 2 16 6
  %tankscolor = $O00O0O0O(%tankscolor)
  %tanksname = $OO000000(%tanksname,1)
  if (* !iswm %tanksserver) %tanksserver = %tanksname $+ 's server
  %tanksserver = $OO000000(%tanksserver,0)
  window -hl @tanksO0000000
  %tanks.O000OOOO = $scriptdir $+ tanks.ban
  if ($isfile(%tanks.O000OOOO)) loadbuf @tanksO0000000 " $+ %tanks.O000OOOO $+ "
  if (%tanksskill !isnum 0-4) %tanksskill = 4
  if (%tankscwind !isnum 0-2) %tankscwind = 1
  if (%tanksmode !isnum 0-1) %tanksmode = 0
  %tanks.O0O000O0 = %tanksfast
  if (%tanksinc !isin 1 5) %tanksinc = 5
  if (%tankslimit !isnum 1-999) %tankslimit = 10
  if (%tankslimitmode !isnum 0-2) %tankslimitmode = 1
  %tanks.OO00OOOO = %tankscwind
  %tanks.OO0O0O00 = %tanksmode
  %tanks.OO0000O0 = 1
  %tanks.OOO0OO00 = %tankslimit
  %tanks.O000O000 = %tankslimitmode
  %tanks.OOO0O000 = 1
  %tanks.OOO00O00 = 1
  %tanks.OO00000O = 0
  %tanks.O0OOO0OO = 32
  %tanks.O00O00OO = 0
  %tanks.O0OOOO00 = 2
  if (%tanksplayerlimit !isnum 2-32) %tanksplayerlimit = 8
  %tankswidth = 641
  %tanksheight = 460
  %tanks.OO000OO0 = 20
  %tanks.OO0O00O0 = 311
  inc %tanksd
  if (%tanksd > $script(0)) %tanksd = 1
  %tanks.O000O0OO = 0
  %tanks.OOO0000O = 21
  %tankschat.O00O0OO0 = 321
  %tankschat.O0000OOO = 312
  %tankschat.O00OO0O0 = $calc(%tankswidth -15-%tankschat.O00O0OO0)
  %tankschat.O000OOOO = $calc(%tanksheight -%tankschat.O0000OOO)
  %tankschat.O000000O = 11
  %tankschat.O00O000O = %tanks.15
  %tankschat.O00OO0OO = %tanks.1
  %tankschat.O000O0OO = %tanks.2
  %tankschat.O00O00O0 = %tanks.8
  %tankschat.O0000O00 = 15000804
  %tankschat.O00O0O00 = 9342606
  %tankschat.O00O0OOO = %tankswidth - 15
  %tankschat.O000OOO0 = %tankschat.O0000OOO + 15
  %tankschat.O000O0O0 = %tankschat.O000OOOO - 30
  %tankschat.O000OO0O = %tanksheight - 15
  %tankschat.O00OOO00 = 0
  %tankschat.O00OO000 = 0
  O0OO0OO0
  %tanks.O0000OOO = $iif(%tanksground isnum,%tanksground,%tanks.14)
  %tanks.OO000000 = $iif(%tankssky isnum,%tankssky,%tanks.15)
  %tanks.OO0OO0OO = 11579568
  %tanks.OO0OO000 = 16777215
  %tanks.O00O0O0O = 0
  %tanks.OO000O0O = 7368816
  %tanks.O0OO0OOO = %tanks.8
  %tanks.OOO0O0OO = %tanks.1
  %tanks.O0OO000O = %tanks.8
  O0OO0000 close -@ @Tanks @tanksO0000O00
  var %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) {
    OO0OO0OO %tanks.OO00O00O $OO0OO0OO
    dec %tanks.OO00O00O
  }
}
on *:active:*:{
  if ($version != 6.02) && (%tanks.O00OOO00) {
    unset %tanks.O00OOO00
    window -h @tanksO00000OO
  }
}
alias -l OOO00O00 {
  if (%tankschat.O00O0O0O) return
  var %tanks.O00OOO0O = %tankschat.O00OOO00
  dec %tankschat.O00OOO00 $1
  if (%tankschat.O00OOO00 < 0) %tankschat.O00OOO00 = 0
  if (%tanks.O00OOO0O != %tankschat.O00OOO00) OOO00OO0
}
alias -l O0O00OO0 {
  if ($1 == 0) !.notice $2 tanks $3-
  else !.notice %tankstempnick tanks $1-
}
alias -l O00O00O0 {
  if (* !iswm $window(@Tanks)) return
  if (%tankschat.O000O00O == O00000O0) var %tanks.O0000O00 = %tankschat.O000OOO0, %tanks.OOO0O0O0 = %tankschat.O0000000 - %tankschat.O000OOO0, %tanks.OOO0O00O = OOO0O00O 11
  elseif (%tankschat.O000O00O == O0000O0O) var %tanks.O0000O00 = %tankschat.O0000000 + 15, %tanks.OOO0O0O0 = $calc(%tankschat.O000OO0O -15-%tankschat.O0000000), %tanks.OOO0O00O = OOO00O00 11
  elseif (%tankschat.O000O00O == O000O000) var %tanks.O0000O00 = %tankschat.O0000OOO, %tanks.OOO0O0O0 = 15, %tanks.OOO0O00O = OOO0O00O
  elseif (%tankschat.O000O00O == O00O0000) var %tanks.O0000O00 = %tankschat.O000OO0O, %tanks.OOO0O0O0 = 15, %tanks.OOO0O00O = OOO00O00
  if ($1 != 1) && ($inrect($mouse.x,$mouse.y,%tankschat.O00O0OOO,%tanks.O0000O00,15,%tanks.OOO0O0O0)) {
    %tankschat.O00000OO = 1
    %tanks.OOO0O00O
    return
  }
  %tankschat.O00000OO = 0
  drawrect -fnr @Tanks %tankschat.O0000O00 1 %tankschat.O00O0OOO %tankschat.O000OOO0 15 %tankschat.O000O0O0
  drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O0000000 180 115 15 15 %tanksbmp
  drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O0000OOO 150 115 15 15 %tanksbmp
  drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O000OO0O 150 130 15 15 %tanksbmp
  drawdot @Tanks
}
alias -l O00O0OOO {
  if ($version != 6.02) window -h @tanksO00000OO
  var %tanks.OO0O0OOO = @tankscore, %tanks.OOO00OO0 = @Tanks scores, %tanks.O0O000OO = $timer(tanks.O00O0OOO), %tanks.O0OO0000 = $window(%tanks.OOO00OO0).x $window(%tanks.OOO00OO0).y, %tanks.OO0O00OO = $numtok(%tanks.O00O000O,32)
  close -@ %tanks.OO0O0OOO
  window -hls %tanks.OO0O0OOO
  var %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      var %tanks.O0O0O0O0 = $calc($round($calc(100*%tanks.OO0OOO00 [ $+ [ %tanks.OO00O00O ] ] /%tanks.O0OOO00O [ $+ [ %tanks.OO00O00O ] ] ),0) +50000), %tanks.OO0OO0O0 = $calc(%tanks.OO0OOO00 [ $+ [ %tanks.OO00O00O ] ] +50000), %tanks.O00OOOOO = $calc(%tanks.O00OO0O0 [ $+ [ %tanks.OO00O00O ] ] +50000), %tanks.O000OOOO = $calc(%tanks.O0OOOO0O [ $+ [ %tanks.OO00O00O ] ] +50000)
      if (\ 50000 50000 50000 50000 \ != \ %tanks.O0O0O0O0 %tanks.OO0OO0O0 %tanks.O00OOOOO %tanks.O000OOOO \) %tanks.O0O000OO = 1
      if ($sock(tanks.*,0)) || ($sock(tanks)) && (%tanks.OO0O0O00 !& 1) && (%tanks.O00OO0O0 [ $+ [ %tanks.OO00O00O ] ] < 5) %tanks.O0O0O0O0 = 50000 !
      aline %tanks.OO0O0OOO $str(!,$calc(6-$len($gettok(%tanks.O0O0O0O0,1,32)))) $+ %tanks.O0O0O0O0 $str(!,$calc(6-$len(%tanks.OO0OO0O0))) $+ %tanks.OO0OO0O0 $str(!,$calc(6-$len(%tanks.O000OOOO))) $+ %tanks.O000OOOO $str(!,$calc(6-$len(%tanks.O00OOOOO))) $+ %tanks.O00OOOOO %tanks.OO00O00O
    }
    dec %tanks.OO00O00O
  }
  if ($line(%tanks.OO0O0OOO,0)) && (%tanks.O0O000OO) {
    %tanks.OO0O00OO = 580 $calc(16 * $iif(%tanks.OO0O00OO < 8,8,%tanks.OO0O00OO) + 20)
    if (* * iswm %tanks.O0OO0000) {
      window -fa %tanks.OOO00OO0 %tanks.O0OO0000 %tanks.OO0O00OO
      filter -wwcx %tanks.OOO00OO0 %tanks.OOO00OO0
    }
    else window $iif(%tanksontop,-fzdok0,-fzdk0) %tanks.OOO00OO0 -1 -1 %tanks.OO0O00OO Fixedsys 15
    while ($line(%tanks.OO0O0OOO,0)) {
      %tanks.O00OOOOO = $line(%tanks.OO0O0OOO,1)
      tokenize 32 $remove(%tanks.O00OOOOO,!)
      if (* ! * iswm %tanks.O00OOOOO) %tanks.O0O0O0O0 = [Wait]
      else %tanks.O0O0O0O0 = $calc($1 -50000) $+ %
      %tanks.O00OOOOO = iline %tanks.OOO00OO0 1 Accuracy: %tanks.O0O0O0O0 $+ ; 
      if (%tanks.OO0O0O00 !& 1) %tanks.O00OOOOO = %tanks.O00OOOOO Damage: $calc($2 -50000) $+ ; 
      %tanks.O00OOOOO Frags: $calc($3 -50000) $+ ;  Turns: $calc($4 -50000) $+ ;  %tanks.O0OO00O0 [ $+ [ $5 ] ]
      dline %tanks.OO0O0OOO 1
    }
    while (1) {
      aline %tanks.OOO00OO0  
      if ($line(%tanks.OOO00OO0,0) >= 9) break
    }
  }
  else close -@ %tanks.OOO00OO0
  close -@ %tanks.OO0O0OOO
}
alias -l OOO0O00O {
  if (%tankschat.O00O0O0O) return
  var %tanks.O00OOO0O = %tankschat.O00OOO00
  inc %tankschat.O00OOO00 $1
  if (%tankschat.O00OOO00 >= $calc(%tankschat.O00OO000 -10)) %tankschat.O00OOO00 = %tankschat.O00OO000 - 11
  if (%tankschat.O00OOO00 < 0) %tankschat.O00OOO00 = 0
  if (%tanks.O00OOO0O != %tankschat.O00OOO00) OOO00OO0
}
alias -l O00000O0 {
  var %tanks.O00OOO0O = $mouse.x, %tanks.O0000O00 = $mouse.y
  drawtext -rbn @Tanks request %tanks.0 $iif($inrect(%tanks.O00OOO0O,%tanks.O0000O00,16,24,39,15),%tanks.12,%tanks.2) Fixedsys 15 16 24 [Yes]
  drawtext -rbn @Tanks request %tanks.0 $iif($inrect(%tanks.O00OOO0O,%tanks.O0000O00,64,24,31,15),%tanks.12,%tanks.2) Fixedsys 15 64 24 [No]
  drawdot @Tanks request
}
dialog tanksserver {
  title "Tanks server settings"
  size -1 -1 183 146
  option dbu
  button "&Ok" 1,75 130 32 12, default ok
  button "&Cancel" 2,110 130 32 12, cancel
  button "&Apply" 3,145 130 32 12
  box "Game settings" 101,6 4 171 65, group
  check "Instagib mode (One hit kills, no starting credits)" 4,14 15 124 11
  check "Reset scores when a" 5,14 33 61 11
  combo 6,76 33 40 50, drop
  text "of" 102,119 35 6 8
  edit "" 7,126 33 16 11, center
  text "is reached" 103,145 35 26 8
  text "Wind mode:" 104,14 53 30 8
  combo 8,46 51 55 50, drop
  box "Connections" 105,6 77 171 47, group
  text "Limit the number of players to:" 106,14 91 76 8
  edit "" 9,91 89 16 12, center
  button "-" 10,110 89 14 12
  button "+" 11,126 89 14 12
  check "Allow multiple connections from the same IP address" 12,14 107 135 10
}
alias -l O0OOO0O0 {
  var %tanks.O00OOO0O = $1 - 1
  drawline -rn @Tanks %tanks.OO000000 1 %tanks.O00OOO0O %tanks.OO000OO0 %tanks.O00OOO0O $2
  drawline -rn @Tanks %tanks.O0000OOO 1 %tanks.O00OOO0O $2 %tanks.O00OOO0O %tanks.OO0O00O0
  rline @tanksO0000O00 $1 $2
}
alias -l O0OOO000 {
  if (* !iswm $window(@Tanks)) return
  var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.OO0O0OOO, %tanks.OOO00OO0, %tanks.O0O00OO0 = $iif($numtok(%tanks.O00O000O,32) > 8,1,0)
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      if (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) %tanks.OO0O0OOO = %tanks.OO00O00O %tanks.OO0O0OOO
      else %tanks.OOO00OO0 = %tanks.OO00O00O %tanks.OOO00OO0
    }
    dec %tanks.OO00O00O
  }
  %tanks.O00O000O = %tanks.OO0O0OOO %tanks.OOO00OO0
  var %tanks.O0O000OO = $numtok(%tanks.O00O000O,32)
  while ($calc(9-%tanks.O0OOOO00 +%tanks.O00O00OO) > %tanks.O0O000OO) && (%tanks.O00O00OO > 0) {
    dec %tanks.O00O00OO %tanks.O0OOOO00
  }
  if (%tanks.O0O00OO0 != $iif(%tanks.O0O000OO > 8,1,0)) && (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) O00O0OO0
  drawrect -rfn @Tanks %tanks.15 1 0 312 320 57
  if (%tanks.O000O0OO) O0O0O0OO
  O0000000
  var %tanks.OO0O000O = 1, %tanks.OO000OOO = $O00OOOOO, %tanks.O0O0O0OO = %tanks.0, %tanks.O0O00OO0 = %tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ]
  while (1) {
    var %tanks.OO00O00O = $gettok(%tanks.O00O000O,%tanks.OO0O000O,32)
    if (%tanks.OO00O00O) && (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) {
      if (%tanks.OO00O00O != %tanks.OOO00O00) && ($O00OOOOO(%tanks.OO00O00O) >= %tanks.O0O00OO0) && (%tanks.O0O00OO0 > 0) {
        if (%tanks.OO0O0O00 !& 1) && (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) O00000OO %tanks.OO00O00O %tanks.4 !
        %tanks.O0O0O0OO = %tanks.4
      }
      inc %tanks.OO0O000O
    }
    else break
  }
  %tanks.OO0O000O = 1
  while (1) {
    %tanks.OO00O00O = $gettok(%tanks.O00O000O,$calc(%tanks.O00O00OO + %tanks.OO0O000O),32)
    if (%tanks.OO0O000O <= 8) && (%tanks.OO00O00O) { }
    else break
    var %tanks.O0O000OO = 10, %tanks.O0OO0O0O = %tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] , %tanks.O00OOO0O = $iif(%tanks.OO0O000O & 1,64,222), %tanks.O0000O00 = $calc(320+13*$int($calc((%tanks.OO0O000O -1)/2))), %tanks.OOO0O00O = $iif(%tanks.OO00O00O == %tanks.OOO00O00,%tanks.O0O0O0OO,$iif(%tanks.O0OO0O0O > %tanks.OO000OOO,%tanks.0,%tanks.4)), %tanks.O00OOOOO = $iif(%tanks.O000O00O [ $+ [ %tanks.OO00O00O ] ] && %tanks.O0OO0O0O > 0 || %tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] isnum,14,0), %tanks.O0OO0000 = $iif(%tanks.OO00O00O == %tanks.OOO00O00 && %tanks.O0OO0O0O > 0,%tanks.OO0OO000,%tanks.1)
    if (%tanks.OO00O00O == %tanks.OOO00O00) && (%tanks.O0OO0O0O > 0) drawrect -rfn @Tanks %tanks.O00O0O0O 1 $calc(10+%tanks.O00OOO0O) $calc(%tanks.O0000O00 -6) 85 14
    drawrect -rnf @Tanks %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] 1 $calc(%tanks.O00OOO0O -61) $calc(%tanks.O0000O00 -5) 69 12
    drawpic -cnt @Tanks 16711935 $calc(%tanks.O00OOO0O -61) $calc(%tanks.O0000O00 -5) 120 92 69 12 %tanksbmp
    if (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] == 5) {
      drawpic -cnt @Tanks 16711935 $calc(11+%tanks.O00OOO0O) $calc(%tanks.O0000O00 -4) 190 92 12 10 %tanksbmp
      drawfill -srn @Tanks $iif(%tanks.OO00O00O == %tanks.OOO00O00 && %tanks.O0OO0O0O > 0,%tanks.15,%tanks.1) 16777215 $calc(11+%tanks.O00OOO0O) %tanks.O0000O00 $calc(16+%tanks.O00OOO0O) %tanks.O0000O00
    }
    elseif (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] isnum 0-4) {
      drawpic -cnt @Tanks 16711935 $calc(11+%tanks.O00OOO0O) $calc(%tanks.O0000O00 -4) 180 104 12 10 %tanksbmp
      drawfill -srn @Tanks $iif(%tanks.OO00O00O == %tanks.OOO00O00 && %tanks.O0OO0O0O > 0,%tanks.15,%tanks.1) 16777215 $calc(11+%tanks.O00OOO0O) %tanks.O0000O00 $calc(15+%tanks.O00OOO0O) %tanks.O0000O00 $calc(15+%tanks.O00OOO0O) $calc(3+%tanks.O0000O00)
    }
    elseif (%tanks.O00OOOOO) {
      drawpic -cnt @Tanks 16711935 $calc(12+%tanks.O00OOO0O) $calc(%tanks.O0000O00 -4) 192 104 10 10 %tanksbmp
      drawfill -srn @Tanks %tanks.O0OO0000 16777215 $calc(13+%tanks.O00OOO0O) %tanks.O0000O00
    }
    drawtext -crn @Tanks %tanks.O0OO0000 %tankschat.O0000O0O %tankschat.O0000OO0 $calc(10+%tanks.O00OOOOO + %tanks.O00OOO0O + %tankstahoma) $calc(%tanks.O0000O00 -6) $calc(83-%tanks.O00OOOOO) 13 %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ]
    if (%tanks.O0OO0O0O > 10) || (%tanks.OO0O0O00 & 1) {
      if (%tanks.O0OO0O0O < 1) %tanks.OOO0O00O = %tanks.O0OO000O
      elseif (%tanks.OO0O0O00 & 1) %tanks.OOO0O00O = %tanks.0
      if (%tanks.O00000O0) {
        dec %tanks.O00OOO0O 56
        drawline -rn @Tanks %tanks.OOO0O00O 1 %tanks.O00OOO0O %tanks.O0000O00 $calc(59+%tanks.O00OOO0O) %tanks.O0000O00
        inc %tanks.O0000O00
        drawline -rn @Tanks %tanks.OOO0O00O 1 %tanks.O00OOO0O %tanks.O0000O00 $calc(59+%tanks.O00OOO0O) %tanks.O0000O00
      }
      else drawrect -rfn @Tanks %tanks.OOO0O00O 1 $calc(%tanks.O00OOO0O -56) %tanks.O0000O00 59 2
    }
    else {
      while (%tanks.O0O000OO) {
        drawfill -rn @Tanks $iif(%tanks.O0OO0O0O >= %tanks.O0O000OO,%tanks.OOO0O00O,%tanks.O0OO000O) 0 %tanks.O00OOO0O %tanks.O0000O00
        dec %tanks.O00OOO0O 6
        dec %tanks.O0O000OO
      }
    }
    inc %tanks.OO0O000O
  }
  if (%tanks.O00OO0OO [ $+ [ %tanks.OOO00O00 ] ] !isnum) return
  var %tanks.O0O000OO = 10, %tanks.O0O00OO0 = %tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ]
  drawrect -rfn @Tanks %tanks.O0OO0OOO 1 0 370 320 9
  if (%tanks.O0O00OO0 > 10) || (%tanks.OO0O0O00 & 1) {
    if (%tanks.O0O00OO0 < 1) %tanks.O0O0O0OO = %tanks.OOO0O0OO
    elseif (%tanks.OO0O0O00 & 1) %tanks.O0O0O0OO = %tanks.0
    drawrect -rfn @Tanks %tanks.O0O0O0OO 1 1 372 318 5
    return
  }
  while (%tanks.O0O000OO) {
    drawrect -rfn @Tanks $iif(%tanks.O0O00OO0 >= %tanks.O0O000OO,%tanks.O0O0O0OO,%tanks.OOO0O0OO) 1 $calc(32*%tanks.O0O000OO -31) 372 30 5
    dec %tanks.O0O000OO
  }
}
alias -l O0O0OOOO {
  tokenize 32 %tanks.OOO00O00 %tanks.O0O0O000 [ $+ [ %tanks.OOO00O00 ] ] %tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.OO0O0O00 & 1) tokenize 32 $1 100 $3
  if ($3 !isnum) return
  OO0OOO0O 411 %tanks.OO0OOOOO [ $+ [ $1 ] ] $iif(%tanks.OO0O0O00 !& 1 && %tanks.OO0OOOOO [ $+ [ $1 ] ] > $2,1)
  OO0OOO0O 424 $2
  OO0OOO0O 440 $3 $iif(%tanks.OO0O0O00 & 1 || %tanks.O0OO0O00 [ $+ [ $1 ] ] >= 10 && $3 < 50 || $3 < 30,1)
}
alias -l OOO00OO0 {
  if (* !iswm $window(@Tanks)) || (%tankschat.O00O000O !isnum) return
  if (%tankschat.O00OO000 == 0) {
    O000O0OO - O000O0OO Right-click for commands and options
    if ($sock(tanks)) && (%tanksnochat) O000O0OO - O000O0OO Chat text and player names are disabled
    elseif ($sock(tanks.*,0)) || ($sock(tanks)) O000O0OO - O000O0OO Press 'T' to chat or 'M' to send a private message
    if (%tanksnochat != 1) || (* !iswm $sock(tanks)) && (%tanks.O00OO0OO0 isnum) O000O0OO - $iif($timer(tanks.O000O0OO),O000O0OO,O0000OOO) Server is: %tanks.O0OO00O00
    %tankschat.O00OO000 = $line(@tanksO0000O0O,0)
  }
  drawrect -fnr @Tanks %tankschat.O0000O00 1 %tankschat.O00O0OOO %tankschat.O000OOO0 15 %tankschat.O000O0O0
  if (%tankschat.O00OO000 < 12) %tankschat.O0000000 = %tanksheight + 15
  else {
    %tankschat.O0000000 = $int($calc(%tanksheight -30-(%tankschat.O000O0O0 -15)*%tankschat.O00OOO00 /(%tankschat.O00OO000 -11)))
    if (%tankschat.O000O00O == O00000O0) drawrect -fnr @Tanks %tankschat.O00O0O00 1 %tankschat.O00O0OOO %tankschat.O000OOO0 15 $calc(%tankschat.O0000000 -%tankschat.O000OOO0)
    elseif (%tankschat.O000O00O == O0000O0O) drawrect -fnr @Tanks %tankschat.O00O0O00 1 %tankschat.O00O0OOO %tankschat.O0000000 15 $calc(%tankschat.O000OO0O -%tankschat.O0000000)
    drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O0000000 180 115 15 15 %tanksbmp
  }
  var %tanks.O00OOO0O = 150
  if (%tankschat.O000O00O == O000O000) && (%tankschat.O00000OO) %tanks.O00OOO0O = 165
  drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O0000OOO %tanks.O00OOO0O 115 15 15 %tanksbmp
  %tanks.O00OOO0O = 150
  if (%tankschat.O000O00O == O00O0000) && (%tankschat.O00000OO) %tanks.O00OOO0O = 165
  drawpic -cn @Tanks %tankschat.O00O0OOO %tankschat.O000OO0O %tanks.O00OOO0O 130 15 15 %tanksbmp
  var %tanks.O00OOO0O = %tankschat.O00O0OO0, %tanks.OO0OO00O = %tankschat.O0000OOO, %tanks.O0O0OO00 = %tankschat.O00OO0O0, %tanks.OOO0O0O0 = %tankschat.O000OOOO, %tanks.OOO0O00O
  drawrect -rfn @Tanks %tankschat.O00O000O 1 %tanks.O00OOO0O %tanks.OO0OO00O %tanks.O0O0OO00 %tanks.OOO0O0O0
  inc %tanks.O00OOO0O 3
  %tanks.O0O0OO00 = $calc(%tanks.O0O0OO00 -19-%tankstahoma)
  var %tanks.O0000O00 = $calc(%tanks.OO0OO00O -15+%tanks.OOO0O0O0), %tanks.O0O0O00O = $calc(%tanks.O00OOO0O +14+%tankstahoma), %tanks.O00OOOOO, %tanks.O0O000OO = %tankschat.O00OOO00
  while (%tanks.O0000O00 > %tanks.OO0OO00O) {
    inc %tanks.O0O000OO
    tokenize 32 $line(@tanksO0000O0O,%tanks.O0O000OO)
    if (* !iswm $1) {
      drawdot @Tanks
      return
    }
    if ($1 == O0000OOO) %tanks.O00OOOOO = $2-
    elseif ($1 == O00000OO) %tanks.O00OOOOO = $4-
    else %tanks.O00OOOOO = $3-
    if ( * !iswm %tanks.O00OOOOO) {
      if ($1 != O0000OOO) drawrect -rfn @Tanks $2 1 %tanks.O00OOO0O %tanks.O0000O00 12 12
      drawpic -cnt @Tanks 16711935 %tanks.O00OOO0O %tanks.O0000O00 $replace($1,O000O000,120,O00000O0,132,O000O0O0,132,O000000O,132,O000O00O,132,O000OO00,132,O0000O00,132,O00000OO,144,O0000O0O,156,O0000OO0,168,O0000OOO,180) 80 12 12 %tanksbmp
      if ($1 == O00000OO) drawfill -srn @Tanks $3 16777215 $calc(10+%tanks.O00OOO0O) $calc(10+%tanks.O0000O00)
    }
    if ($1 == O000000O) %tanks.OOO0O00O = %tankschat.O00OO0OO
    elseif ($istok(O000OO00 O000O00O,$1,32)) %tanks.OOO0O00O = %tankschat.O000O0OO
    elseif ($1 == O000O0O0) %tanks.OOO0O00O = 6291520
    elseif ($1 == O00000O0) %tanks.OOO0O00O = 8388688
    else %tanks.OOO0O00O = %tankschat.O00O00O0
    drawtext -nrc @Tanks %tanks.OOO0O00O %tankschat.O0000O0O %tankschat.O0000OO0 %tanks.O0O0O00O $calc(%tanks.O0000O00 -%tankstahoma) %tanks.O0O0OO00 13 %tanks.O00OOOOO
    dec %tanks.O0000O00 13
  }
  if (%tankschat.O00O0O0O) %tankschat.O00OO00O
  drawdot @Tanks
}
alias -l O0OO000O {
  var %tanks.O0O0O0O0 = %tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ]
  if ($calc(180-%tanks.O0O0O0O0) < %tanks.O0O0O0O0) %tanks.O0O0O0O0 = $ifmatch
  OO0OOO0O 385 %tanks.O0O0O0O0
}
alias tanksversion var %tanks.O00OOOOO = 2004.04.20a | if ($1) return %tanks.O00OOOOO | return Tanks [[ $+ %tanks.O00OOOOO $+ ]]
alias -l O0OOOO00 {
  if (* !iswm $window(@Tanks)) return
  var %tanks.OOO00OO0 = 1
  if ($1 == -) {
    tokenize 32 $2-
    %tanks.OOO00OO0 = 0
  }
  %tanksxy = $window(@Tanks).x $window(@Tanks).y
  drawline -rn @Tanks %tanks.1 1 0 %tanks.OO0O00O0 %tankswidth %tanks.OO0O00O0
  drawline -rn @Tanks %tanks.1 1 320 %tanks.OO0O00O0 320 %tanksheight
  var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.O0O000OO = 0, %tanks.O0O0O0O0 = 0, %tanks.O0O00O0O = 0, %tanks.OOO0O00O = 0
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      if (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) inc %tanks.O0O0O0O0
      if (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] isnum 0-4) inc %tanks.O0O00O0O
      elseif (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] !isnum) inc %tanks.OOO0O00O
      inc %tanks.O0O000OO
    }
    dec %tanks.OO00O00O
  }
  if (%tanks.O0O000OO < 2) unset %tanks.O000OO0O
  elseif (%tanks.O0O0O0O0 == 1) || (* !iswm %tanks.O000OO0O) && (* !iswm $sock(tanks)) %tanks.O000OO0O = O00000O0
  if ($1) { }
  elseif (%tanks.O000OO0O !isin O00000OO O0000O00 O000000O) {
    drawrect -rfn @Tanks %tanks.15 1 0 380 320 80
    if (%tanks.O000OO0O == O00000O0) {
      if (%tanks.OOO0O00O) O00OOOO0
      elseif (%tanks.O0O00O0O == %tanks.O0O000OO) && (%tanksstopbots) unset %tanks.O000OO0O
      else {
        drawtext -rn @Tanks %tanks.1 Fixedsys 15 56 404 Double-click here or press
        drawtext -rn @Tanks %tanks.1 Fixedsys 15 64 420 enter to start the game.
      }
      if (%tanks.OOO00OO0) drawdot @Tanks
    }
    return
  }
  var %tanks.OOO0O00O = %tanks.O00OO0OO [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.OOO0O00O !isnum) return
  drawrect -rfn @Tanks %tanks.OOO0O00O 1 0 380 320 80
  drawpic -cnt @Tanks 16711935 4 383 0 0 312 74 %tanksbmp
  O0OO000O
  OO0OOO0O 398 %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ]
  O0O0OOOO
  OO00OO0O
  drawpic -cnt @Tanks 16711935 81 440 77 $iif(%tanksinc == 1,131,57) 16 17 %tanksbmp
  drawpic -cnt @Tanks 16711935 99 440 95 $iif(%tanksinc == 1,57,131) 16 17 %tanksbmp
  if (%tanks.OOO00000 != %tanks.OOO00O00) {
    drawrect -rfn @Tanks %tanks.OOO0O00O 1 0 380 117 80 206 383 110 25 206 433 110 24
    drawpic -cn @Tanks 5 409 202 26 110 23 %tanksbmp
    drawrect -rfn @Tanks 0 1 7 411 106 19
    var %tanks.O0O0O0O0 = $calc(+$round($calc(100*%tanks.OO0OOO00 [ $+ [ %tanks.OOO00O00 ] ] /%tanks.O0OOO00O [ $+ [ %tanks.OOO00O00 ] ] ),0)) $+ %
    drawtext -rn @Tanks 16777215 %tankschat.O0000O0O %tankschat.O0000OO0 $calc(11+%tankstahoma) $calc(414-%tankstahoma) Accuracy:
    drawtext -rn @Tanks 16777215 Fixedsys 15 $calc(108-$width(%tanks.O0O0O0O0,fixedsys,15,0,0)) 413 %tanks.O0O0O0O0
  }
  O00O0OO0
}
on *:dialog:tanksban:init,sclick,edit:*:{
  var %tanks.OO0OO0O0 = $dname, %tanks.O00OOO0O = $did, %tanks.O000OOOO, %tanks.O0O00OO0
  if ($devent == init) {
    var %tanks.OO00O00O = %tanks.O0OOO0OO
    while (%tanks.OO00O00O) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
        if ($sock(tanks. [ $+ [ %tanks.OO00O00O ] ] ).ip) {
          did -i %tanks.OO0OO0O0 1 1 %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ]
          did -i %tanks.OO0OO0O0 2 1 $ifmatch
        }
      }
      dec %tanks.OO00O00O
    }
    did -c %tanks.OO0OO0O0 3
    did -c %tanks.OO0OO0O0 1 1
    %tanks.O00OOO0O = 1
    var %tanks.OO0O000O = $line(@tanksO0000000,0)
    while (%tanks.OO0O000O) {
      var %tanks.O00OOOOO = $line(@tanksO0000000,%tanks.OO0O000O)
      if (? * !iswm %tanks.O00OOOOO) did -a %tanks.OO0OO0O0 8 %tanks.O00OOOOO
      dec %tanks.OO0O000O
    }
  }
  if (%tanks.O00OOO0O isnum 3-4) && ($did(%tanks.OO0OO0O0,1,1).sel) {
    %tanks.O00OOO0O = 1
    %tanks.O000OOOO = 1
  }
  if (%tanks.O00OOO0O isnum 1-2) {
    var %tanks.O0OOOOOO = $did(%tanks.OO0OO0O0,%tanks.O00OOO0O,1).sel, %tanks.O00OOOOO = 3 - %tanks.O00OOO0O
    if (%tanks.O0OOOOOO != $did(%tanks.OO0OO0O0,%tanks.O00OOOOO,1).sel) %tanks.O000OOOO = 1
  }
  if (%tanks.O000OOOO) {
    did -c %tanks.OO0OO0O0 %tanks.O00OOOOO %tanks.O0OOOOOO
    did -o %tanks.OO0OO0O0 5 1 $did(%tanks.OO0OO0O0,$iif($did(%tanks.OO0OO0O0,3).state,2,1),%tanks.O0OOOOOO)
    did -o %tanks.OO0OO0O0 6 1 $did(%tanks.OO0OO0O0,1,%tanks.O0OOOOOO) @ $did(%tanks.OO0OO0O0,2,%tanks.O0OOOOOO)
  }
  if (%tanks.O00OOO0O == 9) {
    while ($did(%tanks.OO0OO0O0,8,1).sel) {
      did -d %tanks.OO0OO0O0 8 $did(%tanks.OO0OO0O0,8,1).sel
    }
    %tanks.O0O00OO0 = 1
  }
  if (%tanks.O00OOO0O == 7) {
    var %tanks.OO000OOO = $iif($did(%tanks.OO0OO0O0,3).state,IP: ,Name: ) $$deltok($replace($did(%tanks.OO0OO0O0,5),$chr(32), ),0,160)   ( $+ $did(%tanks.OO0OO0O0,6) $+ )
    if ($didwm(%tanks.OO0OO0O0,8,%tanks.OO000OOO,1) == 0) did -a %tanks.OO0OO0O0 8 %tanks.OO000OOO
    %tanks.O0O00OO0 = 1
  }
  if (%tanks.O0O00OO0) {
    filter -wwcx @tanksO0000000 @tanksO0000000
    %tanks.O0O00OO0 = $did(%tanks.OO0OO0O0,8).lines
    while (%tanks.O0O00OO0) {
      aline @tanksO0000000 $did(%tanks.OO0OO0O0,8,%tanks.O0O00OO0)
      dec %tanks.O0O00OO0
    }
    savebuf @tanksO0000000 " $+ $scriptdir $+ tanks.ban"
    O0000O00
  }
  if (%tanks.O00OOO0O == 7) halt
}
menu @Tanks scores {
  &Refresh:.timertanks.O00O0OOO -o 1 0 O00O0OOO
}
alias -l O00OO00O {
  var %tanks.OOO0O0O0 = $iif(%tanks.OO0O0O00 & 1,122,136), %tanks.OO0OO0O0 = drawtext -rn @Tank info 0 Fixedsys 15 8, %tanks.O0O0O0O0 = %tanks.OOO0OO0O [ $+ [ $1 ] ]
  if ($window(@Tank info)) {
    window -c @Tank info
    return
  }
  if (%tanks.O0OO0O00 [ $+ [ $1 ] ] < 1) return
  window -Bhdofpk +Ltf @Tank info $int($calc(%tankswidth /2-52+$window(@Tanks).x)) $int($calc(%tanksheight /2-60+$window(@Tanks).y)) 104 %tanks.OOO0O0O0
  drawrect -rfn @Tank info %tanks.O00OO0OO [ $+ [ $1 ] ] 1 0 0 104 %tanks.OOO0O0O0
  drawrect -rfn @Tank info %tanks.15 1 3 3 98 $calc(%tanks.OOO0O0O0 -6)
  drawtext -crn @Tank info 0 %tankschat.O0000O0O %tankschat.O0000OO0 8 8 88 13 %tanks.O0OO00O0 [ $+ [ $1 ] ]
  %tanks.OO0OO0O0 24 Angle   $iif($calc(180-%tanks.O0O0O0O0) < %tanks.O0O0O0O0,$calc(180-%tanks.O0O0O0O0),%tanks.O0O0O0O0)
  %tanks.OO0OO0O0 38 Power   %tanks.O0O0OO0O [ $+ [ $1 ] ]
  %tanks.OO0OO0O0 52 Prev.   %tanks.OO0OOOOO [ $+ [ $1 ] ]
  %tanks.OO0OO0O0 66 Max.    $iif(%tanks.OO0O0O00 & 1,100,%tanks.O0O0O000 [ $+ [ $1 ] ] )
  %tanks.OO0OO0O0 84 Credits %tanks.O00O0OOO [ $+ [ $1 ] ]
  if (%tanks.OO0O0O00 !& 1) %tanks.OO0OO0O0 98 Shield  %tanks.O0OO0O00 [ $+ [ $1 ] ]
  %tanks.OO0OO0O0 = Accuracy:  $calc(+$round($calc(100*%tanks.OO0OOO00 [ $+ [ $1 ] ] /%tanks.O0OOO00O [ $+ [ $1 ] ] ),0)) $+ %
  drawtext -rn @Tank info 0 %tankschat.O0000O0O %tankschat.O0000OO0 $calc(52-$width(%tanks.OO0OO0O0,%tankschat.O00000O0,%tankschat.O0000OO0,0,0)/2) $iif(%tanks.OO0O0O00 & 1,101,115) %tanks.OO0OO0O0
  drawdot @Tank info
}
menu @Tanks,@tanksO00000OO {
  mouse:if ($menu != @tanksO00000OO) O0O000O0
  leave:if ($menu != @tanksO00000OO) O0O000O0
  sclick:{
    if ($menu == @tanksO00000OO) O00OO00O %tanks.O00OOO00
    else O0O000O0 0
  }
  dclick:{
    if ($menu != @tanksO00000OO) {
      O0O000O0 0
      if (%tanks.O000OO0O == O00000O0) if ($inrect($mouse.x,$mouse.y,0,380,320,80)) O00OOOO0
    }
  }
  uclick:if ($menu != @tanksO00000OO) O0O000O0 1
  -
  $iif(%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum,Vie&w scores):.timertanks.O00O0OOO -o 1 0 O00O0OOO
  -
  $iif(* !iswm $sock(tanks),&Server settings):{
    if ($dialog(tanksserver)) dialog -ev $ifmatch
    else dialog $iif(%tanksontop,-dmo,-dm) tanksserver tanksserver
  }
  $iif(* !iswm $sock(tanks),&Bots && local players):{
    if ($dialog(tanksbots)) dialog -ev $ifmatch
    else dialog $iif(%tanksontop,-dmo,-dm) tanksbots tanksbots
  }
  -
  $iif($sock(tanks.0),$OO00OOOO(%tankspublic,&Public server)):{
    %tankspublic = $iif(%tankspublic,0,1)
    if (%tankspublic) O0OO0OOO
    else O00OO000
  }
  -
  &Commands
  .$iif($sock(tanks*,0) && %tanksip && %tanksport,Copy server IP &address && port to clipboard):clipboard %tanksip $+ : $+ %tanksport
  .$iif($sock(tanks.*,0),Change port for &server [ [ $+ [ %tanksport ] $+ ] ]):O0O0OOO0 /port 0
  .$iif($sock(tanks),&Ping server):O0OO0O00 O00000O0 $ctime
  .$iif($sock(tanks.*,0),&Ping user...)
  ..$iif(%tanks.O00OO0OO1 isnum && $sock(tanks.1),%tanks.O0OO00O01):O00OO0O0 1 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO2 isnum && $sock(tanks.2),%tanks.O0OO00O02):O00OO0O0 2 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO3 isnum && $sock(tanks.3),%tanks.O0OO00O03):O00OO0O0 3 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO4 isnum && $sock(tanks.4),%tanks.O0OO00O04):O00OO0O0 4 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO5 isnum && $sock(tanks.5),%tanks.O0OO00O05):O00OO0O0 5 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO6 isnum && $sock(tanks.6),%tanks.O0OO00O06):O00OO0O0 6 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO7 isnum && $sock(tanks.7),%tanks.O0OO00O07):O00OO0O0 7 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO8 isnum && $sock(tanks.8),%tanks.O0OO00O08):O00OO0O0 8 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO9 isnum && $sock(tanks.9),%tanks.O0OO00O09):O00OO0O0 9 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO10 isnum && $sock(tanks.10),%tanks.O0OO00O010):O00OO0O0 10 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO11 isnum && $sock(tanks.11),%tanks.O0OO00O011):O00OO0O0 11 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO12 isnum && $sock(tanks.12),%tanks.O0OO00O012):O00OO0O0 12 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO13 isnum && $sock(tanks.13),%tanks.O0OO00O013):O00OO0O0 13 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO14 isnum && $sock(tanks.14),%tanks.O0OO00O014):O00OO0O0 14 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO15 isnum && $sock(tanks.15),%tanks.O0OO00O015):O00OO0O0 15 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO16 isnum && $sock(tanks.16),%tanks.O0OO00O016):O00OO0O0 16 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO17 isnum && $sock(tanks.17),%tanks.O0OO00O017):O00OO0O0 17 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO18 isnum && $sock(tanks.18),%tanks.O0OO00O018):O00OO0O0 18 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO19 isnum && $sock(tanks.19),%tanks.O0OO00O019):O00OO0O0 19 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO20 isnum && $sock(tanks.20),%tanks.O0OO00O020):O00OO0O0 20 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO21 isnum && $sock(tanks.21),%tanks.O0OO00O021):O00OO0O0 21 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO22 isnum && $sock(tanks.22),%tanks.O0OO00O022):O00OO0O0 22 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO23 isnum && $sock(tanks.23),%tanks.O0OO00O023):O00OO0O0 23 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO24 isnum && $sock(tanks.24),%tanks.O0OO00O024):O00OO0O0 24 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO25 isnum && $sock(tanks.25),%tanks.O0OO00O025):O00OO0O0 25 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO26 isnum && $sock(tanks.26),%tanks.O0OO00O026):O00OO0O0 26 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO27 isnum && $sock(tanks.27),%tanks.O0OO00O027):O00OO0O0 27 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO28 isnum && $sock(tanks.28),%tanks.O0OO00O028):O00OO0O0 28 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO29 isnum && $sock(tanks.29),%tanks.O0OO00O029):O00OO0O0 29 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO30 isnum && $sock(tanks.30),%tanks.O0OO00O030):O00OO0O0 30 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO31 isnum && $sock(tanks.31),%tanks.O0OO00O031):O00OO0O0 31 O00000O0 $ctime
  ..$iif(%tanks.O00OO0OO32 isnum && $sock(tanks.32),%tanks.O0OO00O032):O00OO0O0 32 O00000O0 $ctime
  ..-
  ..Ping &all users:O0OO0O00 O00000O0 $ctime
  .$iif($sock(tanks.*,0),&List IP addresses):{
    if ($version != 6.02) window -h @tanksO00000OO
    var %tanks.O0O0OO00 = @Tanks IP addresses
    close -@ %tanks.O0O0OO00
    window $iif(%tanksontop,-fzdok0,-fzdk0) %tanks.O0O0OO00 -1 -1 420 $calc(36+16*$numtok(%tanks.O00O000O,32)) Fixedsys 15
    aline %tanks.O0O0OO00 Server at %tanksip $+ : $+ %tanksport
    aline %tanks.O0O0OO00 -
    var %tanks.OO00O00O = %tanks.O0OOO0OO
    :0
    if (%tanks.OO00O00O) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) && ($sock(tanks. [ $+ [ %tanks.OO00O00O ] ] )) iline %tanks.O0O0OO00 3 %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] $sock(tanks. [ $+ [ %tanks.OO00O00O ] ] ).ip
      dec %tanks.OO00O00O
      goto 0
    }
  }
  .-
  .$iif($sock(tanks) && %tanks.O0OO0O00 [ $+ [ %tanks.OOO00000 ] ] > 0,Change your &vote to end this round):O0OO0O00 O000O000
  .$iif(* !iswm $sock(tanks) && %tanks.O000OO0O isin O00000OO O0000O00 O000000O,&End this round):O00OO0OO
  .$iif(* !iswm $sock(tanks) && %tanks.O000OO0O isin O00000OO O0000O00 O000000O,En&d current game):OO00O0O0
  .-
  .$iif(%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum,C&hange server name [ [ $+ [ %tanks.O0OO00O00 ] $+ ] ]):O0O0OOO0 /sname
  .$iif(%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum && %tanks.OOO00000,Change &name [ [ $+ [ %tanks.O0OO00O0 [ $+ [ %tanks.OOO00000 ] ] ] $+ ] ]):O00O00OO
  .$iif(%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum,Change &color):OO00O0OO
  .-
  .$iif($sock(tanks.*,0),&Kick user...)
  ..$iif(%tanks.O00OO0OO1 isnum,%tanks.O0OO00O01):O0OOO00O O00O00OO 1
  ..$iif(%tanks.O00OO0OO2 isnum,%tanks.O0OO00O02):O0OOO00O O00O00OO 2
  ..$iif(%tanks.O00OO0OO3 isnum,%tanks.O0OO00O03):O0OOO00O O00O00OO 3
  ..$iif(%tanks.O00OO0OO4 isnum,%tanks.O0OO00O04):O0OOO00O O00O00OO 4
  ..$iif(%tanks.O00OO0OO5 isnum,%tanks.O0OO00O05):O0OOO00O O00O00OO 5
  ..$iif(%tanks.O00OO0OO6 isnum,%tanks.O0OO00O06):O0OOO00O O00O00OO 6
  ..$iif(%tanks.O00OO0OO7 isnum,%tanks.O0OO00O07):O0OOO00O O00O00OO 7
  ..$iif(%tanks.O00OO0OO8 isnum,%tanks.O0OO00O08):O0OOO00O O00O00OO 8
  ..$iif(%tanks.O00OO0OO9 isnum,%tanks.O0OO00O09):O0OOO00O O00O00OO 9
  ..$iif(%tanks.O00OO0OO10 isnum,%tanks.O0OO00O010):O0OOO00O O00O00OO 10
  ..$iif(%tanks.O00OO0OO11 isnum,%tanks.O0OO00O011):O0OOO00O O00O00OO 11
  ..$iif(%tanks.O00OO0OO12 isnum,%tanks.O0OO00O012):O0OOO00O O00O00OO 12
  ..$iif(%tanks.O00OO0OO13 isnum,%tanks.O0OO00O013):O0OOO00O O00O00OO 13
  ..$iif(%tanks.O00OO0OO14 isnum,%tanks.O0OO00O014):O0OOO00O O00O00OO 14
  ..$iif(%tanks.O00OO0OO15 isnum,%tanks.O0OO00O015):O0OOO00O O00O00OO 15
  ..$iif(%tanks.O00OO0OO16 isnum,%tanks.O0OO00O016):O0OOO00O O00O00OO 16
  ..$iif(%tanks.O00OO0OO17 isnum,%tanks.O0OO00O017):O0OOO00O O00O00OO 17
  ..$iif(%tanks.O00OO0OO18 isnum,%tanks.O0OO00O018):O0OOO00O O00O00OO 18
  ..$iif(%tanks.O00OO0OO19 isnum,%tanks.O0OO00O019):O0OOO00O O00O00OO 19
  ..$iif(%tanks.O00OO0OO20 isnum,%tanks.O0OO00O020):O0OOO00O O00O00OO 20
  ..$iif(%tanks.O00OO0OO21 isnum,%tanks.O0OO00O021):O0OOO00O O00O00OO 21
  ..$iif(%tanks.O00OO0OO22 isnum,%tanks.O0OO00O022):O0OOO00O O00O00OO 22
  ..$iif(%tanks.O00OO0OO23 isnum,%tanks.O0OO00O023):O0OOO00O O00O00OO 23
  ..$iif(%tanks.O00OO0OO24 isnum,%tanks.O0OO00O024):O0OOO00O O00O00OO 24
  ..$iif(%tanks.O00OO0OO25 isnum,%tanks.O0OO00O025):O0OOO00O O00O00OO 25
  ..$iif(%tanks.O00OO0OO26 isnum,%tanks.O0OO00O026):O0OOO00O O00O00OO 26
  ..$iif(%tanks.O00OO0OO27 isnum,%tanks.O0OO00O027):O0OOO00O O00O00OO 27
  ..$iif(%tanks.O00OO0OO28 isnum,%tanks.O0OO00O028):O0OOO00O O00O00OO 28
  ..$iif(%tanks.O00OO0OO29 isnum,%tanks.O0OO00O029):O0OOO00O O00O00OO 29
  ..$iif(%tanks.O00OO0OO30 isnum,%tanks.O0OO00O030):O0OOO00O O00O00OO 30
  ..$iif(%tanks.O00OO0OO31 isnum,%tanks.O0OO00O031):O0OOO00O O00O00OO 31
  ..$iif(%tanks.O00OO0OO32 isnum,%tanks.O0OO00O032):O0OOO00O O00O00OO 32
  .$iif($sock(tanks.*,0),Edit &ban list):{
    if ($dialog(tanksban)) dialog -ev tanksban
    else dialog $iif(%tanksontop,-dmo,-dm) tanksban tanksban
  }
  Syst&em
  .$OO00OOOO(-,%tanksforget) &Remember increment setting between rounds:%tanksforget = $iif(%tanksforget,0,1)
  .-
  .$OO00OOOO(-,%tanksnosound) &Play sounds:%tanksnosound = $iif(%tanksnosound,0,1)
  .-
  .$OO00OOOO(%tanks.O0O000O0) &Fast mode:%tanks.O0O000O0 = $iif(%tanks.O0O000O0,0,1) | %tanksfast = %tanks.O0O000O0 | .timertanks.OO000OOO -e
  .-
  .$OO00OOOO(%tankstahoma,Use the &Tahoma font):O0OO0OO0 $iif(%tankstahoma,0,1)
  .$iif($sock(tanks),$OO00OOOO(%tanksnochat,Disable &chat text && player names)):O0OOO0OO $iif(%tanksnochat,0,1)
  .$OO00OOOO(%tankslog) &Log chat to tanks.log:%tankslog = $iif(%tankslog,0,1)
  .-
  .$OO00OOOO(%tanksnoctcp,&Disable Tanks ctcp reply):%tanksnoctcp = $iif(%tanksnoctcp,0,1)
  .$OO00OOOO(%tanksnolisten,&Ignore all Tanks requests):%tanksnolisten = $iif(%tanksnolisten,0,1)
  .-
  .$OO00OOOO(-,%tanksnomenu) Show Tanks &menu in query, nicklist, and menubar:%tanksnomenu = $iif(%tanksnomenu,0,1)
  Win&dow
  .$OO00OOOO($iif(%tankstitle & 1,1)) Show in titlebar $+ $chr(58)  &Round:%tankstitle = $iif(%tankstitle & 1,$bitoff(%tankstitle,1),$biton(%tankstitle,1)) | OOO000O0
  .$OO00OOOO($iif(%tankstitle & 2,1)) Show in titlebar $+ $chr(58)  &Frags:%tankstitle = $iif(%tankstitle & 2,$bitoff(%tankstitle,2),$biton(%tankstitle,2)) | OOO000O0
  .$OO00OOOO($iif(%tankstitle & 4,1)) Show in titlebar $+ $chr(58)  &Accuracy:%tankstitle = $iif(%tankstitle & 4,$bitoff(%tankstitle,3),$biton(%tankstitle,3)) | OOO000O0
  .$OO00OOOO($iif(%tankstitle & 8,1)) Show in titlebar $+ $chr(58)  &Server name:%tankstitle = $iif(%tankstitle & 8,$bitoff(%tankstitle,4),$biton(%tankstitle,4)) | OOO000O0
  .-
  .$OO00OOOO(-,%tanksnopop) &Un-minimize on your turn:%tanksnopop = $iif(%tanksnopop,0,1)
  .$OO00OOOO(%tanksontop) &Window on top:%tanksontop = $iif(%tanksontop,0,1) | OO0000O0 @Tanks
  .$OO00OOOO(-,%tanksnoxy) R&emember window position:%tanksnoxy = $iif(%tanksnoxy,0,1)
  .-
  .$iif($sock(tanks.*,0) && $version != 6.02,Hi&de this window):window -h @Tanks
  -
  Versio&n:abouttanks
  &Readme:tanksreadme
  -
  Ser&ver list:tanklist
}
alias -l O00O0O00 {
  if ($sock(tanks.*,0)) && (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] !isnum 0-4) {
    var %tanks.O0O00OO0 = tanks. $+ %tanks.OOO00O00
    if ($1 == 0) && (* !iswm $sock(%tanks.O0O00OO0)) || ($1 !isnum) .timertanks.O00O0O00 -o 1 $iif(%tanks.OO0O0O00 & 1,20,40) O00O0O00 %tanks.OOO00O00
    elseif ($1 == 0) {
      %tanks.O00OO00O [ $+ [ %tanks.OOO00O00 ] ] = 0
      O00OO0O0 %tanks.OOO00O00 O00O0O0O
      .timertanks.O00O0O00 -o 1 $iif($sock(%tanks.O0O00OO0),30,0) O00O0O00 %tanks.OOO00O00 1
    }
    elseif ($1 == %tanks.OOO00O00) && (%tanks.O000OO0O isin O00000OO O000000O) && (%tanks.O00OO0OO [ $+ [ $1 ] ] isnum) {
      if ($2) {
        O0OOO00O O00O00OO %tanks.OOO00O00 (Ping timeout)
        return
      }
      if (* !iswm $sock(%tanks.O0O00OO0)) {
        var %tanks.OO0O000O = 1, %tanks.OOO0O00O = 0
        while ($gettok(%tanks.O00O000O,%tanks.OO0O000O,32)) {
          if (%tanks.OO000O00 [ $+ [ $gettok(%tanks.O00O000O,%tanks.OO0O000O,32) ] ] !isnum) inc %tanks.OOO0O00O
          inc %tanks.OO0O000O
        }
        if (%tanks.OOO0O00O == 0) return
      }
      elseif (%tanks.O00OO00O [ $+ [ $1 ] ] != 1) {
        .timertanks.O00O0O00 -o 1 30 O00O0O00 $1 1
        return
      }
      inc %tanks.O000000O [ $+ [ $1 ] ] 2
      if (%tanks.O000000O [ $+ [ $1 ] ] > 3) {
        unset %tanks.O000000O [ $+ [ $1 ] ]
        O0OOO00O O00O00OO $1 (Idle three times)
        return
      }
      var %tanks.O00OOOOO = $1 $1 Server $iif($sock(%tanks.O0O00OO0),sent fire request to   ,forced    to fire) ( $+ $iif(%tanks.OO0O0O00 & 1,20,40) seconds idle)
      O0OO0O00 O0000OOO %tanks.O00OOOOO
      O000O0OO O0000000 %tanks.O00OOOOO
      if ($sock(%tanks.O0O00OO0)) {
        O00OO0O0 $1 O00O000O
        .timertanks.O00O0O00 -o 1 15 O00O0O00 $1 1
      }
      else OOO0O0OO
    }
  }
}
alias -l OOO00000 {
  var %tanks.O00OOOOO = %tanks.OO0O0O00 %tanks.OO00OOOO %tanks.OO0000O0 %tanks.OOO0OO00 %tanks.O000O000 %tanks.OOO0O000 %tanks.OOO00O00 %tanks.OO00000O
  if ($1) O00OO0O0 $1 O000O0O0 %tanks.O00OOOOO
  else O0OO0O00 O000O0O0 %tanks.O00OOOOO
}
alias -l O0O0O0O0 {
  if ($window($OO0OOO00)) {
    window $OO0OOO00 $calc($mouse.dx -$1) $calc($mouse.dy -$2)
    if ($mouse.key & 1) .timertanks.OO0OOO00 -o 1 0 O0O0O0O0 $1-
  }
}
alias -l OOO00OOO {
  if (%tanksnosound) return
  !.splay " $+ $scriptdir $+ tanks $+ $1 $+ .wav"
}
alias -l OOO00O0O {
  if ($mouse.key & 2) || ($mouse.key & 4) && ($istok(O000O0O0 O000OO0O O000000O O0000OOO,$1,32)) return $1 $iif(%tanksinc == 1,5,1)
  return $1 %tanksinc
}
alias tanksreadme {
  var %tanks.O000OOOO = $scriptdir $+ tanks.txt
  if ($isfile(%tanks.O000OOOO)) run " $+ %tanks.O000OOOO $+ "
  else run http://pages.cthome.net/pdufilie/irc/tanks.txt
}
alias -l O0OOOOO0 {
  if ($dialog(abouttanks)) did -o abouttanks 2 1 $gettok($1-,1,124)
  elseif ($deltok($1-,1,124)) OO000O00 $ifmatch
}
alias -l OOO0O0OO2 {
  var %tanks.O00OOOOO = $6, %tanks.OOO0O00O = 10
  :3
  inc %tanks.O00OOOOO .0935
  var %tanks.O0000OO0 = $round($calc($1 +%tanks.O00OOOOO *($4 +$3 *%tanks.O00OOOOO)),0)
  if (%tanks.O0000OO0 < 1) var %tanks.O00OOO0O = 1
  elseif (%tanks.O0000OO0 > %tankswidth) var %tanks.O00OOO0O = %tankswidth
  else var %tanks.O00OOO0O = %tanks.O0000OO0
  var %tanks.O0000000 = $round($calc($2 -%tanks.O00OOOOO *($5 -4.915*%tanks.O00OOOOO)),0)
  if (%tanks.O0000000 < 0) %tanks.O0000000 = 0
  elseif (%tanks.O0000000 > %tanks.OO0O00O0) %tanks.O0000000 = %tanks.OO0O00O0
  if (%tanks.O0000000 < %tanks.OO000OO0) goto 0
  if (%tanks.O0000000 >= %tanks.OO0O00O0) goto 1
  if ($calc(1+%tanks.O0000000) >= $line(@tanksO0000O00,%tanks.O00OOO0O)) goto 1
  var %tanks.OO0O000O = 1
  while (1) {
    var %tanks.OO00O00O = $gettok(%tanks.O00O000O,%tanks.OO0O000O,32)
    if (%tanks.OO00O00O) && (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) {
      if ($inrect(%tanks.O00OOO0O,%tanks.O0000000,$calc(%tanks.OOO000O0 [ $+ [ %tanks.OO00O00O ] ] -7),$calc(%tanks.OO00O0O0 [ $+ [ %tanks.OO00O00O ] ] -9),15,10)) goto 1
      inc %tanks.OO0O000O
    }
    else break
  }
  :0
  dec %tanks.OOO0O00O
  if (%tanks.OOO0O00O) goto 3
  .timertanks.OOO0O0OO2 -o 1 0 OOO0O0OO2 $1-5 %tanks.O00OOOOO
  return
  :1
  OOO0O0OO3 $1-5 $calc(%tanks.O00OOOOO -.0935) %tanks.O0000OO0 %tanks.O0000000
}
alias -l OOO0OOOO return " $+ $scriptdir $+ tanks.exe"
on *:sockopen:downloadtanks:{
  if ($sockerr) {
    O0OOOOO0 Connection error $sockerr |Connection error ( $+ $sockerr $+ ) when downloading Tanks
    close -@ $OO0OOO00
    return
  }
  write -c $OOO0OOOO
  sockmark $sockname 1 0
  sockwrite -n $sockname GET /pdufilie/irc/tanks.exe HTTP/1.0
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: pages.cthome.net
  sockwrite -n $sockname
}
alias -l OO00O000 {
  if ($appactive) && ($active == @Tanks) return
  if (%tanks.OOO00000) && (* !iswm $sock(tanks.0)) {
    flash @Tanks
    window $iif($1,-g1,-g3) @Tanks
  }
}
alias -l O0OOO0OO {
  if ($1 !isnum 0-1) return
  %tanksnochat = $1
  if ($1) {
    OO0000OO $OO0O0O00
    O0OOO000
    drawdot @Tanks
    OOO000O0
  }
  else O0OO0O00 O00O0OOO
}
alias -l O000OOOO .timertanks $+ $rand(0,999999) $+ $ticks -o 1 0 $1-
alias tankscheck {
  $OOO0000O
  O0OOOOO0
  if ($sock(tanksversion).name) return
  O0OOOOO0 Checking...
  sockopen tanksversion pages.cthome.net 80
}
alias -l O0O00O00 {
  var %tanks.O0O00O0O, %tanks.OO00O00O = $1, %tanks.OO0O000O = $2, %tanks.O0O000OO = $3, %tanks.O00OOO0O = $line(@tanksO0000000,0)
  while (%tanks.O00OOO0O) {
    tokenize 32 $line(@tanksO0000000,%tanks.O00OOO0O)
    var %tanks.OOO00OO0 = $iif($right($1,-1),(banned))
    if (n isin $1) && ($2 iswm %tanks.O0O000OO) {
      %tanks.O0O00O0O = 1
      if (%tanks.OOO00OO0) && ($3) %tanks.O0O00O0O = $iif($3 iswm %tanks.OO0O000O,1)
    }
    elseif (m isin $1) && ($2 iswm %tanks.OO0O000O) && (%tanks.OO00O00O) sockmark tanks. $+ %tanks.OO00O00O 1
    elseif (n !isin $1) && ($2 iswm %tanks.OO0O000O) %tanks.O0O00O0O = 1
    if (%tanks.O0O00O0O) && (%tanks.OO00O00O) O0OOO00O $iif(%tanks.OOO00OO0 || $4,O00O00OO) %tanks.OO00O00O %tanks.OOO00OO0
    else {
      dec %tanks.O00OOO0O
      continue
    }
    return return
  }
}
alias -l OOO0OOO0 {
  did $iif($sock(tanks),-b,-e) tanksserver 105,106,9,10,11,12
  did $iif(%tanksmode & 1,-c,-u) tanksserver 4
  did $iif(%tankslimitmode,-c,-u) tanksserver 5
  did $iif($did(tanksserver,5).state,-e,-b) tanksserver 6,7
  did -o tanksserver 6 1  frag limit
  did -o tanksserver 6 2  round limit
  did -c tanksserver 6 $iif(%tankslimitmode == 2,2,1)
  did -o tanksserver 7 1 %tankslimit
  did -o tanksserver 8 1  No wind
  did -o tanksserver 8 2  Constant wind
  did -o tanksserver 8 3  Changing wind
  did -c tanksserver 8 $calc(1+%tankscwind)
  did -o tanksserver 9 1 %tanksplayerlimit
  did $iif(%tanksonecon,-u,-c) tanksserver 12
}
alias abouttanks {
  if ($dialog(abouttanks)) {
    dialog -ev abouttanks
    return
  }
  dialog $iif(%tanksontop,-dmo,-dm) abouttanks abouttanks
}
alias -l O000O000 return  $+ $colour(h) $+ $1- $+ 
alias -l OO00O0O0 {
  if ($sock(tanks.*,0)) O0OO0O00 O00O00O0
  if (%tanks.O000OO0O != O0000O0O) unset %tanks.O000OO0O
  .timertanks.OO0OOOO0 off
  .timertanks.OOO0O0OO2 off
  O0000OO0 0
  if (%tanks.OOO00000 != 0) O00O0OOO
}
alias -l O00000OO if (%tanks.OOO000O0 [ $+ [ $1 ] ] ) drawtext -brn @Tanks $2 %tanks.OO000000 fixedsys 20 $calc(%tanks.OOO000O0 [ $+ [ $1 ] ] -$iif(%tanks.OOO000O0 [ $+ [ $1 ] ] > $calc(%tankswidth /2),0,1)-(5*$len($3))) %tanks.OO000OO0 $iif(%tanks.O00OO0OO [ $+ [ $1 ] ] isnum,$3, )
on *:connect:%tanksctime = $ctime
on *:dialog:tankschat:sclick:*:{
  if ($did == 1) did -f $dname 2
  elseif ($did == 3) && (* iswm %tanks.OO00O000) {
    var %tanks.O00OOO0O, %tanks.O0O000OO, %tanks.OO00O00O, %tanks.O0OO0000
    while (1) {
      %tanks.O00OOO0O = $did($dname,1,1).sel
      if (%tanks.O00OOO0O) {
        %tanks.OO00O00O = $gettok(%tanks.OO00O000,%tanks.O00OOO0O,32)
        %tanks.O0O000OO = $addtok(%tanks.O0O000OO,%tanks.OO00O00O,44)
        did -uk $dname 1 %tanks.O00OOO0O
      }
      else break
    }
    %tanks.O0O00000 = %tanks.O0O000OO
    unset %tanks.OO00O000
  }
}
dialog tanksmsg {
  title "Tanks - Send a private message."
  option dbu
  size -1 -1 141 89
  text "Send to:"4,4 20 25 7
  list 1,27 19 88 66,hsbarvsbarsizextsel
  edit ""2,4 4 104 11, autohs result limit 200
  button "&Send" 3,112 4 25 11, ok
}
alias -l O000O0O0 {
  var %tanks.O0OOO0O0 = $1 - $3, %tanks.O000OO00 = $2 - $4, %tanks.O00OOO0O = $3, %tanks.O0000O00 = $4, %tanks.OOO0O00O = $5, %tanks.OO00O00O
  tokenize 32 $gettok(%tanks.O00O000O, [ [ $calc(1+%tanks.O00O00OO) ] $+ ] -,32)
  if (%tanks.O0000O00 < %tanks.OO0O00O0) {
    tokenize 32 %tanks.O00O000O
    var %tanks.O00OOOOO = a
    while (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) {
      if ($calc((%tanks.OOO000O0 [ $+ [ $1 ] ] -%tanks.O00OOO0O)^2+(%tanks.OO00O0O0 [ $+ [ $1 ] ] -%tanks.O0000O00)^2) < %tanks.O00OOOOO) {
        %tanks.O00OOOOO = $ifmatch
        if (%tanks.O00OOOOO < 1600) %tanks.OO00O00O = $1
      }
      tokenize 32 $2-
    }
  }
  elseif (%tanks.O00OO0OO [ $+ [ $1 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,2,315,158,13)) %tanks.OO00O00O = $1
  elseif (%tanks.O00OO0OO [ $+ [ $2 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $2 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,160,315,158,13)) %tanks.OO00O00O = $2
  elseif (%tanks.O00OO0OO [ $+ [ $3 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $3 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,2,328,158,13)) %tanks.OO00O00O = $3
  elseif (%tanks.O00OO0OO [ $+ [ $4 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $4 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,160,328,158,13)) %tanks.OO00O00O = $4
  elseif (%tanks.O00OO0OO [ $+ [ $5 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $5 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,2,341,158,13)) %tanks.OO00O00O = $5
  elseif (%tanks.O00OO0OO [ $+ [ $6 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $6 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,160,341,158,13)) %tanks.OO00O00O = $6
  elseif (%tanks.O00OO0OO [ $+ [ $7 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $7 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,2,354,158,13)) %tanks.OO00O00O = $7
  elseif (%tanks.O00OO0OO [ $+ [ $8 ] ] isnum) && (%tanks.O0OO0O00 [ $+ [ $8 ] ] > 0) && ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,160,354,158,13)) %tanks.OO00O00O = $8
  if (%tanks.OO00O00O) && (%tanks.OOO0O00O == 0) O00OO00O %tanks.OO00O00O
  if ($window(@Tank info)) || ($dialog(tanksbots).active) || ($dialog(tanksserver).active) || ($dialog(abouttanks).active) || ($dialog(tankschat).active) || ($dialog(tanklist).active) || ($dialog(tanksban).active) || (%tanks.OO00O00O !isnum) && ($version != 6.02) window -h @tanksO00000OO
  if (%tanks.OO00O00O !isnum) || (%tanks.OOO0O00O == 0) {
    unset %tanks.O00OOO00
    if (%tanks.OOO0O00O == 0) close -@ @Tanks color
    return
  }
  if ($version == 6.02) || (%tanks.OO00O00O == %tanks.O00OOO00) || ($window(@Tank info)) return
  %tanks.O00OOO00 = %tanks.OO00O00O
  var %tanks.O0O000OO = %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] , %tanks.O0O0OO00 = $calc(7+$width(%tanks.O0O000OO,%tankschat.O00000O0,%tankschat.O0000OO0,0,0)), %tanks.OOO0O0O0 = $iif(%tanks.OO0O0O00 & 1,17,23), %tanks.O00OOO0O0 = 3
  if (%tanks.O0O0OO00 < 37) && (%tanks.OOO0O0O0 > 17) var %tanks.O00OOO0O0 = $int($calc(3 + (37 - %tanks.O0O0OO00) / 2)), %tanks.O0O0OO00 = 37
  var %tanks.O00OOO0O = $int($calc(%tanks.O0OOO0O0 + %tanks.OOO000O0 [ $+ [ %tanks.OO00O00O ] ] - %tanks.O0O0OO00 / 2)), %tanks.O0000O00 = $calc(%tanks.O000OO00 + %tanks.OO00O0O0 [ $+ [ %tanks.OO00O00O ] ] - $iif(%tanks.OOO0O0O0 > 17,41,36))
  if (%tanks.O00OOO0O < %tanks.O0OOO0O0) %tanks.O00OOO0O = %tanks.O0OOO0O0
  if ($calc(%tanks.O0OOO0O0 + %tankswidth - %tanks.O0O0OO00) < %tanks.O00OOO0O) %tanks.O00OOO0O = $ifmatch
  window @tanksO00000OO -1 -1 %tanks.O0O0OO00 %tanks.OOO0O0O0
  drawrect -rf @tanksO00000OO %tanks.OO000000 1 0 0 %tanks.O0O0OO00 %tanks.OOO0O0O0
  window -o @tanksO00000OO %tanks.O00OOO0O %tanks.O0000O00 %tanks.O0O0OO00 %tanks.OOO0O0O0
  drawdot @Tanks
  drawrect -rn @tanksO00000OO %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] 1 0 0 %tanks.O0O0OO00 %tanks.OOO0O0O0
  drawtext -rn @tanksO00000OO 0 %tankschat.O0000O0O %tankschat.O0000OO0 $calc(%tanks.O00OOO0O0 +%tankstahoma) 2 %tanks.O0O000OO
  if (%tanks.OOO0O0O0 > 17) {
    if (%tanks.O00OOO00 == %tanks.OOO00O00) {
      var %tanks.OOO0O00O = 1
      tokenize 32 %tanks.O00O000O
      while (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) {
        if ($1 != %tanks.OOO00O00) if ($O00OOOOO($1) > %tanks.OOO0O00O) %tanks.OOO0O00O = $ifmatch
        tokenize 32 $2-
      }
    }
    else var %tanks.OOO0O00O = $O00OOOOO
    %tanks.OOO0O00O = $iif(%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > %tanks.OOO0O00O,%tanks.0,255)
    var %tanks.O00OOO0O = $int($calc(%tanks.O0O0OO00 /2-15))
    if (%tanks.O0OO0O00 [ $+ [ %tanks.O00OOO00 ] ] == 11) {
      drawrect -rnf @tanksO00000OO %tanks.OOO0O00O 1 %tanks.O00OOO0O 16 31 4
      drawrect -rn @tanksO00000OO %tanks.1 1 %tanks.O00OOO0O 16 31 4
    }
    else {
      drawrect -rnf @tanksO00000OO %tanks.O0OO000O 1 %tanks.O00OOO0O 16 31 4
      drawrect -rnf @tanksO00000OO %tanks.OOO0O00O 1 %tanks.O00OOO0O 16 $calc(%tanks.O0OO0O00 [ $+ [ %tanks.O00OOO00 ] ] *3) 4
      drawpic -cnt @tanksO00000OO 16711935 %tanks.O00OOO0O 16 120 76 31 4 %tanksbmp
      drawfill -srn @tanksO00000OO %tanks.1 16777215 %tanks.O00OOO0O 16
    }
  }
  drawdot @tanksO00000OO
}
alias -l O000OO0O {
  if (%tanks.O000OO0O !isin O00000OO O0000O00 O000000O) return
  drawrect -rfn @Tanks %tanks.OO000000 1 0 0 %tankswidth %tanks.OO000OO0
  if (%tanks.OO00OOOO == 0) return
  var %tanks.OO0OO0O0 =   $iif(%tanks.OO00OOOO == 2,Changing wind:,Wind:) $abs(%tanks.OO00000O)  , %tanks.OO000OOO = $int($calc(%tankswidth /2)), %tanks.O00OOO0O = $int($calc(.5+(100+%tanks.OO00000O)/100*%tanks.OO000OOO))
  if (%tanks.OO00000O < 0) drawtext -rn @Tanks %tanks.OO000O0O Fixedsys 15 %tanks.OO000OOO 4 %tanks.OO0OO0O0
  if (%tanks.OO00000O > 0) drawtext -rn @Tanks %tanks.OO000O0O Fixedsys 15 $calc(%tanks.OO000OOO -$width(%tanks.OO0OO0O0,fixedsys,15,0,0)) 4 %tanks.OO0OO0O0
  if (%tanks.OO00000O) {
    drawline -rn @Tanks %tanks.OO000O0O 1 %tanks.OO000OOO 6 %tanks.OO000OOO 17
    drawline -rn @Tanks %tanks.OO000O0O 1 %tanks.OO000OOO 11 %tanks.O00OOO0O 11
    drawtext -rn @Tanks %tanks.OO000O0O Fixedsys 15 $iif(%tanks.OO00000O < 0,%tanks.O00OOO0O,$calc(%tanks.O00OOO0O -7)) 4 $iif(%tanks.OO00000O < 0,<,>)
  }
}
on *:keydown:@tanksO0000000,@tanksO0000O0O,@tanksO0000O00,@tanksO00000OO,@tanksO000000O:*:{
  if ($target == @tanksO00000OO) unset %tanks.O00OOO00
  window -h $target
}
alias tanks.init {
  if ($version < 5.7) {
    OO000O00 $tanksversion requires mIRC v5.7 or newer - $O000O000(http://www.mirc.com/get.html)
    if ($?!="You need a newer version of mIRC to use Tanks.") O000OOOO run http://www.mirc.com/get.html
    unload -rs " $+ $script $+ "
  }
  if (%tanksnick) %tanksname = %tanksnick
  var %tanks.O000OOOO = $scriptdir $+ tanksb.bmp
  if ($isfile(%tanks.O000OOOO)) .remove " $+ %tanks.O000OOOO $+ "
  if (%tanksforget !isnum) %tanksforget = 1
  if (%tankspublic !isnum) %tankspublic = 1
  %tanks.O000OOOO = $scriptdir $+ tanks.txt
  var %tanks.O00OOOOO = $read -w"*Fixes and additions" " [ $+ [ %tanks.O000OOOO ] $+ ] "
  if (%tanks.O00OOOOO) {
    window -zBkdaC @Tanks versions -1 -1 -1 400 Fixedsys 15
    loadbuf $calc($readn - 1) $+ - $+ $calc($lines(%tanks.O000OOOO)-2) @Tanks versions " $+ %tanks.O000OOOO $+ "
  }
}
dialog abouttanks {
  title "Tanks"
  option dbu
  size -1 -1 72 77
  button "&Check for a new version"3,2 49 68 12
  button "Install &newest version"4,2 63 68 12
  edit ""1,2 2 68 17,centereadmulti
  button "&Website"99,2 21 33 12
  button "&Readme"97,37 21 33 12
  button ""98,0 0 0 0,okcancelhidden
  edit ""2,2 35 68 12,centeread
}
alias -l OO0O00OO {
  var %tanks.OO00O00O = 1
  while (1) {
    var %tanks.O0O00OO0 = tanks. $+ %tanks.OO00O00O
    if ($sock(%tanks.O0O00OO0)) || (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) inc %tanks.OO00O00O
    else break
  }
  if (%tanks.OO00O00O > %tanks.O0OOO0OO) return 1
  %tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] = 5
  if (%tanks.OOO00000 == 0) %tanks.OOO00000 = %tanks.OO00O00O
  O0O0O00O 0 5 %tanks.OO00O00O $O00O0O0O(%tankscolor) $OO000000($iif($0,$1-,%tanks.O0OO00O0 [ $+ [ %tanks.OOO00000 ] ] ),%tanks.OO00O00O)
}
alias -l O0O00000 {
  %tanks.O000O00O [ $+ [ $1 ] ] = $2
  O0OOO000
  O000O0OO O0000OOO %tanks.O0OO00O0 [ $+ [ $1 ] ] votes $iif($2,to,not to) end the round
  if ($OOO0O0O0) {
    if ($ifmatch > 1) OO00O0O0
    else O00OO0OO
  }
}
alias -l O0O0OO00 {
  if (%tanks.O000OO0O) O0O0O0OO
  var %tanks.OO00O00O = %tanks.OOO00O00 + 1, %tanks.O0OOOOOO, %tanks.O0O000OO
  while (%tanks.OO00O00O <= %tanks.O0OOO0OO) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) %tanks.O0OOOOOO = %tanks.O0OOOOOO %tanks.OO00O00O
    inc %tanks.OO00O00O
  }
  %tanks.OO00O00O = 1
  while (%tanks.OO00O00O <= %tanks.O0OOO0OO) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) %tanks.O0O000OO = %tanks.O0O000OO %tanks.OO00O00O
    inc %tanks.OO00O00O
  }
  %tanks.O0OOOOOO = %tanks.O0OOOOOO %tanks.O0O000OO %tanks.O0O000OO
  %tanks.O0O000OO = 1
  while (%tanks.O0O000OO <= $numtok(%tanks.O0OOOOOO,32)) {
    %tanks.OO00O00O = $gettok(%tanks.O0OOOOOO,%tanks.O0O000OO,32)
    if (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) && (%tanks.OO00O00O != %tanks.OOO00O00) {
      %tanks.OOO00O00 = %tanks.OO00O00O
      break
    }
    if (%tanks.OO00O00O == %tanks.OOO00O00) {
      %tanks.OOO00O00 = $gettok(%tanks.O0OOOOOO,$calc(1+%tanks.O0O000OO),32)
      break
    }
    inc %tanks.O0O000OO
  }
  var %tanks.O0O00OO0 = tanks. $+ %tanks.OOO00O00
  if (* !iswm $sock(%tanks.O0O00OO0)) && (* !iswm $sock(tanks)) {
    if (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] !isnum 0-4) %tanks.OOO00000 = %tanks.OOO00O00
  }
  if (%tanks.OO00OOOO > 1) %tanks.OO00000O = %tanks.O0O0000O
  O0000OO0 1
  O0000000 1
  tokenize 32 %tanks.O00O000O
  var %tanks.O0O000OO = 0
  while ($1) {
    if (%tanks.O0OO0O00 [ $+ [ $1 ] ] > 0) inc %tanks.O0O000OO
    tokenize 32 $2-
  }
  if (%tanks.O0O000OO > 1) O0OO0000
  if (%tanks.O0O000OO < 2) || ($OOO0O0O0) {
    if ($OOO0O0O0 > 1) OO00O0O0
    else O00OO0OO
  }
}
alias -l OOO0O0OO {
  if (* !iswm $window(@Tanks)) return
  OOO000O0 Getting ready to fire...
  O0O0O0OO
  drawdot @Tanks
  .timertanks.O00O0O00 off
  O000O00O 1
  if (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] isnum 0-4) && (* !iswm $sock(tanks)) || (%tanks.OOO00O00 == %tanks.OOO00000) && (* !iswm $1-) {
    if ($sock(tanks)) O0OO0O00 O00O0O0O
  }
  if ($sock(tanks)) {
    if (* !iswm $1-) {
      O0OO0O00 O00O000O %tanks.OOO0O000 %tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ]
      OOO000O0 Waiting for server reply...
      %tanks.O000OO0O = O00000OO
      return
    }
    if (*\ %tanks.OOO00O00 $OO0OO0OO(%tanks.OOO00O00) !iswm $1-) {
      var %tanks.O00OOOOO = $sock(tanks).ip ; %tanks.OOO00000 ; %tanks.O00O000O ; %tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] ; $ifmatch ; $1-
      sockclose tanklist
      OOO0O000 error= $+ $replace(%tanks.O00OOOOO,$chr(32),$right(.%20,3))
      O0OO0O00 O00OO0O0 Error
    }
  }
  elseif (%tanks.OOO00O00 == %tanks.OOO00000) {
    var %tanks.O00OOOOO = %tanks.O000000O [ $+ [ %tanks.OOO00O00 ] ] - 1
    %tanks.O000000O [ $+ [ %tanks.OOO00O00 ] ] = $iif(%tanks.O00OOOOO < 0,0,%tanks.O00OOOOO)
  }
  var %tanks.O0O0O0O0 = $calc(%tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] *3.14159/180)
  var %tanks.O0O0O00O = $round($calc(%tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ] $iif(%tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] > $iif(%tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ] > $calc(%tankswidth /2),89,90),-1,+1)+$cos(%tanks.O0O0O0O0)*10),0)
  var %tanks.OO0OO00O = $round($calc(%tanks.OO00O0O0 [ $+ [ %tanks.OOO00O00 ] ] -$sin(%tanks.O0O0O0O0)*9-7),0)
  var %tanks.O0O0OO00 = $calc($iif(%tanks.OO00OOOO,%tanks.OO00000O,0) / 96), %tanks.O0O00OO0 = %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ] / 1.1, %tanks.OOO0O00O = %tanks.O0O00OO0 * $cos(%tanks.O0O0O0O0), %tanks.O0O00OO0 = %tanks.O0O00OO0 * $sin(%tanks.O0O0O0O0)
  $iif($0,OOO0O0OO3,OOO0O0OO2) %tanks.O0O0O00O %tanks.OO0OO00O %tanks.O0O0OO00 %tanks.OOO0O00O %tanks.O0O00OO0 -.1 0 0 $1-
}
dialog tanksbots {
  title "Tanks bots and local players"
  size -1 -1 230 116
  option dbu
  box "Add local players", 1, 6 4 106 28
  edit "", 2, 13 14 59 12
  button "&Join", 3, 75 14 30 12
  box "Bots", 11, 6 40 106 54
  button "Skill 0", 12, 13 50 30 12
  button "Skill 1", 13, 44 50 30 12
  button "Skill 2", 14, 75 50 30 12
  button "Skill 3", 15, 13 65 30 12
  button "Skill 4", 16, 44 65 30 12
  button "R&andom", 17, 75 65 30 12
  check "Bots play on their own", 18, 13 80 64 10
  box "Bots and local players", 21, 123 4 101 90
  list 22, 130 14 54 74, size extsel vsbar
  button "&Name...", 23, 187 14 30 12
  button "&Color...", 24, 187 28 30 12
  button "&Remove", 25, 187 42 30 12
  list 20, 187 56 30 32, hide size
  text "", 100, 0 0 0 0, hide
  button "Ok", 99, 194 100 30 12, ok
}
on *:keydown:@Tanks scores:*:if (* iswm $keychar) O00O0OOO
alias -l OO00OOO0 {
  if (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] isnum 0-4) {
    %tanks.O000O0O0 [ $+ [ %tanks.OOO00O00 ] ] = $1 - %tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ]
    %tanks.O0OO0OO0 [ $+ [ %tanks.OOO00O00 ] ] = $2 - %tanks.OO00O0O0 [ $+ [ %tanks.OOO00O00 ] ]
  }
  if (%tanks.OOO0O000 == 1) var %tanks.O00OOOOO = 7 7 6 6 5 4 2
  elseif (%tanks.OOO0O000 == 2) var %tanks.O00OOOOO = 12 12 12 11 11 10 10 9 8 7 5 3
  elseif (%tanks.OOO0O000 == 3) var %tanks.O00OOOOO = 17 17 17 17 16 16 15 15 14 14 13 12 11 10 8 6 4
  elseif (%tanks.OOO0O000 == 4) var %tanks.O00OOOOO = 22 22 22 22 21 21 21 20 20 20 19 18 18 17 16 15 14 13 11 10 7 4
  else var %tanks.O00OOOOO = 27 27 27 27 27 26 26 26 25 25 25 24 24 23 22 22 21 20 19 18 17 16 14 13 11 8 5
  var %tanks.OO0O000O = 1- $+ %tankswidth, %tanks.O0OOO0O0 = $numtok(%tanks.O00OOOOO,32), %tanks.O0OOOOOO, %tanks.O0O0O00O, %tanks.O000OO00, %tanks.OO0OO00O, %tanks.O00OO000 = %tanks.OO0O00O0 - 1
  while (%tanks.O0OOO0O0) {
    %tanks.O000OO00 = $gettok(%tanks.O00OOOOO,%tanks.O0OOO0O0,32)
    %tanks.O0O0O00O = $1 + %tanks.O0OOO0O0
    if (%tanks.O0O0O00O isnum %tanks.OO0O000O) {
      %tanks.O0OOOOOO = $line(@tanksO0000O00,%tanks.O0O0O00O)
      %tanks.OO0OO00O = $2 + %tanks.O000OO00
      if (%tanks.O0OOOOOO < $calc($2 -%tanks.O000OO00)) {
        if (%tanks.OO0OO00O >= %tanks.O00OO000) %tanks.O0OOOOOO = $calc(%tanks.O00OO000 +%tanks.O0OOOOOO +%tanks.O000OO00 -$2)
        else %tanks.O0OOOOOO = $calc(%tanks.O0OOOOOO +1+2*%tanks.O000OO00)
      }
      elseif (%tanks.O0OOOOOO <= %tanks.OO0OO00O) %tanks.O0OOOOOO = 1 + %tanks.OO0OO00O
      if (%tanks.O0OOOOOO > %tanks.O00OO000) O0OOO0O0 %tanks.O0O0O00O %tanks.O00OO000
      else O0OOO0O0 %tanks.O0O0O00O %tanks.O0OOOOOO
    }
    %tanks.O0O0O00O = $1 - %tanks.O0OOO0O0
    if (%tanks.O0O0O00O isnum %tanks.OO0O000O) {
      %tanks.O0OOOOOO = $line(@tanksO0000O00,%tanks.O0O0O00O)
      %tanks.OO0OO00O = $2 + %tanks.O000OO00
      if (%tanks.O0OOOOOO < $calc($2 -%tanks.O000OO00)) {
        if (%tanks.OO0OO00O >= %tanks.O00OO000) %tanks.O0OOOOOO = $calc(%tanks.O00OO000 +%tanks.O0OOOOOO +%tanks.O000OO00 -$2)
        else %tanks.O0OOOOOO = $calc(%tanks.O0OOOOOO +1+2*%tanks.O000OO00)
      }
      elseif (%tanks.O0OOOOOO <= %tanks.OO0OO00O) %tanks.O0OOOOOO = 1 + %tanks.OO0OO00O
      if (%tanks.O0OOOOOO > %tanks.O00OO000) O0OOO0O0 %tanks.O0O0O00O %tanks.O00OO000
      else O0OOO0O0 %tanks.O0O0O00O %tanks.O0OOOOOO
    }
    dec %tanks.O0OOO0O0
  }
  if ($1 isnum %tanks.OO0O000O) {
    %tanks.O0OOOOOO = $line(@tanksO0000O00,$1)
    %tanks.OO0OO00O = $2 + %tanks.O000OO00
    if (%tanks.O0OOOOOO < $calc($2 -%tanks.O000OO00)) {
      if (%tanks.OO0OO00O >= %tanks.O00OO000) %tanks.O0OOOOOO = $calc(%tanks.O00OO000 +%tanks.O0OOOOOO +%tanks.O000OO00 -$2)
      else %tanks.O0OOOOOO = $calc(%tanks.O0OOOOOO +1+2*%tanks.O000OO00)
    }
    elseif (%tanks.O0OOOOOO <= %tanks.OO0OO00O) %tanks.O0OOOOOO = 1 + %tanks.OO0OO00O
    if (%tanks.O0OOOOOO > %tanks.O00OO000) O0OOO0O0 $1 %tanks.O00OO000
    else O0OOO0O0 $1 %tanks.O0OOOOOO
  }
  drawline -rn @Tanks %tanks.1 1 0 %tanks.OO0O00O0 %tankswidth %tanks.OO0O00O0
}
alias -l OO0OO00O {
  var %tanks.OO0O000O = $1, %tanks.O0O000OO = $2, %tanks.OO00O00O = $3, %tanks.O0O00OO0 = $4, %tanks.O00OOO0O = $5, %tanks.O000OOO0 = $6, %tanks.OOO00OO0 = $7, %tanks.O0O0OO00 = $8, %tanks.OO000OOO = $9, %tanks.O0OOOOOO = $10, %tanks.O0OOO0O0 = $11-
  if ($dialog(tanklist)) && (%tanks.O00OOO0O isnum) && (%tanks.OO00O00O isnum) {
    if (/*tanks * iswm $did(tanklist,9,$did(tanklist,9).lines)) did -az tanklist 1,9 $str(-,198)
    did -az tanklist 1   $+ $iif(%tanks.O0O00OO0,       Temp server: ,Dedicated server: ) %tanks.O0O000OO
    did -a tanklist 9 /tanks %tanks.OO0O000O %tanks.OO00O00O
    var %tanks.O00OOOOO = did -az tanklist 1 $str( ,7) Settings/info: 
    if (%tanks.OOO00OO0) %tanks.O00OOOOO = %tanks.O00OOOOO Instagib     
    %tanks.O00OOOOO = %tanks.O00OOOOO $iif(%tanks.O0O0OO00,$iif(%tanks.O0O0OO00 == 1,Constant wind,Changing wind),No wind)     
    if (%tanks.OO000OOO) %tanks.O00OOOOO = %tanks.O00OOOOO $iif(%tanks.OO000OOO == 1,Frag limit:,Round limit:) %tanks.O0OOOOOO     
    else %tanks.O00OOOOO = %tanks.O00OOOOO No limit     
    %tanks.O00OOOOO IP: %tanks.OO0O000O      Port: %tanks.OO00O00O
    did -a tanklist 9 /tanks %tanks.OO0O000O %tanks.OO00O00O
    var %tanks.OO00OO00 = 0
    tokenize 32 %tanks.O0OOO0O0
    while (1) {
      var %tanks.O00OOOOO = 1
      while (%tanks.O00OOOOO == 1) || ($width($replace($ [ $+ 1- $+ [ %tanks.O00OOOOO ] ] ,$chr(32),    ),Tahoma,$iif($version < 5.91,13,11),0,0) < 450) && (* iswm $ [ $+ [ %tanks.O00OOOOO ] ] ) {
        inc %tanks.O00OOOOO
      }
      dec %tanks.O00OOOOO
      var %tanks.O0O00OOO = $ [ $+ 1- $+ [ %tanks.O00OOOOO ] ]
      if (%tanks.OO00OO00) did -az tanklist 1 $str( ,30) $replace(%tanks.O0O00OOO,$chr(32),    )
      else did -az tanklist 1 $iif(?? iswm %tanks.O00OOO0O, ,   ) $+ $iif(?? iswm %tanks.O000OOO0, ,   ) %tanks.O00OOO0O / %tanks.O000OOO0  Players:  $replace(%tanks.O0O00OOO,$chr(32),    )
      did -a tanklist 9 /tanks %tanks.OO0O000O %tanks.OO00O00O
      if (%tanks.O00OOOOO) tokenize 32 $ [ $+ [ $calc(1+%tanks.O00OOOOO) ] $+ ] -
      inc %tanks.OO00OO00
      if ($0 !isnum 1-) break
    }
    inc %tankslistcount %tanks.O00OOO0O
    %tanks.O00OOOOO = ( $+ %tankslistcount players total)
    dialog -t tanklist Tanks servers $iif(%tankslistcount,%tanks.O00OOOOO)
  }
}
alias -l O00OOO0O {
  tokenize 32 %tanks.O0OO00OO
  var %tanks.OO00O00O, %tanks.O00OOOOO = -0.0065
  while (* !iswm %tanks.OO00O00O) || (%tanks.O00OOOOO < $7) {
    inc %tanks.O00OOOOO .75
    if (%tanks.O00OOOOO > $7) %tanks.O00OOOOO = $7
    %tanks.OO00O00O = %tanks.OO00O00O $int($calc($1 +%tanks.O00OOOOO *($3 +$5 *%tanks.O00OOOOO))) $int($calc($2 -1-%tanks.O00OOOOO *($4 -4.9*%tanks.O00OOOOO)))
  }
  drawline -rn @Tanks %tanks.OO0OO0OO 2 $1-2 %tanks.OO00O00O
  .timertanks.OO000OOO -om 1 1900 OO000OO0 4
}
alias -l O000OO00 {
  tokenize 32 $line(@tanksO0000O0O,%tankschat.O00O0000)
  if ($1 == O0000OOO) return *** $2-
  if ($1 == O00000OO) return *** $4-
  if ($istok(O00000O0 O000O0O0 O000000O O000O00O O000OO00,$1,32)) return $3-
  return *** $3-
}
alias -l OO00OOOO {
  if ($1 == -) tokenize 32 $iif($2,0,1) $3-
  if ($version < 5.9) return $iif($1,[×] ,[  ] ) $2-
  return $style($1) $2-
}
alias -l OO000OO0 {
  if ($1 == 1) {
    if (%tanks.O00OO0OO [ $+ [ $2 ] ] !isnum) && ($sock($3).ip == $4) sockclose $3
  }
  elseif ($1 == 2) {
    if ($window($2)) $3-
  }
  elseif ($1 == 3) {
    if ($window(@Tanks)) && (%tanks.O000OO0O == O0000O00) %tanks.O000OO0O = O000000O
  }
  elseif ($1 == 4) {
    OO000OOO
    if ($window(@Tanks)) drawdot @Tanks
  }
}
alias -l O0000OO0 {
  if ($window(@Tanks)) {
    OOO000O0
    O000O00O
    O000OO0O
    O0OOO000
    O0OOOO00 - $1
    OO0OOOOO
    if ($1 != 0) OOO00OO0
    else drawdot @Tanks
  }
}
alias -l O0OOO00O {
  var %tanks.OO00OO00 = O0000O0O, %tanks.O0O00OO0 = O00OO0O0
  if ($1 == O00O00OO) {
    %tanks.OO00OO00 = O0000OO0
    %tanks.O0O00OO0 = $1
    tokenize 32 $2-
  }
  if ($dialog(tanksbots)) {
    var %tanks.OO0O000O = $did(tanksbots,20).lines
    while (%tanks.OO0O000O) {
      if ($did(tanksbots,20,%tanks.OO0O000O) == $1) did -d tanksbots 20,22 %tanks.OO0O000O
      dec %tanks.OO0O000O
    }
    O0O0OO0O
  }
  if (%tanks.O00OO0OO [ $+ [ $1 ] ] isnum) && ($window(@Tanks)) {
    if ($sock(tanks. [ $+ [ $1 ] ] ).ip) %tanks.OO0000OO = (IP: $ifmatch $+ )
    else unset %tanks.OO0000OO
    O000O0OO %tanks.OO00OO00 %tanks.O00OO0OO [ $+ [ $1 ] ] %tanks.O0OO00O0 [ $+ [ $1 ] ] $2-
    var %tanks.O00OOOOO = %tanks.O0OO0O00 [ $+ [ $1 ] ] 
    %tanks.O0OO0O00 [ $+ [ $1 ] ] = 0
    OO0OOOOO
    unset %tanks.O00OO0OO [ $+ [ $1 ] ] %tanks.O0OO00O0 [ $+ [ $1 ] ] %tanks.OOO00O0O [ $+ [ $1 ] ]
    O0OOO000
    if (%tanks.O000OO0O == O00000O0) O0OOOO00
    drawpic @Tanks
    var %tanks.OO0O000O = 1
    while (%tanks.O0OO0O00 [ $+ [ $gettok(%tanks.O00O000O,%tanks.OO0O000O,32) ] ] > 0) {
      inc %tanks.OO0O000O
    }
    dec %tanks.OO0O000O
    if ($1 == %tanks.OOO00O00) && (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) {
      .timertanks.OOO0O0OO2 off
      O0O0OO00
    }
    elseif (%tanks.OO0O000O < 2) || ($OOO0O0O0) && (%tanks.O00OOOOO > 0) {
      if ($OOO0O0O0 > 1) OO00O0O0
      else O00OO0OO
    }
    if ($1 == %tanks.OOO00000) {
      if ($sock(tanks)) {
        OOO0OO0O
        return
      }
      %tanks.OOO00000 = 0
    }
    if ($sock(tanks.*,0)) {
      O0OO00O0 $1 %tanks.O0O00OO0 $1-
      O00O0000 tanks. $+ $1 %tanks.O0O00OO0 $1-
      O0OO0OOO
    }
  }
}
on *:dialog:tankschat:dclick:1:dialog -k $dname
alias -l O00OOOOO {
  var %tanks.O00OOO0O = %tanks.OOO00O00
  if ($1) %tanks.O00OOO0O = $1
  %tanks.O00OOO0O = $int($calc(%tanks.O00O0OOO [ $+ [ %tanks.O00OOO0O ] ] /25))
  if (%tanks.O00OOO0O < 1) return 1
  if (%tanks.O00OOO0O > 5) return 5
  return %tanks.O00OOO0O
}
alias -l OOO0O000 {
  var %tanks.O0O0OO00 = 0
  if ($1 isnum) {
    %tanks.O0O0OO00 = $1
    tokenize 32 $2-
    if (%tanks.O0O0OO00 > 12500) sockclose tanklist
  }
  if (%tankspublic) && ($sock(tanks.0)) || (action=list* iswm $1) || ($1 == action=remove) || (error=* iswm $1) {
    %tankslisting = $iif(action=list* iswm $1,1,0)
    if ($sock(tanklist)) .timertanks.OOO0O000 -m 1 250 OOO0O000 $calc(250+%tanks.O0O0OO00) $1-
    else {
      if ($sock(tanks.0)) tokenize 32 $1- $+ &id= $+ %tanksid
      %tankslistsend = $1- $+ &remove= $+ %tanksremove
      if (%tanksbackup) {
        socket tanklist tanks.mircscripts.org
        socket tanklist2 tanks.ileet.net
      }
      else {
        socket tanklist tanks.ileet.net
        sockclose tanklist2
      }
    }
  }
}
alias -l O0OO0O0O {
  if ($isfile($remove($OOO0OOOO,")) != $true) || ($1 > 20) {
    if ($dialog(abouttanks)) dialog -c abouttanks
    if ($dialog(tanks)) dialog -c tanks
    if ($2 != hidden) .timer -o 1 0 tanks.init
    .reload -rs " $+ $script $+ "
  }
  else .timertanks -om 1 200 O0OO0O0O $calc(1+$1) $2
}
on *:dialog:tanklist:init,sclick,dclick:*:{
  if ($devent == init) || ($did == 3) {
    %tankslisting = 1
    OOO0O000 action=list
  }
  elseif ($devent == dclick) && ($did == 1) || ($did == 2) {
    tokenize 32 $did($dname,9,$did($dname,1).sel).text
    if (http://* iswm $1) {
      dialog -i $dname
      run $1
    }
    elseif (/*tanks* iswm $1) {
      dialog -i $dname
      $right($1-,-1)
    }
    halt
  }
  elseif ($did == 1) {
    tokenize 32 $did($dname,9,$did($dname,1,1).sel)
    if (/*tanks* iswm $1) did -o $dname 5 1 $1-
    elseif (http://* iswm $1) did -o $dname 5 1 $1
    else did -r $dname 5
  }
}
alias -l O0O00O0O {
  var %tanks.OOO00OO0 = 1
  if ($1 == -) {
    %tanks.OOO00OO0 = 0
    tokenize 32 $2-
  }
  else {
    OOO00000 $1
    O00OO0O0 $1 O000O00O %tanks.OO00000O $2
  }
  var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.O0O0OO00 = 1
  while (%tanks.OO00O00O) {
    O00OO0O0 $1 O00OOO00 $calc(+%tanks.O000O00O [ $+ [ %tanks.OO00O00O ] ] ) $iif(%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] isnum,%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] ,-) %tanks.OO00O00O $OO0OO0OO(%tanks.OO00O00O)
    dec %tanks.OO00O00O
  }
  if (%tanks.OOO00OO0) {
    while (%tanks.O0O0OO00 <= %tankswidth) {
      O00OO0O0 $1 O000OO0O $line(@tanksO0000O00,%tanks.O0O0OO00) $line(@tanksO0000O00,$calc(1+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(2+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(3+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(4+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(5+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(6+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(7+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(8+%tanks.O0O0OO00)) $line(@tanksO0000O00,$calc(9+%tanks.O0O0OO00))
      inc %tanks.O0O0OO00 10
    }
  }
}
menu @Tanks request {
  mouse:O00000O0
  leave:O00000O0
  sclick:{
    var %tanks.O00OOO0O = $click(@Tanks request,$click(@Tanks request,0)).x, %tanks.O0000O00 = $click(@Tanks request,$click(@Tanks request,0)).y
    if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,16,24,39,15)) {
      close -@ @Tanks request
      OOO0OO0O
      sockopen tanks %tankstempip %tankstempport
    }
    elseif ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,64,24,31,15)) {
      close -@ @Tanks request
      O0O00OO0 decline
    }
  }
}
alias -l OOO0OO00 {
  if ($dialog(tankschat)) {
    dialog -ev tankschat
    return
  }
  if ($1) %tanks.OO00O000 = 1
  else unset %tanks.OO00O000
  if (%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum) || ($sock(tanks.*,0)) { }
  else return
  var %tanks.O00OOOOO = $left($dialog(tankschat,$replace(tankschat,chat,$iif($1,msg,chat)),@tanks),200)
  if ($1) && (* iswm %tanks.O0O00000) O0O0OOO0 /msg %tanks.O0O00000 %tanks.O00OOOOO
  else O0O0OOO0 %tanks.O00OOOOO
}
alias -l OO0OO0O0 {
  var %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      %tanks.OOO0OO0O [ $+ [ %tanks.OO00O00O ] ] = $iif(%tanks.OOO000O0 [ $+ [ %tanks.OO00O00O ] ] > $calc(%tankswidth /2),145,35)
      %tanks.O0O0OO0O [ $+ [ %tanks.OO00O00O ] ] = 45
      %tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] = 11
      %tanks.O0O0O000 [ $+ [ %tanks.OO00O00O ] ] = 100
      unset %tanks.OO0OOOOO [ $+ [ %tanks.OO00O00O ] ]
      if (%tanksforget) %tanksinc = 5
    }
    dec %tanks.OO00O00O
  }
  %tanks.OOO0O000 = 1
  OOO000O0 Drawing land...
}

alias -l O00OOOO0 {
  %tanks.OO0000O0 = 1
  tokenize 32 %tanks.O00O000O
  %tanks.OOO00O00 = $ [ $+ [ $rand(1,$0) ] ]
  var %tanks.O0O00OO0 = tanks. $+ %tanks.OOO00O00
  if (* !iswm $sock(%tanks.O0O00OO0)) && (* !iswm $sock(tanks)) {
    if (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] !isnum 0-4) %tanks.OOO00000 = %tanks.OOO00O00
  }
  while ($1) {
    OO0OO0OO $1 $OO0OO0OO
    tokenize 32 $2-
  }
  OO00000O
}
alias -l OOO0O0OO3 {
  var %tanks.O0O0O00O = $1, %tanks.OO0OO00O = $2, %tanks.O0O0OO00 = $3, %tanks.OOO0O00O = $4, %tanks.O0O00OO0 = $5, %tanks.O00OOOOO = $6, %tanks.O0000OO0 = $7, %tanks.O0000000 = $8
  var %tanks.OO0O000O = %tanks.OOO00O00 $OO0OO0OO(%tanks.OOO00O00)
  if (%tanks.OOO0O000 > 1) dec %tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] $calc(25*%tanks.OOO0O000)
  tokenize 32 $9-
  O0OOOO00 1
  OO0OOOOO
  OOO000O0
  drawdot @Tanks
  inc %tanks.O00OO0O0 [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.O0O000O0 != 1) OOO00OOO $iif(%tanks.OOO00O00 != %tanks.OOO00000,g2,g1)
  var %tanks.O0O00OOO
  if ($0) var %tanks.O0O0O00O = $1, %tanks.OO0OO00O = $2, %tanks.O0000OO0 = $3, %tanks.O0000000 = $4, %tanks.OO0OOO0O = $5, %tanks.OO0O00OO = $6, %tanks.OO0O0000 = $7-
  else {
    var %tanks.O0O00OOO, %tanks.OO0OOO0O = %tanks.O00OOOOO, %tanks.OO0O00OO = 0, %tanks.OO0O0000 = \, %tanks.O0OOO0O0 = 0, %tanks.O0O000OO = %tanks.O0OOO0OO
    while (%tanks.O0O000OO) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) {
        if (%tanks.O0OO0O00 [ $+ [ %tanks.O0O000OO ] ] > 0) {
          inc %tanks.O0OOO0O0
          if ($sqrt($calc((%tanks.OOO000O0 [ $+ [ %tanks.O0O000OO ] ] $iif(%tanks.OOO0OO0O [ $+ [ %tanks.O0O000OO ] ] > $iif(%tanks.OOO000O0 [ $+ [ %tanks.O0O000OO ] ] > $calc(%tankswidth /2),89,90),+,-) .5-%tanks.O0000OO0)^2*(.9875+.0025*%tanks.OOO0O000)+(1.2228-.0286*%tanks.OOO0O000)*(%tanks.OO00O0O0 [ $+ [ %tanks.O0O000OO ] ] -4-%tanks.O0000000)^2)) <= $calc(9.9375+5.0625*%tanks.OOO0O000)) %tanks.OO0O0000 = %tanks.O0O000OO %tanks.OO0O0000
        }
      }
      dec %tanks.O0O000OO
    }
    if (%tanks.OO00OOOO > 1) {
      %tanks.O0O0000O = $calc($rand(0,40)-20+%tanks.OO00000O)
      if (-99 > %tanks.O0O0000O) %tanks.O0O0000O = $ifmatch
      elseif (99 < %tanks.O0O0000O) %tanks.O0O0000O = $ifmatch
      O0OO0O00 O00OO0OO %tanks.O0O0000O
    }
    %tanks.O0O000OO = $numtok(%tanks.OO0O0000,32)
    while (%tanks.O0O000OO) {
      if ($gettok(%tanks.OO0O0000,%tanks.O0O000OO,32) != %tanks.OOO00O00) inc %tanks.OO0O00OO $calc(($iif(%tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] < 150,3,1)+%tanks.O0OOO0O0)*%tanks.OOO0O000)
      dec %tanks.O0O000OO
    }
    var %tanks.OO000OOO = %tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ]
    var %tanks.O00O00O0 = 1, %tanks.O00O0OO0 = 1
    %tanks.O0O000OO = %tanks.O0OOO0OO
    while (%tanks.O0O000OO) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) {
        if (%tanks.O0OO0O00 [ $+ [ %tanks.O0O000OO ] ] < %tanks.OO000OOO) %tanks.O00O00O0 = 0
        elseif (%tanks.O0OO0O00 [ $+ [ %tanks.O0O000OO ] ] > %tanks.OO000OOO) %tanks.O00O0OO0 = 0
      }
      dec %tanks.O0O000OO
    }
    if (%tanks.O00O0OO0) inc %tanks.OO0O00OO $calc(6+%tanks.O0OOO0O0)
    elseif (%tanks.O00O00O0) inc %tanks.OO0O00OO $calc(11+%tanks.O0OOO0O0)
    else inc %tanks.OO0O00OO $calc(8+%tanks.O0OOO0O0)
    if (%tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] >= 150) dec %tanks.OO0O00OO 6
    O0OO0O00 O00O000O %tanks.OOO0O000 %tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ] %tanks.O0O0O00O %tanks.OO0OO00O %tanks.O0000OO0 %tanks.O0000000 %tanks.OO0OOO0O %tanks.OO0O00OO %tanks.OO0O0000 %tanks.OO0O000O
  }
  inc %tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] %tanks.OO0O00OO
  dec %tanks.O0O0O00O
  var %tanks.O00OOO0O = %tanks.O0O0O00O - 1, %tanks.O0000O00 = %tanks.OO0OO00O - 1
  if (%tanks.O0O000O0 != 1) {
    %tanks.O0O00OOO = $ticks
    while (1) {
      drawrect -rfn @Tanks %tanks.OO000000 1 %tanks.O00OOO0O %tanks.O0000O00 3 3
      %tanks.O00OOOOO = $calc(($ticks -%tanks.O0O00OOO)/85)
      if (%tanks.O00OOOOO > %tanks.OO0OOO0O) %tanks.O00OOOOO = %tanks.OO0OOO0O
      %tanks.O00OOO0O = $round($calc(%tanks.O0O0O00O -1+%tanks.O00OOOOO *(%tanks.OOO0O00O +%tanks.O0O0OO00 *%tanks.O00OOOOO)),5)
      %tanks.O0000O00 = $round($calc(%tanks.OO0OO00O -1-%tanks.O00OOOOO *(%tanks.O0O00OO0 -4.9*%tanks.O00OOOOO)),5)
      if (%tanks.O00OOOOO < %tanks.OO0OOO0O) {
        drawpic -cnt @Tanks 16711935 %tanks.O00OOO0O %tanks.O0000O00 342 0 3 3 %tanksbmp
        drawdot @Tanks
      }
      else break
    }
  }
  if (%tanks.O0O000O0) OO000OOO
  %tanks.O0OO00OO = %tanks.O0O0O00O %tanks.OO0OO00O %tanks.OOO0O00O %tanks.O0O00OO0 %tanks.O0O0OO00 $calc(%tankswidth -1) %tanks.OO0OOO0O %tanks.O00OOO0O %tanks.O0000O00
  if (%tanks.O0O000O0) O00OOO0O
  tokenize 32 %tanks.OOO0O000 %tanks.O0000OO0 %tanks.O0000000
  var %tanks.O00OOO0O = $calc($2 -3-5*$1), %tanks.O0000O00 = $calc($3 -2-5*$1)
  tokenize 32 $gettok(347 0 15 15.120 122 25 25.312 10 35 35.312 45 45 45.312 90 55 55,$1,46)
  var %tanks.OOO0O0O0 = $4
  if ($calc(%tanks.O0000O00 +%tanks.OOO0O0O0) >= %tanks.OO0O00O0) %tanks.OOO0O0O0 = $calc(%tanks.OO0O00O0 -%tanks.O0000O00)
  drawpic -cnt @Tanks 16711935 %tanks.O00OOO0O %tanks.O0000O00 $1-3 %tanks.OOO0O0O0 %tanksbmp
  drawdot @Tanks
  if (\* iswm %tanks.OO0O0000) OOO00OOO h1
  else OOO00OOO h2
  OO00OOO0 %tanks.O0000OO0 %tanks.O0000000
  if (%tanks.O0O000O0) O00OOO0O
  inc %tanks.O0OOO00O [ $+ [ %tanks.OOO00O00 ] ] $iif(%tanks.OO0O0O00 & 1,1,%tanks.OOO0O000)
  tokenize 32 %tanks.OO0O0000
  var %tanks.O00OOO0O, %tanks.O0000O00, %tanks.O0O000OO
  while ($1 isnum) {
    if (%tanks.O0OO0O00 [ $+ [ $1 ] ] == 11) inc %tanks.O0O0O000 [ $+ [ $1 ] ] 5
    dec %tanks.O0OO0O00 [ $+ [ $1 ] ] %tanks.OOO0O000
    if (%tanks.OO0O0O00 & 1) %tanks.O0OO0O00 [ $+ [ $1 ] ] = 0
    var %tanks.OO00O00O = $calc(%tanks.O0O0O000 [ $+ [ $1 ] ] -5*%tanks.OOO0O000)
    if (%tanks.OO00O00O < 50) %tanks.OO00O00O = 50
    %tanks.O0O0O000 [ $+ [ $1 ] ] = %tanks.OO00O00O
    $iif($1 == %tanks.OOO00O00,dec,inc) %tanks.OO0OOO00 [ $+ [ %tanks.OOO00O00 ] ] $iif(%tanks.OO0O0O00 & 1,1,%tanks.OOO0O000)
    if (%tanks.O0OO0O00 [ $+ [ $1 ] ] < 1) {
      $iif($1 == %tanks.OOO00O00,dec,inc) %tanks.O0OOOO0O [ $+ [ %tanks.OOO00O00 ] ]
      if (* !iswm $sock(tanks)) {
        if ($1 == %tanks.OOO00O00) var %tanks.OO000OOO = |   tried to put the pin back in|   decided it was all too much|   fell asleep on the controls|   pushed the self-destruct button|   disintegrated|   pushed the wrong button|   saw the light|   crumbled|
        else var %tanks.OO000OOO = |   pokes     with a stick|   showed     who's boss|   pounded     into the ground|   melted    |   blew     to bits|   recycles    |
        %tanks.OO000OOO = $gettok(%tanks.OO000OOO,$rand(1,$numtok(%tanks.OO000OOO,124)),124)
        O0OO0O00 O0000OOO %tanks.OOO00O00 $1 %tanks.OO000OOO
        O000O0OO - O0000000 %tanks.OOO00O00 $1 %tanks.OO000OOO
        if (%tanks.O000O000 == 1) && (%tanks.O0OOOO0O [ $+ [ %tanks.OOO00O00 ] ] == %tanks.OOO0OO00) && ($1 != %tanks.OOO00O00) {
          var %tanks.O00OOOOO = %tanks.OOO00O00 %tanks.OOO00O00    hit the frag limit
          O0OO0O00 O0000OOO %tanks.O00OOOOO
          O000O0OO - O0000000 %tanks.O00OOOOO
        }
      }
      %tanks.OO00O00O = -20
      while (%tanks.OO00O00O <= 20) {
        %tanks.O0O000OO = %tanks.OOO000O0 [ $+ [ $1 ] ] + %tanks.OO00O00O
        if (%tanks.O0O000OO > 0) && (%tanks.O0O000OO <= %tankswidth) {
          %tanks.O00OOO0O = %tanks.O0O000OO - 1
          %tanks.O0000O00 = $line(@tanksO0000O00,%tanks.O0O000OO)
          drawline -rn @Tanks %tanks.O0000OOO 1 %tanks.O00OOO0O %tanks.O0000O00 %tanks.O00OOO0O %tanks.OO0O00O0
          if ($rand(0,1)) drawline -rn @Tanks %tanks.O00OO0OO [ $+ [ $1 ] ] 1 %tanks.O00OOO0O $calc(%tanks.O0000O00 -$rand(1,2)) %tanks.O00OOO0O %tanks.O0000O00
        }
        inc %tanks.OO00O00O
      }
    }
    tokenize 32 $2-
  }
  %tanks.OO0OOOOO [ $+ [ %tanks.OOO00O00 ] ] = %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ]
  %tanks.OOO0O000 = 1
  O000O00O
  O0O0OO00
}
on *:sockread:tanksversion:{
  var %tanks.OO0OO0O0, %tanks.O00OOOOO, %tanks.OO000OOO = $tanksversion(1)
  if ($sockerr) {
    O0OOOOO0 Error $sockerr
    return
  }
  while (1) {
    sockread %tanks.OO0OO0O0
    if ($sockbr !isnum 1-) return
    if (tanks * iswm %tanks.OO0OO0O0) {
      %tanks.O00OOOOO = $gettok(%tanks.OO0OO0O0,2,32)
      %tanks.OO0OO0O0 = $gettok(%tanks.OO0OO0O0,3,32)
      if (%tanks.OO000OOO != %tanks.O00OOOOO) {
        abouttanks
        if (%tanks.OO0OO0O0 > $version) {
          O0OOOOO0 Newest requires mIRC %tanks.OO0OO0O0
          return
        }
        O0OOOOO0 New: [ $+ %tanks.O00OOOOO $+ ]|New version of Tanks found! Download it by typing $O000O000(/downloadtanks)
      }
      else O0OOOOO0 No new version
    }
  }
}
alias -l O0OOOO0O {
  var %tanks.OOO0O00O = $O00O0O0O($2), %tanks.O0O0O0O0 = %tanks.O00OO0OO [ $+ [ $1 ] ]
  if (%tanks.OOO00O0O [ $+ [ $1 ] ] == %tanks.OOO0O00O) return
  if ($sock(tanks.*,0)) O0OO0O00 O000OOO0 $1 %tanks.OOO0O00O
  $O00OOO00($1,%tanks.OOO0O00O)
  if ($1 == %tanks.OOO00O00) O0OOOO00
  O0OOO000
  OO0O000O $1
  O000O0OO O00000OO %tanks.O0O0O0O0 %tanks.O0OO00O0 [ $+ [ $1 ] ] %tanks.O00OO0OO [ $+ [ $1 ] ]
}
alias -l OO000O00 echo $colour(i) -iat *** $1-
on *:sockread:tanklist*:{
  if ($sockname !isin tanklist2) return
  var %tanks.O00OOOOO
  if ($sockerr) return
  while (1) {
    sockread %tanks.O00OOOOO
    if ($sockbr !isnum 1-) return
    tokenize 32 %tanks.O00OOOOO
    if ($sockname == tanklist) && (* !iswm $1-) {
      sockmark $sockname
      %tankslistcount = 0
      if (%tankslisting) && ($dialog(tanklist)) did -r tanklist 1,9,5
    }
    if ($sock($sockname).mark != wait) {
      if ($sockname == tanklist) {
        if ($1- == v) {
          abouttanks
          tanklistmsg You need the newest version of Tanks.
          return
        }
        if ($1- == vv) .downloadtanks
      }
      if (ip *.*.*.* iswm $1-2) && ($sock(tanks.*,0)) %tanksip = $2
      elseif (%tankslisting) && ($dialog(tanklist)) {
        if (<* iswm $1-) {
          if ($sockname == tanklist) {
            if (%tanksbackup) {
              unset %tanksbackup
              tanklistmsg Unable to connect.
            }
            else {
              %tanksbackup = 1
              socket tanklist2 tanks.ileet.net
              socket tanklist tanks.mircscripts.org
            }
          }
          else sockclose $sockname
          return
        }
        elseif ($sockname == tanklist) {
          if (rem ?* iswm $1-) {
            did -az tanklist 1 $2-
            did -a tanklist 9 rem
          }
          elseif (http://* ?* iswm $1-) {
            did -az tanklist 1 $2-
            did -a tanklist 9 $1
          }
          elseif (/*tanks* *?	?* iswm $1-) {
            did -az tanklist 1 $deltok($2-,1,9)
            did -a tanklist 9 $gettok($1-,1,9)
          }
          else OO0OO00O $1-
        }
      }
      elseif ($sockname == tanklist) && (b? ?* iswm $1-) && ($window(@tanksO0000000)) {
        aline @tanksO0000000 $mid($1-,2)
        O0000O00
        if ($1 == bm) dline @tanksO0000000 $line(@tanksO0000000,0)
      }
    }
  }
}
alias -l O00OO0O0 {
  var %tanks.O0O00OO0 = tanks. $+ $1
  if ($sock(%tanks.O0O00OO0)) && ($1) && (%tanks.O00OO0OO [ $+ [ $1 ] ] isnum) sockwrite -tn %tanks.O0O00OO0 $2-
}
alias -l O0O0OOO0 {
  var %tanks.OO000OOO, %tanks.OO0O0OOO = $iif(%tanksnochat && $sock(tanks),0,1)
  if ($1 == /msg) && ($numtok($2,44)) && (%tanks.OO0O0OOO) {
    if (* !iswm $3) return
    %tanks.OO000OOO = 1
    var %tanks.O00OOO0O = $numtok($2,44), %tanks.O0OO0000, %tanks.OO00O00O
    while (%tanks.O00OOO0O) {
      %tanks.OO00O00O = $gettok($2,%tanks.O00OOO0O,44)
      if (* iswm %tanks.O0OO0000) %tanks.O0OO0000 = %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] $+ ,  $+ %tanks.O0OO0000
      else %tanks.O0OO0000 = %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ]
      dec %tanks.O00OOO0O
    }
    %tanks.O0O00000 = $2
    %tanks.O0OOO000 = %tanks.O0OO0000
    tokenize 32 $3-
  }
  if (/ooh* iswm $1) {
    var %tanks.OO0O00OO, %tanks.O0OOOOOO = $rand(6,16), %tanks.O00OOOOO = $2-
    while ($len(%tanks.OO0O00OO) < %tanks.O0OOOOOO) {
      %tanks.OO0O00OO = %tanks.OO0O00OO $+ $mid(oO,$rand(1,2),1)
    }
    tokenize 32 %tanks.OO0O00OO $+ $right($1,-4) %tanks.O00OOOOO
  }
  if ($1 == /xyzzy) O000O0OO O0000OOO Something happened!
  elseif ($1 == /log) {
    if (/log on == $1-) {
      %tankslog = 1
      O000O0OO O0000OOO Logging is ON
    }
    elseif (/log off == $1-) {
      %tankslog = 0
      O000O0OO O0000OOO Logging is OFF
    }
    else O000O0OO O0000OOO Logging is $iif(%tankslog,ON,OFF)
  }
  elseif ($1 == /chat) {
    if ($sock(tanks)) {
      if (/chat on == $1-) {
        O0OOO0OO 0
        O000O0OO O0000OOO Chat is ON
      }
      elseif (/chat off == $1-) {
        O0OOO0OO 1
        O000O0OO O0000OOO Chat is OFF
      }
      else O000O0OO O0000OOO Chat is $iif(%tanksnochat,OFF,ON)
    }
    else O000O0OO O0000OOO The /chat [on|off] command is only available for clients connected to a server
  }
  elseif ($1 == /color) {
    if ($2 == 0) var %tanks.O0O000OO = $gettok($remtok(%tanks.O0OOOOO0,%tanks.OOO00O0O [ $+ [ %tanks.OOO00000 ] ] ,1,32),$rand(1,$calc($numtok(%tanks.O0OOOOO0,32)-1)),32)
    else var %tanks.O0O000OO = $gettok(%tanks.O0OOOOO0,$2,32)
    if (%tanks.O0O000OO) {
      %tankscolor = %tanks.O0O000OO
      if ($sock(tanks)) O0OO0O00 O000OOO0 %tanks.O0O000OO
      else O0OOOO0O %tanks.OOO00000 %tanks.O0O000OO
    }
    else OO00O0OO
  }
  elseif ($istok(/sname /snick,$1,32)) {
    if ($sock(tanks)) %tanksserver = $2-
    else {
      var %tanks.O00OOOOO = %tanks.OOO00000
      %tanks.OOO00000 = 0
      O00O00OO $2-
      %tanks.OOO00000 = %tanks.O00OOOOO
    }
  }
  elseif ($istok(/name /nick,$1,32)) && (%tanks.OO0O0OOO) O00O00OO $2-
  elseif ($1 == /clear) {
    window -c @tanksO0000O0O
    window -hl @tanksO0000O0O
    %tankschat.O00OOO00 = 0
    %tankschat.O00OO000 = 0
    .timertanks.O000O0OO -o 1 0 return
    OOO00OO0
  }
  elseif ($1 == /vote) {
    if ($sock(tanks)) && (%tanks.O0OO0O00 [ $+ [ %tanks.OOO00000 ] ] > 0) && ($numtok(%tanks.O00O000O,32) > 1) O0OO0O00 O000O000
    elseif (* !iswm $sock(tanks)) O000O0OO O0000OOO Type /end to end the round
    else O000O0OO O0000OOO You can't vote
  }
  elseif ($1 == /port) {
    if ($2 !isnum) || ($sock(tanks.*,0) == 0) O000O0OO O0000OOO Server port is %tanksport
    else {
      if ($2 !isnum 1-65534) {
        window -n @Tanks
        tokenize 32 /port $?="Enter new server port:"
        if (* !iswm $window(@Tanks)) return
        window -a @Tanks
        if ($2 !isnum 1-65534) return
      }
      %tankssavedport = $2
      if (%tanksport == $2) return
      %tanksport = $2
      O0OO0O00 O00OO000 %tanksport
      OO00O00O
    }
  }
  elseif ($1 == /end) && (* !iswm $sock(tanks)) {
    if (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) O00OO0OO
  }
  elseif ($1 == /bot) || ($1 == /skill) && (* !iswm $sock(tanks)) {
    if ($OOO000OO($2)) O000O0OO O0000OOO The game is full
  }
  elseif ($1 == /nobots) || ($1 == /nobot) && (* !iswm $sock(tanks)) {
    var %tanks.O0O000OO = 1
    while (%tanks.O0O000OO <= %tanks.O0OOO0OO) {
      if (%tanks.OO000O00 [ $+ [ %tanks.O0O000OO ] ] isnum 0-4) O0OOO00O %tanks.O0O000OO
      inc %tanks.O0O000OO
    }
  }
  elseif ($1 == /join) && (* !iswm $sock(tanks)) {
    if ($OO0O00OO($iif($0 > 1,$2-,%tanksname))) O000O0OO O0000OOO The game is full
  }
  elseif ($istok(/bot /nobots /end /join,$1,32)) O000O0OO O0000OOO Only the server can use the $1 command
  elseif ($1 == /ping) O0OO0O00 O00000O0 $ctime
  elseif ($istok(/list /tanklist /tankslist,$1,32)) tanklist
  elseif ($1 == /quit) {
    if ($sock(tanks)) O0OO0O00 O00OO0O0
    elseif (%tanks.OOO00000 != 0) O0OOO00O %tanks.OOO00000
    else O000O0OO O0000OOO Use /exit to close Tanks
  }
  elseif ($1 == /exit) O0000O0O
  elseif ($istok(/help /about /readme,$1,32)) tanksreadme
  elseif (%tanks.OO000OOO) && ($0) {
    var %tanks.O0O000OO, %tanks.O0O00OO0 = %tanks.O0OOO0OO
    while (%tanks.O0O00OO0 >= 0) {
      if ($istok(%tanks.O0O00000,%tanks.O0O00OO0,44)) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O00OO0 ] ] isnum) {
        %tanks.O0O000OO = 1
        if (* !iswm $sock(tanks)) O00OO0O0 %tanks.O0O00OO0 O000O0OO %tanks.OOO00000 $1-
      }
      dec %tanks.O0O00OO0
    }
    if (%tanks.O0O000OO) {
      O000O0OO O000O00O %tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] %tanks.O0OOO000 $1-
      if ($sock(tanks)) O0OO0O00 O000O0OO %tanks.O0O00000 $1-
    }
  }
  elseif ($0) && (%tanks.OO000OOO != 1) && (%tanks.OO0O0OOO) {
    if ($sock(tanks)) O0OO0O00 O0000O00 $1-
    else O0OO0O00 O0000O00 %tanks.OOO00000 $1-
    O000O0OO O000000O %tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] %tanks.O0OO00O0 [ $+ [ %tanks.OOO00000 ] ] $1-
  }
}
alias -l OO00O00O {
  if ($1) inc %tanksport
  sockclose tanks.0
  .timertanks.OO00O00O -o 1 0 OO00O00O $calc(1+$1) $2
  socklisten tanks.0 %tanksport
  .timertanks.OO00O00O off
  O0OO0OOO
  if ($1) && ($version < 6.14) {
    O000O0OO O0000OOO Please ignore mIRC's error message. Tanks was testing the port and it was unavailable.
    O000O0OO O0000OOO Server running on port %tanksport
  }
  if ($2) return
  O000O0OO O0000OOO Server port has been changed to %tanksport
  :error
  if ($version >= 6.14) reseterror
}
alias -l O0000O00 {
  tokenize 32 %tanks.O00O000O
  var %tanks.OO0O00OO = $1-
  while ($1) {
    var %tanks.OO0O000O = $iif(%tanks.OO000O00 [ $+ [ $1 ] ] isnum,127.0.0.1,$sock(tanks. [ $+ [ $1 ] ] ).ip)
    if (%tanks.OO0O000O) O0O00O00 $1 %tanks.OO0O000O %tanks.O0OO00O0 [ $+ [ $1 ] ]
    tokenize 32 $2-
  }
  if (%tanks.OO0O00OO != %tanks.O00O000O) O0OO0OOO
}
alias tanksd {
  .timer_tanksd -o 1 0 return
  tanks $calc(+$1)
}
alias -l OO00000O {
  .timertanks.OO000OOO -e
  unset %tanks.O000O00O* %tanks.OO0OOOOO*
  if (%tanks.O000OO0O == O0000O0O) return
  unset %tanks.O000OO0O
  var %tanks.O00OOO0O = 0, %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) inc %tanks.O00OOO0O
    dec %tanks.OO00O00O
  }
  if (%tanks.O00OOO0O < 2) {
    OO00O0O0
    return
  }
  if ($sock(tanks)) {
    %tanks.O000OO0O = O0000O0O
    return
  }
  var %tanks.O0O000OO = %tanks.O0OOO0OO, %tanks.OO0OO0O0, %tanks.OO00O00O = $calc(300+25*%tanks.O00OOO0O)
  if (%tanks.OO0O0O00 & 1) %tanks.OO00O00O = 0
  while (%tanks.O0O000OO) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) {
      %tanks.O00OO00O [ $+ [ %tanks.O0O000OO ] ] = 0
      %tanks.O00O0OOO [ $+ [ %tanks.O0O000OO ] ] = %tanks.OO00O00O
      if (%tanks.O000O000 == 1) && (%tanks.O0OOOO0O [ $+ [ %tanks.O0O000OO ] ] >= %tanks.OOO0OO00) %tanks.OO0OO0O0 = 1
      elseif (%tanks.O000O000 == 2) && (%tanks.OO0000O0 > %tanks.OOO0OO00) %tanks.OO0OO0O0 = 1
    }
    dec %tanks.O0O000OO
  }
  if (%tanks.OO0OO0O0) {
    unset %tanks.O00O0OOO*
    OO00O0O0
    return
  }
  %tanks.OO00000O = $calc($rand(0,198)-99)
  var %tanks.O0O00OO0, %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) %tanks.O0O00OO0 = %tanks.OO00O00O %tanks.O0O00OO0
    dec %tanks.OO00O00O
  }
  var %tanks.OO00O00O = $numtok(%tanks.O0O00OO0,32), %tanks.O0O0O0O0, %tanks.O00OOOOO = %tanks.O0O00OO0, %tanks.O0O00OO0
  while (%tanks.OO00O00O) {
    %tanks.O0O0O0O0 = $rand(1,$numtok(%tanks.O00OOOOO,32))
    %tanks.O0O00OO0 = %tanks.O0O00OO0 $gettok(%tanks.O00OOOOO,%tanks.O0O0O0O0,32)
    %tanks.O00OOOOO = $deltok(%tanks.O00OOOOO,%tanks.O0O0O0O0,32)
    dec %tanks.OO00O00O
  }
  var %tanks.OO00O00O = $numtok(%tanks.O0O00OO0,32), %tanks.O00OOO0O = $int($calc(%tankswidth / $numtok(%tanks.O0O00OO0,32))), %tanks.O0O0O0O0, %tanks.OO0O00OO = $int($calc(%tanks.O00OOO0O /4))
  if ($calc((%tanks.O00OOO0O - 17) / 2) < %tanks.OO0O00OO) %tanks.OO0O00OO = $ifmatch
  while (%tanks.OO00O00O) {
    %tanks.O0O000OO = $int($calc(%tanks.O00OOO0O * %tanks.OO00O00O - %tanks.O00OOO0O / 2 + $rand(0,%tanks.OO0O00OO) - %tanks.OO0O00OO / 2))
    if (%tanks.O0O000OO < 9) %tanks.O0O000OO = 9
    if ($calc(%tankswidth -8) <= %tanks.O0O000OO) %tanks.O0O000OO = $ifmatch
    %tanks.O0O0O0O0 = $calc(%tanks.O0O000OO -8) %tanks.O0O0O0O0
    %tanks.OOO000O0 [ $+ [ $gettok(%tanks.O0O00OO0,%tanks.OO00O00O,32) ] ] = %tanks.O0O000OO
    dec %tanks.OO00O00O
  }
  var %tanks.O0OOOOOO = 0, %tanks.O0O00O0O = $rand($calc(50+%tanks.OO000OO0),$calc(%tanks.OO0O00O0 -80)), %tanks.OO0O000O = 0, %tanks.O00OOO0O = 1, %tanks.O0000O00, %tanks.OO00O00O = 1, %tanks.O00OOOOO = $gettok(%tanks.O0O0O0O0,1,32)
  %tanks.OO00OO0O = %tanks.O0O00O0O
  OOO000O0 Generating land...
  while (%tanks.O00OOO0O <= %tankswidth) {
    if (%tanks.O00OOO0O >= %tanks.O00OOOOO) {
      if (%tanks.OO0O000O) %tanks.OO00OO0O = %tanks.OO00OO0O %tanks.O0000O00 %tanks.OO0O000O
      %tanks.OO0O000O = 0
      %tanks.O0000O00 = 0
      %tanks.O0OOOOOO = 16
      %tanks.OO00O0O0 [ $+ [ $gettok(%tanks.O0O00OO0,%tanks.OO00O00O,32) ] ] = $int(%tanks.O0O00O0O) - 1
      inc %tanks.OO00O00O
      %tanks.O00OOOOO = $gettok(%tanks.O0O0O0O0,%tanks.OO00O00O,32)
    }
    if (%tanks.OO0O000O >= %tanks.O0OOOOOO) || (%tanks.O00OOO0O == %tankswidth) {
      if (%tanks.OO0O000O) %tanks.OO00OO0O = %tanks.OO00OO0O %tanks.O0000O00 %tanks.OO0O000O
      %tanks.OO0O000O = 0
      %tanks.O0000O00 = $calc($rand(0,16)/5-1.6)
      %tanks.O0OOOOOO = $rand(12,36)
    }
    if (%tanks.O0000O00 < 0) && (%tanks.O0O00O0O <= $calc(50+%tanks.OO000OO0)) {
      if (%tanks.OO0O000O) %tanks.OO00OO0O = %tanks.OO00OO0O %tanks.O0000O00 %tanks.OO0O000O
      %tanks.OO0O000O = 0
      %tanks.O0000O00 = $calc($rand(0,8)/5)
      %tanks.O0OOOOOO = $rand(12,36)
    }
    if (%tanks.O0000O00 > 0) && (%tanks.O0O00O0O >= $calc(%tanks.OO0O00O0 -50)) {
      if (%tanks.OO0O000O) %tanks.OO00OO0O = %tanks.OO00OO0O %tanks.O0000O00 %tanks.OO0O000O
      %tanks.OO0O000O = 0
      %tanks.O0000O00 = $calc(-$rand(0,8)/5)
      %tanks.O0OOOOOO = $rand(12,36)
    }
    inc %tanks.O0O00O0O %tanks.O0000O00
    inc %tanks.OO0O000O
    inc %tanks.O00OOO0O
  }
  OOO000O0
  OO0O0O0O
  if ($sock(tanks.*,0)) {
    var %tanks.O0OO0000 = %tanks.O0OOO0OO
    while (%tanks.O0OO0000) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.O0OO0000 ] ] isnum) && (%tanks.O0OO0000 != %tanks.OOO00000) O0O00O0O %tanks.O0OO0000
      dec %tanks.O0OO0000
    }
  }
}
alias -l O0OO00O0 {
  var %tanks.O0O00OO0, %tanks.O0O000OO = %tanks.O0OOO0OO
  while (%tanks.O0O000OO) {
    %tanks.O0O00OO0 = tanks. $+ %tanks.O0O000OO
    if ($sock(%tanks.O0O00OO0)) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) && ($1 != %tanks.O0O000OO) sockwrite -tn %tanks.O0O00OO0 $2-
    dec %tanks.O0O000OO
  }
}
alias -l OOO0000O if ($sock(downloadtanks).name) || ($timer(installtanks)) return return
alias -l O000O00O {
  var %tanks.O00OOO0O = %tanks.O0OOO0OO
  while (%tanks.O00OOO0O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.O00OOO0O ] ] isnum) {
      var %tanks.OO00O00O = %tanks.O0O0OO0O [ $+ [ %tanks.O00OOO0O ] ] , %tanks.OO000OOO = %tanks.O0O0O000 [ $+ [ %tanks.O00OOO0O ] ]
      if (%tanks.OO0O0O00 & 1) %tanks.OO000OOO = 100
      if (%tanks.OO00O00O < 0) %tanks.OO00O00O = 0
      if (%tanks.OO00O00O > %tanks.OO000OOO) %tanks.OO00O00O = %tanks.OO000OOO
      %tanks.O0O0OO0O [ $+ [ %tanks.O00OOO0O ] ] = %tanks.OO00O00O
      var %tanks.OOO0O00O = %tanks.O00O0OOO [ $+ [ %tanks.O00OOO0O ] ]
      if (%tanks.OOO0O00O < 0) %tanks.OOO0O00O = 0
      if (%tanks.OOO0O00O > 999) %tanks.OOO0O00O = 999
      %tanks.O00O0OOO [ $+ [ %tanks.O00OOO0O ] ] = %tanks.OOO0O00O
    }
    dec %tanks.O00OOO0O
  }
  if ($1) {
    if (%tanks.OOO0O000 < 1) %tanks.OOO0O000 = 1
    if ($O00OOOOO < %tanks.OOO0O000) %tanks.OOO0O000 = $ifmatch
  }
}
alias -l OOO0OO0O {
  if ($sock(tanks.0)) O00OO000
  unset %tanks.O00OO0OO*
  sockclose tanks
  sockclose tanks.*
  if ($window(@Tanks)) && ($1 != 1) {
    O000O0OO O0000OOO Game over
    unset %tanks.*
    %tanks.OO0O00O0 = 311
  }
  else {
    close -@ @tanksO0000O00 @Tanks color @tanksO000000O @Tank info @tanksO0000000 @tanksO00000OO @tanksO0000O0O @tanksO00000O0
    unset %tankschat.* %tanksbmp %tankswidth %tanksheight %tanks.*
  }
  if ($window(@Tanks request)) OO0OO000
}
alias -l OO0O0000 {
  if (%tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] >= 30) && (%tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ] < 10) && (%tanks.OO0O0O00 !& 1) {
    dec %tanks.O00O0OOO [ $+ [ %tanks.OOO00O00 ] ] 30
    inc %tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ]
    var %tanks.O00OOOOO = $calc(%tanks.O0O0O000 [ $+ [ %tanks.OOO00O00 ] ] +10)
    if (100 < %tanks.O00OOOOO) %tanks.O00OOOOO = $ifmatch
    %tanks.O0O0O000 [ $+ [ %tanks.OOO00O00 ] ] = %tanks.O00OOOOO
    if ($O00OOOOO < %tanks.OOO0O000) %tanks.OOO0O000 = $ifmatch
    O0OOOO00
    O0OOO000
    drawdot @Tanks
  }
}
alias tanklist {
  if ($dialog(tanklist)) dialog -x tanklist
  dialog $iif(%tanksontop,-dmo,-dm) tanklist tanklist
}
alias -l O00O0000 {
  if ($sock($1)) {
    var %tanks.O0O000OO = tanks.rand. $+ $ticks $+ $rand(0,999999)
    sockclose %tanks.O0O000OO
    sockrename $1 %tanks.O0O000OO
    sockwrite -tn %tanks.O0O000OO $2-
    .timer -o 1 30 sockclose %tanks.O0O000OO
  }
}
on *:close:@Tanks request:O0O00OO0 decline
alias tanks.chat O0O0OOO0 $1-
alias -l OO0000O0 {
  var %tanks.OOO0O00O = window $iif(%tanksontop,-o,-u) $1
  if ($2-) {
    O000OOOO OO000OO0 2 $1 %tanks.OOO0O00O
    if (%tanks.0 !isnum) $OOOO0000
    window -hzBdfkp +ntf $1-
    if (%tankslog) write " $+ $scriptdir $+ tanks.log" - Session Start: $fulldate
    if ($1 == @Tanks) {
      drawrect -rf @Tanks %tanks.1 1 0 0 %tankswidth %tanksheight
      var %tanks.O000OOOO = Verdana, %tanks.O0O00OO0 = $iif($version > 5.9,50,60), %tanks.O00OOOOO = " $+ %tanks.O000OOOO $+ " %tanks.O0O00OO0, %tanks.O00OOO0O = $int($calc(2+(%tankswidth -$width(Tanks,%tanks.O000OOOO,%tanks.O0O00OO0,0,0))/2))
      var %tanks.OOO0O0O0 = $height(Tanks,%tanks.O000OOOO,%tanks.O0O00OO0), %tanks.O0000O00 = $int($calc((%tanks.OO0O00O0 -%tanks.OOO0O0O0)/2)), %tanks.OOO0O00O = %tanks.O0000O00 + 2
      drawtext -rn @Tanks %tanks.8 %tanks.O00OOOOO %tanks.O00OOO0O %tanks.OOO0O00O Tanks | dec %tanks.O00OOO0O | dec %tanks.OOO0O00O
      drawtext -rn @Tanks %tanks.14 %tanks.O00OOOOO %tanks.O00OOO0O %tanks.OOO0O00O Tanks | dec %tanks.O00OOO0O | dec %tanks.OOO0O00O
      drawtext -rn @Tanks %tanks.9 %tanks.O00OOOOO %tanks.O00OOO0O %tanks.OOO0O00O Tanks | dec %tanks.O00OOO0O | dec %tanks.OOO0O00O
      drawtext -rn @Tanks %tanks.15 %tanks.O00OOOOO %tanks.O00OOO0O %tanks.OOO0O00O Tanks | dec %tanks.O00OOO0O | dec %tanks.OOO0O00O
      drawtext -rn @Tanks 16777215 %tanks.O00OOOOO %tanks.O00OOO0O %tanks.OOO0O00O Tanks | window -hl @tanksO0000O00
      tokenize 122 nnnvqnomnkmmknzunoonqznqomnlomnlplzttnlsnnqzmjnlkkznsnlqkzrvniqnoonszuenvknmmnkomqnzruomnlomnlplziooonqzxongrnppnqlpjnzwinrooqnnhzslmnmonvzmhrnzoknoznpntzqenwzqenoznpntzulmolnmmnkompnoonojn
      %tanks.O00OOO0O = $int($calc((%tankswidth -85)/2))
      inc %tanks.O0000O00 %tanks.OOO0O0O0
      while ($1) {
        var %tanks.OOO0O00O = 1, %tanks.O0O00OO0 = drawline -rn @Tanks %tanks.14 1
        while (%tanks.OOO0O00O < $len($1)) {
          inc %tanks.O00OOO0O $calc($asc($mid($1,%tanks.OOO0O00O,1)) - 110) | inc %tanks.OOO0O00O
          inc %tanks.O0000O00 $calc($asc($mid($1,%tanks.OOO0O00O,1)) - 110) | inc %tanks.OOO0O00O
          %tanks.O0O00OO0 = %tanks.O0O00OO0 %tanks.O00OOO0O %tanks.O0000O00
        }
        %tanks.O0O00OO0
        tokenize 32 $2-
      }
      drawpic @Tanks
      var %tanks.O00OOO0O = %tankswidth
      while (%tanks.O00OOO0O) {
        aline @tanksO0000O00 0
        dec %tanks.O00OOO0O
      }
    }
  }
  else %tanks.OOO0O00O
}
alias -l O0000OOO OO0000O0 @Tanks $iif(%tanksnoxy || * * !iswm %tanksxy,-1 -1,%tanksxy) %tankswidth %tanksheight Fixedsys 15
on *:sockread:tanks.*:{
  var %tanks.OO0O00OO, %tanks.OO00O00O = $deltok($sockname,1,46), %tanks.OO0O000O = $sock($sockname).ip, %tanks.OO000OOO = $sock($sockname).mark
  if ($sockerr) {
    OO0O0OOO $ifmatch $sockname sockread
    return
  }
  if (%tanks.OO00O00O !isnum) return
  while ($sock($sockname)) {
    sockread %tanks.OO0O00OO
    if ($sockbr !isnum 1-) return
    tokenize 32 %tanks.OO0O00OO
    if (O00O0OO0 $tanksversion(1) * * iswm $1-) {
      if (* iswm %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] ) {
        O0OOO00O O00O00OO %tanks.OO00O00O (Join error)
        return
      }
      O0O0O00O %tanks.OO00O00O $3 $OO000000($left($4,%tanks.OOO0000O),%tanks.OO00O00O)
      continue
    }
    elseif (* !iswm %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] ) {
      O00O0000 $sockname ver $tanksversion(1)
      return
    }
    if (%tanks.OOO00O00 == %tanks.OO00O00O) && ($1 != O00000OO) O00O0O00
    if ($1 == O00O0O0O) %tanks.O00OO00O [ $+ [ %tanks.OO00O00O ] ] = 1
    elseif ($1 == O00O0OOO) O00OO0O0 %tanks.OO00O00O O00O0OOO 0 $OO0O0O00
    elseif ($1 == O0000000) {
      if (%tanks.OO00O00O != %tanks.OOO00O00) continue
      O0OO00O0 %tanks.OO00O00O $1-
      O0O0O000 0 $2-
    }
    elseif ($1 == O00O000O) {
      if (%tanks.OO00O00O != %tanks.OOO00O00) || (%tanks.O00OO00O [ $+ [ %tanks.OO00O00O ] ] != 1) continue
      %tanks.OOO0O000 = $2
      %tanks.OOO0OO0O [ $+ [ %tanks.OO00O00O ] ] = $3
      %tanks.O0O0OO0O [ $+ [ %tanks.OO00O00O ] ] = $4
      var %tanks.O00OOOOO = %tanks.O000000O [ $+ [ %tanks.OO00O00O ] ] - 1
      %tanks.O000000O [ $+ [ %tanks.OO00O00O ] ] = $iif(%tanks.O00OOOOO < 0,0,%tanks.O00OOOOO)
      OOO0O0OO
    }
    elseif ($1 == O00OO0O0) O0OOO00O %tanks.OO00O00O $2-
    else {
      inc -z %tanks.O0O0OOO0 [ $+ [ %tanks.OO00O00O ] ]
      if (%tanks.O0O0OOO0 [ $+ [ %tanks.OO00O00O ] ] > 3) {
        inc -z %tanks.O0O0OOO0 [ $+ [ %tanks.OO00O00O ] ] 10
        O00OO0O0 %tanks.OO00O00O O0000OOO 0 0 Your message was not sent (too many too fast), please wait $duration($calc(%tanks.O0O0OOO0 [ $+ [ %tanks.OO00O00O ] ] -3))
        continue
      }
    }
    if ($1 == O000O000) && (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) && (%tanks.O000OO0O != O00000O0) && ($numtok(%tanks.O00O000O,32) > 1) {
      var %tanks.O00OOOOO = $iif(%tanks.O000O00O [ $+ [ %tanks.OO00O00O ] ] ,0,1)
      O0OO0O00 $1 %tanks.OO00O00O %tanks.O00OOOOO
      O0O00000 %tanks.OO00O00O %tanks.O00OOOOO
    }
    elseif ($1 == O00000O0) O00OO0O0 %tanks.OO00O00O O00000OO $2
    elseif ($1 == O00000OO) {
      var %tanks.O00OOOOO = $ctime - $2
      if (%tanks.O00OOOOO) O000O0OO O0000OOO Lag for %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] is $duration(%tanks.O00OOOOO)
      else O000O0OO O0000OOO There is no lag for %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ]
    }
    elseif ($1 == O000OOO0) O0OOOO0O %tanks.OO00O00O $2
    elseif ($1 == O000OO00) {
      var %tanks.O00OOOOO = $left($OO000000($2,%tanks.OO00O00O),%tanks.OOO0000O)
      if (%tanks.OO000OOO) O00OO0O0 %tanks.OO00O00O O000OO00 %tanks.OO00O00O %tanks.O00OOOOO
      else O0O000OO %tanks.OO00O00O %tanks.O00OOOOO
    }
    elseif ($1 == O0000O00) && (%tanks.OO000OOO != 1) {
      O000O0OO O000000O %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] $left($2-,200)
      O0OO00O0 %tanks.OO00O00O O0000O00 %tanks.OO00O00O $left($2-,200)
    }
    elseif ($1 == O000O0OO) {
      var %tanks.O00OOOOO = 1
      while ($gettok($2,%tanks.O00OOOOO,44) isnum) {
        var %tanks.OOO0O00O = $gettok($2,%tanks.O00OOOOO,44), %tanks.O0O00OO0 = tanks. $+ %tanks.OOO0O00O, %tanks.O0O000OO
        if (%tanks.OO000OOO != 1) || (%tanks.OO00O00O == %tanks.OOO0O00O) {
          if (* !iswm $sock(%tanks.O0O00OO0)) || (%tanks.OOO0O00O == 0) %tanks.O0O000OO = 1
          else O00OO0O0 %tanks.OOO0O00O O000O0OO %tanks.OO00O00O $left($3-,200)
        }
        inc %tanks.O00OOOOO
      }
      if (%tanks.O0O000OO) O000O0OO O000OO00 %tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] %tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] $3-
    }
  }
}
dialog tanksname {
  title "Tanks name"
  option dbu
  size -1 -1 120 28
  text "Enter your new name:", 5, 4 3 54 7
  edit "", 2, 4 13 56 11, autohs result
  button "&Ok", 3, 63 13 25 11, ok default
  button "&Cancel", 4, 91 13 25 11, cancel
  list 1,0 0 0 0,disablehide
}
alias -l O0O0O0OO {
  if ($window(@Tanks)) {
    drawrect -rfn @Tanks %tanks.OO000000 1 0 %tanks.OO000OO0 %tankswidth 16
    if ($timer(tanks.OO000OOO)) O00OOO0O
  }
}
alias -l OO0OOO0O {
  if (%tanks.O000OO0O !isin O00000OO O0000O00 O000000O) return
  drawrect -rfn @Tanks 0 1 172 $calc(1+$1) 25 13
  if ($2 isnum) drawtext -rn @Tanks $iif($3,10921638,16777215) Fixedsys 15 $calc(196-$width($2,fixedsys,15,0,0)) $1 $2
}
alias -l O00O00OO {
  if ($dialog(tankschat)) {
    dialog -ev tankschat
    return
  }
  if ($0) var %tanks.O0O000OO = $1-
  else var %tanks.O0O000OO = $dialog(tankschat,tanksname,@Tanks)
  if (%tanks.OOO00000) %tanksname = %tanks.O0O000OO
  else %tanksserver = %tanks.O0O000OO
  %tanks.O0O000OO = $OO000000($left(%tanks.O0O000OO,64),%tanks.OOO00000)
  if (* iswm %tanks.O0O000OO) {
    if ($sock(tanks)) O0OO0O00 O000OO00 %tanks.O0O000OO
    else O0O000OO %tanks.OOO00000 %tanks.O0O000OO
  }
}
menu @Tank info {
  sclick:close -@ @Tank info
}
alias downloadtanks {
  if ($show) O0000O0O
  $OOO0000O
  O0OOOOO0 Downloading...
  if ($show) window -BhaCdfopk0 +Ldf $OO0OOO00 -1 -1 152 24
  else window -h $OO0OOO00
  OO0OOO00
  sockopen downloadtanks pages.cthome.net 80
}
on *:keydown:@Tank info:*:{
  if ($keyval !isnum 16-17) window -c @Tank info
}
on ^*:notice:tanks *:*:{
  if ($2 == request) {
    haltdef
    if (%tanksnolisten) return
    var %tanks.OO00OO00 = OO000O00 $nick wants to play a game of Tanks $+ $chr(44) but, %tanks.O0O000OO = O0O00OO0 0 $nick
    if ($tanksversion(1) < $3) {
      %tanks.OO00OO00 you have an older version.  Get the newest by typing ' $+ $O000O000(/downloadtanks) $+ '.
      %tanks.O0O000OO old
    }
    elseif ($tanksversion(1) != $3) {
      %tanks.OO00OO00 they have an older version.
      %tanks.O0O000OO new
    }
    elseif ($OOO0000O) {
      %tanks.OO00OO00 Tanks is busy installing the newest version right now.
      %tanks.O0O000OO installing
    }
    elseif ($sock(tanks)) || ($sock(tanks.*,0)) %tanks.O0O000OO playing %tanksip %tanksport
    else {
      %tankstempip = $4
      %tankstempport = $5
      %tankstempnick = $nick
      OO0OO000
      var %tanks.O00OOOOO = Will you join $nick $+ 's game of Tanks?, %tanks.O0O0OO00 = $width(%tanks.O00OOOOO,fixedsys,15,0,0) + 16
      OO0000O0 @Tanks request -1 -1 %tanks.O0O0OO00 47 Fixedsys 15
      drawrect -rfn @Tanks request %tanks.15 1 0 0 %tanks.O0O0OO00 47
      drawtext -rbn @Tanks request %tanks.1 %tanks.15 Fixedsys 15 8 8 %tanks.O00OOOOO
      O00000O0
    }
    return
  }
  if ($nick == %tankstempnick) {
    if ($2 == playing) {
      if ($sock(tanks.*,0) > 1) || ($sock(tanks)) OO000O00 $nick is already playing Tanks at $3 $+ : $+ $4 $+ .
      else {
        OOO0OO0O
        tanks $3-4
      }
    }
    elseif ($2 == decline) OO000O00 $nick declined your Tanks invitation.
    elseif ($2 == installing) OO000O00 $nick is busy installing the new version of Tanks.
    elseif ($2 == ver) || ($2 == old) OO000O00 $nick has an older version of Tanks.
    elseif ($2 == new) OO000O00 $nick has a newer version of Tanks. Download the newest version by typing $O000O000(/downloadtanks) $+ .
  }
  haltdef
}
on *:sockclose:tanks:{
  close -@ @Tanks request
  if ($window(@Tanks)) O000O0OO O0000OOO The server closed the connection
  else OO000O00 Tanks: Server closed the connection
  OOO0OO0O
}
alias -l O00OOO00 {
  if (, isin $2) var %tanks.O0O00O0O = $getdot(@tanksO000000O, [ $2 ] )
  else var %tanks.O0O00O0O = %tanks. [ $+ [ $2 ] ]
  %tanks.OOO00O0O [ $+ [ $1 ] ] = $2
  if (%tanks.O00OO0OO [ $+ [ $1 ] ] == %tanks.O0O00O0O) return return
  %tanks.O00OO0OO [ $+ [ $1 ] ] = %tanks.O0O00O0O
}
alias -l O00O0OO0 {
  if ($numtok(%tanks.O00O000O,32) > 8) {
    drawpic -cnt @Tanks 16711935 4 383 0 0 36 17 %tanksbmp
    return
  }
  var %tanks.OOO0O00O = %tanks.O00OO0OO [ $+ [ %tanks.OOO00O00 ] ]
  if (%tanks.OOO0O00O !isnum) return
  drawrect -rfn @Tanks %tanks.OOO0O00O 1 4 383 36 17
}
on *:socklisten:tanks.0:{
  var %tanks.O00OOO0O = 1, %tanks.O0O00OO0, %tanks.O00OOOOO
  if ($sockerr) {
    OO0O0OOO $ifmatch tanks.0 socket listening
    return
  }
  while (1) {
    %tanks.O0O00OO0 = tanks. $+ %tanks.O00OOO0O
    if ($sock(%tanks.O0O00OO0)) || (%tanks.O00OO0OO [ $+ [ %tanks.O00OOO0O ] ] isnum) inc %tanks.O00OOO0O
    else break
  }
  sockaccept %tanks.O0O00OO0
  var %tanks.OO0O000O = $sock(%tanks.O0O00OO0).ip, %tanks.OOO0O00O = tanksconnect $+ %tanks.OO0O000O
  if (%tanks.O00OOO0O > %tanksplayerlimit) {
    %tanks.O00OOOOO = O00OOO0O
    goto 1
  }
  if (%tanksonecon != 1) && ($timer(%tanks.OOO0O00O)) && (%tanks.OO0O000O) {
    %tanks.O00OOOOO = O000OOOO
    goto 1
  }
  .timer $+ %tanks.OOO0O00O -o 1 10 return
  if ($O0O00O00(0,%tanks.OO0O000O)) {
    %tanks.O00OOOOO = O00OO00O
    goto 1
  }
  var %tanks.OO00O00O = %tanks.O0OOO0OO
  while (%tanks.OO00O00O) && (%tanksonecon) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) && (%tanks.OO0O000O == $sock(tanks. [ $+ [ %tanks.OO00O00O ] ] ).ip) {
      %tanks.O00OOOOO = O0000O0O
      goto 1
    }
    dec %tanks.OO00O00O
  }
  :1
  if (%tanks.O00OOOOO) O00O0000 %tanks.O0O00OO0 ver $tanksversion(1) %tanks.O00OOOOO
  else .timertanks.OO000OO0 $+ %tanks.O00OOO0O -o 1 15 OO000OO0 1 %tanks.O00OOO0O %tanks.O0O00OO0 %tanks.OO0O000O
}
on *:sockopen:tanksversion:{
  if ($sockerr) {
    O0OOOOO0 Connection error $sockerr
    return
  }
  sockwrite -n $sockname GET /pdufilie/versions.txt HTTP/1.0
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: pages.cthome.net
  sockwrite -n $sockname
}
dialog tanklist {
  title "Tanks servers"
  option dbu
  size -1 -1 316 222
  list 1, 3 3 310 201, sizehsbarvsbar
  button "&Go" 2, 196 207 37 12, ok
  button "&Refresh" 3, 236 207 37 12
  button "&Close" 4, 276 207 37 12, cancel
  edit "" 5, 3 207 189 12, read
  list 9, 0 0 0 0, disablehide
}
alias -l OO0O00O0 {
  O000OOOO close -@ $OO0OOO00
  if ($isfile($remove($OOO0OOOO,"))) {
    O0OOOOO0 Installing...
    .timertankserror -o 1 0 OO000O00 An error occurred while downloading Tanks.
    run -n $OOO0OOOO
    .timertankserror off
    O0OO0O0O 0 $window($OO0OOO00).state
    :error
  }
}
on *:close:@tanksO000000O:O0000O0O
on *:sockclose:downloadtanks:OO0O00O0
on *:close:@tanksO00000OO:O0000O0O
alias -l O000O0OO {
  if (* !iswm $window(@Tanks)) return
  window -g3 @Tanks
  var %tanks.OO0O0OOO, %tanks.OOO00OO0 = 1
  if ($1 == -) {
    %tanks.OOO00OO0 = 0
    tokenize 32 $2-
  }
  if ($1 == O000O0OO) {
    %tanks.OO0O0OOO = 1
    tokenize 32 O0000OOO $2-
  }
  if ($1 == O0000000) tokenize 32 O0000OOO $replace($4-,   ,%tanks.O0OO00O0 [ $+ [ $3 ] ] ,  ,%tanks.O0OO00O0 [ $+ [ $2 ] ] )
  var %tanks.O0O0O0O0 = $1, %tanks.OOO0O00O, %tanks.O00OOOOO, %tanks.O0O000OO, %tanks.O0O0OO00 = $calc(%tankschat.O00OO0O0 -19-%tankstahoma)
  if (%tanks.O0O0O0O0 == O0000OOO) %tanks.O00OOOOO = $2-
  else %tanks.OOO0O00O = $2
  if (%tanks.O0O0O0O0 == O000O000) %tanks.O00OOOOO = $3 joined the game $iif($4,(IP: [ [ $4 ] $+ ] ))
  elseif (%tanks.O0O0O0O0 == O000O00O) {
    if ($istok(/me /em,$4,32)) {
      %tanks.O0O0O0O0 = O00000O0
      %tanks.O00OOOOO = (pmsg) -> * $+ $3 $+ * $5-
    }
    else %tanks.O00OOOOO = (pmsg) -> * $+ $3 $+ * $4-
  }
  elseif ($istok(O000000O O000OO00,%tanks.O0O0O0O0,32)) {
    if ($istok(/me /em,$4,32)) {
      %tanks.O0O0O0O0 = O000O0O0
      %tanks.O00OOOOO = * $3 $5-
    }
    else %tanks.O00OOOOO = < $+ $3 $+ > $4-
    if ($1 == O000OO00) {
      if (%tanks.O0O0O0O0 == O000O0O0) %tanks.O0O0O0O0 = O00000O0
      %tanks.O00OOOOO = (pmsg) %tanks.O00OOOOO
      OO00O000 1
    }
    if ($3 === %tanks.O0OO00O00) %tanks.O00OOOOO = (server) %tanks.O00OOOOO
  }
  elseif (%tanks.O0O0O0O0 == O0000O00) %tanks.O00OOOOO = $3 renamed to $4
  elseif (%tanks.O0O0O0O0 == O00000OO) {
    %tanks.OOO0O00O = %tanks.OOO0O00O $4
    %tanks.O00OOOOO = $3 changed color
  }
  elseif (%tanks.O0O0O0O0 == O0000O0O) {
    %tanks.O00OOOOO = $3 left the game $4- %tanks.OO0000OO
    if (* !iswm $3) return
  }
  elseif (%tanks.O0O0O0O0 == O0000OO0) %tanks.O00OOOOO = $3 was kicked out $4- %tanks.OO0000OO
  %tanks.O00OOOOO = $strip(%tanks.O00OOOOO)
  if (%tankslog) && (%tanks.OO0O0OOO != 1) {
    tokenize 32 %tanks.OOO0O00O %tanks.O00OOOOO
    var %tanks.O0OOOOOO = $2-
    if (%tanks.O0O0O0O0 == O00000OO) %tanks.O0OOOOOO = $3-
    if (%tanks.O0O0O0O0 == O0000OOO) %tanks.O0OOOOOO = $1-
    if ($istok(O000000O O000O00O O000OO00 O000O0O0,%tanks.O0O0O0O0,32) != $true) %tanks.O0OOOOOO = *** %tanks.O0OOOOOO
    write " $+ $scriptdir $+ tanks.log" $timestamp %tanks.O0OOOOOO
  }
  while ($len(%tanks.O00OOOOO)) && (* iswm $remove(%tanks.O00OOOOO, )) {
    %tanks.O0O000OO = 1
    while ($width($mid(%tanks.O00OOOOO,1,%tanks.O0O000OO),%tankschat.O00000O0,%tankschat.O0000OO0,0,0) < %tanks.O0O0OO00) && (%tanks.O0O000OO <= $len(%tanks.O00OOOOO)) {
      inc %tanks.O0O000OO
    }
    if ($asc($mid(%tanks.O00OOOOO,%tanks.O0O000OO,1)) != 32) {
      dec %tanks.O0O000OO
      var %tanks.O0OOOOOO = $left(%tanks.O00OOOOO,%tanks.O0O000OO)
      if (%tanks.O0O000OO < $len(%tanks.O00OOOOO)) && ($numtok(%tanks.O0OOOOOO,32) > 2) %tanks.O0O000OO = $pos(%tanks.O0OOOOOO,$chr(32),$count(%tanks.O0OOOOOO,$chr(32)))
    }
    O0O0000O %tanks.O0O0O0O0 %tanks.OOO0O00O $left(%tanks.O00OOOOO,%tanks.O0O000OO)
    if ($asc($mid(%tanks.O00OOOOO,%tanks.O0O000OO,1)) == 32) %tanks.O00OOOOO =   $right(%tanks.O00OOOOO,$calc(0-%tanks.O0O000OO))
    else %tanks.O00OOOOO =    $+ $right(%tanks.O00OOOOO,$calc(0-%tanks.O0O000OO))
  }
  if (%tanks.OOO00OO0) OOO00OO0
}
on *:active:@tanksO0000000,@tanksO0000O0O,@tanksO0000O00,@tanksO000000O,@tanksO00000OO:{
  if ($target == @tanksO00000OO) unset %tanks.O00OOO00
  .timertankshide -o 1 0 window -h $target
}
on *:sockread:downloadtanks:{
  while (1) {
    if ($sockerr) {
      O0OOOOO0 Error $sockerr |Error $sockerr when downloading Tanks
      return
    }
    tokenize 32 $sock($sockname).mark
    if ($2 != 0) break
    var %tanks.O00OOOOO
    sockread %tanks.O00OOOOO
    if ($sockbr) {
      if (Content-Length: * iswm %tanks.O00OOOOO) sockmark $sockname $gettok(%tanks.O00OOOOO,2,32) $2
      elseif (* !iswm %tanks.O00OOOOO) {
        sockmark $sockname $1 $rand(1,16777215)
        break
      }
    }
  }
  while (1) {
    if (* !iswm $sock($sockname)) return
    sockread 4096 &b
    if ($sockbr !isnum 1-) return
    OO0OOO00
    bwrite $OOO0OOOO -1 -1 &b
  }
}
on *:active:@Tanks:{
  if ($lactive == @tanksO00000OO) return
  close -@ @Tanks color @Tank info
  if ($version != 6.02) OO0000O0 @Tanks
}
alias -l OO000OOO {
  if ($window(@Tanks)) && (* iswm %tanks.OO0OO0OO) && (* iswm %tanks.OO000000) {
    drawfill -nrs @Tanks %tanks.OO0OO0OO %tanks.OO000000 0 0
    drawfill -nrs @Tanks %tanks.OO000000 %tanks.OO0OO0OO 0 0
    drawfill -nrs @Tanks %tanks.OO0OO0OO %tanks.OO000000 0 0
    drawfill -nrs @Tanks %tanks.OO000000 %tanks.OO0OO0OO 0 0
    if (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) O000OO0O
  }
}
ctcp *:tanks:if ($server) && (%tanksnoctcp != 1) && ($calc($ctime -%tanksctime) > 60) ctcpreply $nick Tanks $tanksversion(1)
alias -l OO0O0OOO {
  if ($1 == 3) OO000O00 Tanks $3- error (server not found)
  else OO000O00 Tanks $3- error $1 $sock($2).wsmsg
  sockclose $2
}
alias -l O0000000 {
  if (%tanks.O0OO0O00 [ $+ [ %tanks.OOO00O00 ] ] > 0) && (%tanks.O000OO0O isin O00000OO O0000O00 O000000O) {
    var %tanks.O00OOO0O = %tanks.OOO000O0 [ $+ [ %tanks.OOO00O00 ] ] , %tanks.O0000O00 = 1 + %tanks.OO000OO0
    if ($1) drawrect -rfn @Tanks %tanks.OO000000 1 %tanks.O000O0OO %tanks.O0000O00 10 13
    %tanks.O000O0OO = %tanks.O00OOO0O - $iif(%tanks.O00OOO0O > $calc(%tankswidth /2),5,6)
    drawpic -cnt @Tanks 16711935 %tanks.O000O0OO %tanks.O0000O00 120 104 10 13 %tanksbmp
    drawfill -srn @Tanks 7368816 16777215 $calc(5+%tanks.O000O0OO) %tanks.O0000O00
  }
}
alias -l O0000O0O {
  %tanksxy = $window(@Tanks).x $window(@Tanks).y
  close -@ @Tanks
  if ($dialog(tanksban)) dialog -x tanksban
  if ($dialog(tankschat)) dialog -x tankschat
  if ($dialog(tanksbots)) dialog -x tanksbots
  if ($dialog(tanksserver)) dialog -x tanksserver
  .timertanks* off
  OOO0OO0O 1
  if (%tankslog) {
    write " $+ $scriptdir $+ tanks.log" - Session Close: $fulldate
    write " $+ $scriptdir $+ tanks.log" -
  }
}
on *:dialog:tanksserver:init,sclick:*:{
  if ($devent == init) OOO0OOO0
  elseif ($did == 1) || ($did == 3) OO00OO00
  elseif ($did == 5) did $iif($did(tanksserver,5).state,-e,-b) tanksserver 6,7
  elseif ($did isnum 10-11) {
    %tanksplayerlimit = $did(tanksserver,9)
    if (%tanksplayerlimit !isnum) %tanksplayerlimit = 8
    $iif($did == 10,dec,inc) %tanksplayerlimit
    if (%tanksplayerlimit < 2) %tanksplayerlimit = 2
    elseif (%tanksplayerlimit > 32) %tanksplayerlimit = 32
    did -o tanksserver 9 1 %tanksplayerlimit
  }
}
alias -l socket sockclose $1 | sockopen $1-2 80 | sockmark $1-2
alias -l menu_ if (%tanksnomenu) return | return 1
on *:sockopen:tanks:{
  if ($sockerr) {
    OO0O0OOO $ifmatch $sockname connection
    return
  }
  $OOOO0000
  O0OO0O00 O00O0OO0 $tanksversion(1) %tankscolor %tanksname
  %tanks.O000OO0O = O0000000
}
on *:dialog:tankschat:init:0:{
  if (%tanks.OO00O000) {
    unset %tanks.OO00O000
    var %tanks.O0O000OO = %tanks.O0OOO0OO
    while (%tanks.O0O000OO >= 0) {
      var %tanks.O0O00OO0 = tanks. $+ %tanks.O0O000OO
      if ($sock(tanks)) || ($sock(%tanks.O0O00OO0)) && (%tanks.O0O000OO != %tanks.OOO00000) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) && (%tanks.OO000O00 [ $+ [ %tanks.O0O000OO ] ] !isnum 0-4) {
        did -i $dname 1 1 $iif(%tanks.O0O000OO == 0,(server)) %tanks.O0OO00O0 [ $+ [ %tanks.O0O000OO ] ]
        %tanks.OO00O000 = %tanks.O0O000OO %tanks.OO00O000
        if ($istok(%tanks.O0O00000,%tanks.O0O000OO,44)) did -ck $dname 1 1
      }
      dec %tanks.O0O000OO
    }
    if ($did($dname,1,1).sel !isnum 1-99) did -c $dname 1 1
  }
  did -f $dname 2
}
on *:sockwrite:tanks.*.*:.timer -o 1 15 sockclose $sockname
alias -l OO0O0O0O {
  OO0OO0O0
  drawrect -rfn @Tanks %tanks.OO000000 1 0 0 %tankswidth %tanks.OO0O00O0
  tokenize 32 . %tanks.OO00OO0O
  var %tanks.O0O000OO, %tanks.O0OOOOOO = 0, %tanks.O0O00O0O = $2, %tanks.OOO0O0O0, %tanks.OO0O000O = 0, %tanks.O00OOO0O = 1, %tanks.O0O0O00O = 0, %tanks.O0000O00, %tanks.OO0OO0O0 = drawline -rn @Tanks %tanks.O0000OOO 1
  while (%tanks.O00OOO0O <= %tankswidth) && (* iswm $2) {
    if (%tanks.OO0O000O >= %tanks.O0OOOOOO) || (%tanks.O00OOO0O == %tankswidth) {
      tokenize 32 $3-
      %tanks.O0000O00 = $1
      %tanks.O0OOOOOO = $2
      %tanks.OO0O000O = 0
    }
    %tanks.OOO0O0O0 = $int(%tanks.O0O00O0O)
    %tanks.OO0OO0O0 %tanks.O0O0O00O %tanks.OOO0O0O0 %tanks.O0O0O00O %tanks.OO0O00O0
    rline @tanksO0000O00 %tanks.O00OOO0O %tanks.OOO0O0O0
    inc %tanks.O0O00O0O %tanks.O0000O00
    inc %tanks.O00OOO0O
    inc %tanks.OO0O000O
    inc %tanks.O0O0O00O
  }
  O00O000O
}
dialog tanksban {
  title "Tanks ban list"
  option dbu
  size -1 -1 319 127
  box "Add a ban", 11, 4 2 133 121
  text "Select a user to copy info to ban mask field", 12, 10 11 105 8
  list 1, 10 20 68 56, size
  list 2, 81 20 50 56, size
  radio "Ban by IP address", 3, 74 79 56 10
  radio "Ban by name", 4, 13 79 53 10
  text "Ban mask:", 13, 10 94 26 8
  edit "", 5, 38 92 61 12
  text "Comment:", 14, 10 108 26 8
  edit "", 6, 38 106 93 12
  button "Add ban", 7, 102 92 29 12, default ok
  box "Ban list", 15, 144 2 171 104
  list 8, 150 12 159 74, sort size extsel hsbar vsbar
  button "&Remove selected", 9, 255 89 54 12
  text "Wildcards may be used where necessary.", 16, 154 113 114 8, center
  button "Close", 10, 285 110 30 13, cancel
}
alias -l O0O000O0 {
  if (* !iswm $window(@Tanks)) return
  if (%tanks.OOO00O00 == %tanks.OOO00000) && ($1 == 0) O00O0O00 0
  var %tanks.OO0O00OO = .timertanks.O00O00O0 -om 1 200 .timertanks.O00O00O0 -om 0 50 O00O00O0, %tanks.OO0O0OOO = O000OOO0 81 440 77 57 131 16 17, %tanks.OOO00OO0 = O000OO00 99 440 95 57 131 16 17, %tanks.OO0OO0O0 = 0, %tanks.OO00O00O = $1, %tanks.O0OO0O0O = %tanks.OO0OOOO0, %tanks.O0OOO0O0 = $mouse.dx, %tanks.O000OO00 = $mouse.dy, %tanks.O00OOO0O = $mouse.x, %tanks.O0000O00 = $mouse.y, %tanks.OO0O000O, %tanks.O0O00O0O, %tanks.O0O0O0O0
  if ($mouse.key & 1) {
    %tanks.OO0OO0O0 = 1
    if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,%tankschat.O00O0OO0,%tankschat.O0000OOO,%tankschat.O00OO0O0,%tankschat.O000OOOO)) {
      var %tanks.O0OOOOOO = $int($calc((%tanks.O0000O00 -3-%tankschat.O0000OOO)/13))
      if (%tanks.OO00O00O == 0) && ($mouse.key > 1) {
        %tankschat.O00O0000 = $calc(%tankschat.O00OOO00 +11-%tanks.O0OOOOOO)
        %tankschat.O000O000 = %tankschat.O00O0000
        if (%tanks.O0OOOOOO < 11) && (%tankschat.O00O0000 <= %tankschat.O00OO000) {
          %tankschat.O00OO00O
          %tankschat.O00OO00O = drawrect -nrif @Tanks 0 1 $calc(16+%tankschat.O00O0OO0) $calc(3+%tankschat.O0000OOO +13*%tanks.O0OOOOOO) $calc(%tankschat.O00OO0O0 -17) 13
          %tankschat.O00OO00O
          drawdot @Tanks
          %tankschat.O00O0O0O = 1
          unset %tankschat.O00OOO00down
        }
        else unset %tankschat.O00OO00O
      }
      elseif (%tankschat.O00O0O0O) {
        if (%tanks.O0OOOOOO > 10) %tanks.O0OOOOOO = 10
        %tankschat.O000O000 = $calc(%tankschat.O00OOO00 +11-%tanks.O0OOOOOO)
        if (%tankschat.O000O000 > %tankschat.O00O0000) %tankschat.O000O000 = %tankschat.O00O0000
        %tankschat.O00OO00O
        %tankschat.O00OO00O = drawrect -nrif @Tanks 0 1 $calc(16+%tankschat.O00O0OO0) $calc(3+%tankschat.O0000OOO +13*(11+%tankschat.O00OOO00 -%tankschat.O00O0000)) $calc(%tankschat.O00OO0O0 -17) $calc(13*(1+%tankschat.O00O0000 -%tankschat.O000O000))
        %tankschat.O00OO00O
        drawdot @Tanks
      }
    }
    elseif (%tankschat.O00O0O0O) {
      %tankschat.O00OO00O
      unset %tankschat.O00OO00O
      drawdot @Tanks
    }
    if (%tankschat.O00O00OO) {
      var %tanks.O00OOOOO = %tankschat.O00OOO00
      %tankschat.O00OOO00 = $int($calc(.5+%tankschat.O000OO00 +(%tankschat.O00OO000 -11)*(%tankschat.O00O00OO -%tanks.O0000O00)/(%tankschat.O000O0O0 -15)))
      if (%tankschat.O00OOO00 < $calc(%tankschat.O00OO000 -11)) {
        if (%tankschat.O00OOO00 < 0) %tankschat.O00OOO00 = 0
      }
      else %tankschat.O00OOO00 = %tankschat.O00OO000 - 11
      if (%tanks.O00OOOOO != %tankschat.O00OOO00) OOO00OO0
    }
    if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,%tankschat.O00O0OOO,%tankschat.O0000OOO,15,%tankschat.O000OOOO)) {
      if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,%tankschat.O00O0OOO,%tankschat.O0000000,15,15)) && (%tanks.OO00O00O == 0) {
        %tankschat.O00O00OO = %tanks.O0000O00
        %tankschat.O000OO00 = %tankschat.O00OOO00
      }
      if (%tankschat.O00O00OO != 1) {
        if (%tanks.O0000O00 >= %tankschat.O000OOO0) && (%tanks.O0000O00 < %tankschat.O0000000) {
          if (%tanks.OO00O00O == 0) {
            %tankschat.O000O00O = O00000O0
            OOO0O00O 11
            %tankschat.O00000OO = 1
            %tanks.OO0O00OO
          }
        }
        elseif (%tankschat.O000O00O == O00000O0) O00O00O0 1
        elseif (%tanks.O0000O00 < %tankschat.O000OO0O) && (%tanks.O0000O00 >= $calc(15+%tankschat.O0000000)) {
          if (%tanks.OO00O00O == 0) {
            %tankschat.O000O00O = O0000O0O
            OOO00O00 11
            %tankschat.O00000OO = 1
            %tanks.OO0O00OO
          }
        }
        elseif (%tankschat.O000O00O == O0000O0O) O00O00O0 1
      }
      if (%tanks.O0000O00 < %tankschat.O000OOO0) {
        if (%tanks.OO00O00O == 0) {
          %tankschat.O000O00O = O000O000
          %tankschat.O00000OO = 1
          OOO0O00O
          %tanks.OO0O00OO
        }
      }
      elseif (%tankschat.O000O00O == O000O000) O00O00O0 1
      if (%tanks.O0000O00 >= %tankschat.O000OO0O) {
        if (%tanks.OO00O00O == 0) {
          %tankschat.O000O00O = O00O0000
          %tankschat.O00000OO = 1
          OOO00O00
          %tanks.OO0O00OO
        }
      }
      elseif (%tankschat.O000O00O == O00O0000) O00O00O0 1
    }
    elseif ($timer(tanks.O00O00O0)) O00O00O0 1
  }
  else {
    if (%tankschat.O00O0O0O) {
      if (%tankschat.O00OOO00down) {
        unset %tankschat.O00OOO00down %tankschat.O00OO00O
        %tankschat.O00OOO00 = 0
        OOO00OO0
      }
      else {
        %tankschat.O00OO00O
        drawdot @Tanks
        unset %tankschat.O00OO00O
      }
      %tankschat.O00O0O0O = 0
      if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,%tankschat.O00O0OO0,%tankschat.O0000OOO,%tankschat.O00OO0O0,%tankschat.O000OOOO)) {
        var %tanks.OOO0O00O
        while (1) {
          var %tanks.O00OOOOO = $O000OO00(%tankschat.O00O0000)
          if ($left(%tanks.O00OOOOO,6) == ***   ) %tanks.OOO0O00O = %tanks.OOO0O00O $+ $mid(%tanks.O00OOOOO,7)
          elseif ($left(%tanks.O00OOOOO,5) " == ***   ") %tanks.OOO0O00O = %tanks.OOO0O00O $mid(%tanks.O00OOOOO,7)
          elseif (  * iswm %tanks.O00OOOOO) %tanks.OOO0O00O = %tanks.OOO0O00O $+ $mid(%tanks.O00OOOOO,3)
          elseif (  * iswm %tanks.O00OOOOO) %tanks.OOO0O00O = %tanks.OOO0O00O $mid(%tanks.O00OOOOO,3)
          elseif (* iswm %tanks.OOO0O00O) %tanks.OOO0O00O = %tanks.OOO0O00O $+ $crlf $+ %tanks.O00OOOOO
          else %tanks.OOO0O00O = %tanks.O00OOOOO
          if (%tankschat.O00O0000 > %tankschat.O000O000) dec %tankschat.O00O0000
          else break
        }
        clipboard %tanks.OOO0O00O
      }
    }
    unset %tankschat.O000O00O
    %tankschat.O00O00OO = 0
    if ($timer(tanks.O00O00O0)) {
      O00O00O0 1
      .timertanks.O00O00O0 off
    }
  }
  if (%tanks.O000OO0O !isin O00000OO O0000O00 O000000O) return
  if (%tanks.OO00O00O isnum) || ($mouse.key !& 1) && ($active == @Tanks) {
    if (%tanks.O0000O00 < %tanks.OO0O00O0) || ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,0,312,320,57)) {
      if ($appactive) O000O0O0 %tanks.O0OOO0O0 %tanks.O000OO00 %tanks.O00OOO0O %tanks.O0000O00 %tanks.OO00O00O
      return
    }
  }
  unset %tanks.O00OOO00
  if ($version != 6.02) window -h @tanksO00000OO
  if (%tanks.O0OO0O0O < 1) && (%tanks.OO0OO0O0 < 1) return
  if (%tanks.O000OO0O == O000000O) {
    %tanks.O0O0O0O0 = %tanks.OO0O0OOO %tanks.OOO00OO0
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O000OOOO 206 409 0 0 0 110 23
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O000O0O0 42 383 38 0 74 36 36
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O000OO0O 42 421 38 38 112 36 36
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O000000O 4 402 0 19 93 36 36
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O0000OOO 80 402 76 19 93 36 36
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O00000OO 218 383 214 0 74 84 25
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O0000000 218 433 214 50 124 84 24
  }
  if ($numtok(%tanks.O00O000O,32) > 8) {
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O000O00O 4 383 0 0 74 17 17
    %tanks.O0O0O0O0 = %tanks.O0O0O0O0 O0000OO0 23 383 19 0 74 17 17
  }
  tokenize 32 %tanks.O0O0O0O0
  while ($1) {
    %tanks.O0O00O0O = $1
    if (%tanks.O0OO0O0O) && (%tanks.O0OO0O0O != %tanks.O0O00O0O) || (%tanksinc == $replace(%tanks.O0O00O0O,O000OOO0,1,O000OO00,5)) { }
    else {
      if ($inrect(%tanks.O00OOO0O,%tanks.O0000O00,$2,$3,$7,$8)) %tanks.OO0O000O = 1
      else %tanks.OO0O000O = 0
      if (%tanks.O0O00O0O == O000OOOO) {
        if (%tanks.OO0O000O) || (%tanks.OO0OOOO0 == O000OOOO) && (%tanks.OO0OO0O0) {
          var %tanks.O00OOOOO = 5
          if (%tanks.O00OOO0O < 229) %tanks.O00OOOOO = 1
          elseif (%tanks.O00OOO0O < 250) %tanks.O00OOOOO = 2
          elseif (%tanks.O00OOO0O < 271) %tanks.O00OOOOO = 3
          elseif (%tanks.O00OOO0O < 292) %tanks.O00OOOOO = 4
          if (%tanks.OOO0O000 != %tanks.O00OOOOO) O0O0O000 %tanks.O0O00O0O $+ %tanks.O00OOOOO
          %tanks.OO0OOOO0 = O000OOOO
        }
      }
      elseif (%tanks.OO0O000O) && (%tanks.OO0OO0O0) {
        drawpic -cnt @Tanks 16711935 $2-4 $6-8 %tanksbmp
        drawdot @Tanks
        %tanks.OO0OOOO0 = %tanks.O0O00O0O
      }
      elseif (%tanks.O0OO0O0O == %tanks.O0O00O0O) {
        if ($istok(O000OOO0 O000OO00,%tanks.O0OO0O0O,32)) && (%tanks.OO0O000O) && (%tanks.OO00O00O) tokenize 32 $iif(%tanks.O0O00O0O == O000OOO0,%tanks.OOO00OO0,%tanks.OO0O0OOO)
        drawpic -cnt @Tanks 16711935 $2-5 $7-8 %tanksbmp
        drawdot @Tanks
      }
      if (%tanks.OO0O000O) && (%tanks.OO00O00O) O0O0O000 $OOO00O0O(%tanks.O0O00O0O)
    }
    tokenize 32 $9-
  }
  if (%tanks.OO0OO0O0) && (%tanks.OO0OOOO0 == 0) %tanks.OO0OOOO0 = \
  if (%tanks.OO0OO0O0 < 1) %tanks.OO0OOOO0 = 0
}
alias -l O00OO000 OOO0O000 action=remove
on *:sockopen:tanklist*:{
  if ($sockname !isin tanklist2) return
  if ($sockerr) {
    if (%tanksbackup) {
      unset %tanksbackup
      tanklistmsg Unable to connect.
    }
    else {
      %tanksbackup = 1
      socket tanklist2 tanks.ileet.net
      socket tanklist tanks.mircscripts.org
    }
    return
  }
  if (* !iswm %tanksname) %tanksname = $OO000000(%tanksname,0)
  sockwrite -n $sockname GET /tanks.php?version= $+ $tanksversion(1) $+ &me= $+ $replace(%tanksname,%,$right(.%25,3),+,$right(.%2B,3),$chr(35),$right(.%23,3),&,$right(.%26,3),$chr(32),$right(.%20,3)) $+ &crc= $+ $crc($script) $+ & $+ %tankslistsend HTTP/1.0
  sockwrite -n $sockname IP: $ip
  sockwrite -n $sockname Tanks-server: %tanksserver
  sockwrite -n $sockname Version: $version
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: $sock(tanklist).mark
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname Cache-Control: no-cache
  sockwrite -n $sockname
  sockmark $sockname wait
  if ($sockname == tanklist) && (%tankslisting) && ($dialog(tanklist)) did -r tanklist 1,9,5
}
alias -l O0OO0OO0 {
  if ($1 isnum 0-1) %tankstahoma = $1
  if (%tankstahoma !isnum 0-1) %tankstahoma = 1
  if (%tankstahoma) {
    %tankschat.O0000OO0 = $iif($version < 5.91,13,11)
    %tankschat.O00000O0 = Tahoma
    %tankschat.O0000O0O = "Tahoma"
  }
  else {
    %tankschat.O0000OO0 = $iif($version < 5.91,13,12)
    %tankschat.O00000O0 = MS Sans Serif
    %tankschat.O0000O0O = "MS Sans Serif"
  }
  if ($1 isnum 0-1) {
    OOO00OO0
    O0OOOO00
    O0OOO000
    drawdot @Tanks
  }
}
on *:dialog:tanksbots:init,sclick:*:{
  if ($devent == init) {
    did -o tanksbots 2 1 %tanksname
    did $iif(%tanksstopbots,-u,-c) tanksbots 18
    did -r tanksbots 22,20
    var %tanks.OO0O000O = 1
    while (%tanks.OO0O000O <= %tanks.O0OOO0OO) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.OO0O000O ] ] isnum) && (%tanks.OO000O00 [ $+ [ %tanks.OO0O000O ] ] isnum) {
        did -a tanksbots 20 %tanks.OO0O000O
        did -a tanksbots 22 %tanks.O0OO00O0 [ $+ [ %tanks.OO0O000O ] ]
      }
      inc %tanks.OO0O000O
    }
    O0O0OO0O
  }
  elseif ($did == 99) && ($dialog(tanksbots).focus == 2) || ($did == 3) {
    OO0O00OO $did(tanksbots,2)
    halt
  }
  elseif ($did isnum 12-17) OOO000OO $calc($did -12)
  elseif ($did == 18) {
    %tanksstopbots = 1 - $did(tanksbots,18).state
    O0OOOO00
  }
  elseif ($did == 22) O0O0OO0O
  elseif ($did == 23) {
    if ($dialog(tankschat)) {
      dialog -ev tankschat
      return
    }
    var %tanks.O0O000OO = $dialog(tankschat,tanksname,-4)
    if ($did(tanksbots,22,1).sel) {
      var %tanks.O00OOOOO = $did(tanksbots,20,$ifmatch), %tanks.O0O000OO = $OO000000($left(%tanks.O0O000OO,21),%tanks.O00OOOOO)
      if (* iswm %tanks.O0O000OO) O0O000OO %tanks.O00OOOOO %tanks.O0O000OO
    }
  }
  elseif ($did == 24) OO00O0OO 1
  elseif ($did == 25) {
    var %tanks.O0O000OO = $did(tanksbots,22,0).sel
    while ($did(tanksbots,22,%tanks.O0O000OO).sel) {
      var %tanks.O0O00OO0 = $did(tanksbots,22,%tanks.O0O000OO).sel
      var %tanks.O00OOOOO = $did(tanksbots,20,%tanks.O0O00OO0)
      did -d tanksbots 20,22 %tanks.O0O00OO0
      O0OOO00O %tanks.O00OOOOO
      dec %tanks.O0O000OO
    }
    O0O0OO0O
  }
}
alias -l OO0OOO00 {
  var %tanks.O0O0OO00 = @Downloading Tanks
  if ($isid) return %tanks.O0O0OO00
  if (* !iswm $window(%tanks.O0O0OO00)) {
    sockclose downloadtanks
    return
  }
  tokenize 32 $sock(downloadtanks).mark
  if ($window(%tanks.O0O0OO00).state != hidden) {
    drawrect -frn %tanks.O0O0OO00 0 1 0 0 152 24
    drawrect -rn %tanks.O0O0OO00 $calc(+$2) 1 0 0 152 24
    drawrect -frn %tanks.O0O0OO00 7368816 1 1 1 $calc(+$calc(150*$sock(downloadtanks).rcvd /$1)) 22
    drawtext -rn %tanks.O0O0OO00 12632256 Fixedsys 15 8 4 Downloading Tanks
    drawdot %tanks.O0O0OO00
  }
}
on *:appactive:{
  if ($version != 6.02) && (%tanks.O00OOO00) {
    unset %tanks.O00OOO00
    window -h @tanksO00000OO
  }
}
alias -l OO0OOOOO {
  var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.OO0O00OO
  while (%tanks.OO00O00O) {
    %tanks.OO0O00OO = %tanks.OO0O00OO $OO0O000O(%tanks.OO00O00O,1)
    dec %tanks.OO00O00O
  }
  tokenize 32 %tanks.OO0O00OO
  while ($1) {
    OO0O000O $1
    tokenize 32 $2-
  }
}
alias -l O0O0O000 {
  if ($timer(tanks.OOO0O0OO2)) return
  var %tanks.O0O0O0O0, %tanks.O00OOOOO = %tanks.OOO00O00, %tanks.OO0O000O = %tanksinc
  if ($istok(O000O0O0 O000OO0O O000000O O0000OOO O0000O00 O000O0OO O00000OO O000OOOO1 O000OOOO2 O000OOOO3 O000OOOO4 O000OOOO5,$1,32)) O0OO0O00 O0000000 $1 $iif($2 isnum,$2,%tanks.OO0O000O)
  if ($1 == O000OOO0) {
    %tanksinc = 1
    O0OOOO00
  }
  if ($1 == O000OO00) {
    %tanksinc = 5
    O0OOOO00
  }
  if ($1 == 0) tokenize 32 $2-
  if ($2 isnum) %tanks.OO0O000O = $2
  if ($1 == O000O0O0) || ($1 == O000OO0O) {
    %tanks.O0O0O0O0 = %tanks.O0O0OO0O [ $+ [ %tanks.O00OOOOO ] ] $replace($1,O000O0O0,+,O000OO0O,-) %tanks.OO0O000O
    if (%tanks.O0O0O0O0 < 0) %tanks.O0O0O0O0 = 0
    if ($iif(%tanks.OO0O0O00 & 1,100,%tanks.O0O0O000 [ $+ [ %tanks.O00OOOOO ] ] ) < %tanks.O0O0O0O0) %tanks.O0O0O0O0 = $ifmatch
    %tanks.O0O0OO0O [ $+ [ %tanks.O00OOOOO ] ] = %tanks.O0O0O0O0
    OO0OOO0O 398 %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ]
  }
  elseif ($1 == O000000O) || ($1 == O0000OOO) {
    %tanks.O0O0O0O0 = $replace($1,O000000O,1,O0000OOO,-1)
    inc %tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] $calc(%tanks.OO0O000O *%tanks.O0O0O0O0)
    if ($calc(%tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] -%tanks.OO0O000O *%tanks.O0O0O0O0) == $calc(90+90*%tanks.O0O0O0O0)) %tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] = $calc(90-90*%tanks.O0O0O0O0)
    if (%tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] < 0) %tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] = 0
    if (%tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] > 180) %tanks.OOO0OO0O [ $+ [ %tanks.O00OOOOO ] ] = 180
    O0OO000O
    OO0O000O %tanks.O00OOOOO
  }
  elseif (O000OOOO? iswm $1) {
    %tanks.OOO0O000 = $O00OOOOO
    if (%tanks.OOO0O000 > $right($1,1)) %tanks.OOO0O000 = $right($1,1)
    OO00OO0O
  }
  elseif ($1 == O0000O00) {
    %tanks.OO0O000O = $calc(1+%tanks.OOO0O000)
    if (%tanks.OO0O000O > 5) %tanks.OO0O000O = 5
    if ($calc(25*%tanks.OO0O000O) <= %tanks.O00O0OOO [ $+ [ %tanks.O00OOOOO ] ] ) %tanks.OOO0O000 = %tanks.OO0O000O
    OO00OO0O
  }
  elseif ($1 == O000O0OO) {
    dec %tanks.OOO0O000
    if (%tanks.OOO0O000 < 1) %tanks.OOO0O000 = 1
    OO00OO0O
  }
  elseif ($1 == O00000OO) OO0O0000
  elseif ($1 == O0000000) {
    if (%tanks.OOO00O00 == %tanks.OOO00000) && ($timer(tanks.OOO0O0OO2)) return
    OOO0O0OO
  }
  elseif ($1 == O000O00O) && (%tanks.O00O00OO > 0) {
    dec %tanks.O00O00OO %tanks.O0OOOO00
    O0OOO000
  }
  elseif ($1 == O0000OO0) {
    var %tanks.O00OOOOO = %tanks.O0OOO0OO
    while (%tanks.O00OOOOO) && (%tanks.O00OO0OO [ $+ [ %tanks.O00OOOOO ] ] !isnum) {
      dec %tanks.O00OOOOO
    }
    if (%tanks.O00OOOOO > $calc(8+%tanks.O00O00OO)) inc %tanks.O00O00OO %tanks.O0OOOO00
    O0OOO000
  }
  drawdot @Tanks
}
on *:close:@tanksO0000O0O:O0000O0O
on *:unload:{
  O0000O0O
  unset %tanks*
}
on *:sockclose:tanks.*:if ($gettok($sockname,2,46) isnum) O0OOO00O $ifmatch
on *:sockread:tanks:{
  var %tanks.OO0O00OO, %tanks.O0O000OO
  if ($sockerr) {
    OO0O0OOO $ifmatch $sockname sockread
    return
  }
  while ($sock($sockname)) {
    sockread %tanks.OO0O00OO
    if ($sockbr !isnum 1-) return
    tokenize 32 %tanks.OO0O00OO
    if ($1 == ver) {
      if ($2 != $tanksversion(1)) {
        if ($2 > $tanksversion(1)) OO000O00 The Tanks server has a newer version ( $+ $2 $+ ). Download the newest by typing $O000O000(/downloadtanks) $+ .
        else OO000O00 The server has an older version ( $+ $2 $+ ). Your version is $tanksversion(1) $+ .
        OOO0OO0O
        continue
      }
      tokenize 32 $3-
    }
    if ($1 == O000OO0O) {
      while ($2) {
        tokenize 32 $2-
        aline @tanksO0000O00 $1
      }
      if ($line(@tanksO0000O00,0) >= %tankswidth) {
        drawrect -rfn @Tanks %tanks.OO000000 1 0 0 %tankswidth %tanks.OO0O00O0
        var %tanks.O0O000OO = 1, %tanks.O00OOOOO = 0
        while (%tanks.O0O000OO <= %tankswidth) {
          drawline -rn @Tanks %tanks.O0000OOO 1 %tanks.O00OOOOO $line(@tanksO0000O00,%tanks.O0O000OO) %tanks.O00OOOOO %tanks.OO0O00O0
          inc %tanks.O0O000OO
          inc %tanks.O00OOOOO
        }
        %tanks.O000OO0O = O00000OO
        if (%tanks.O00OO0OO [ $+ [ %tanks.OOO00000 ] ] isnum) O00O000O
        O0OO0O00 O00O0O0O
      }
      continue
    }
    elseif ($1 == O000O00O) {
      filter -wwcx @tanksO0000O00 @tanksO0000O00
      unset %tanks.O000OO0O
      %tanks.OO00000O = $2
      if ($3 != 1) {
        OO00000O
        OO0OO0O0
      }
    }
    elseif ($1 == O00O0O0O) O0OO0O00 $1
    elseif ($1 == O00000O0) O0OO0O00 O00000OO $2
    elseif ($1 == O00000OO) {
      var %tanks.O00OOOOO = $ctime - $2
      if (%tanks.O00OOOOO) O000O0OO O0000OOO Your lag is $duration(%tanks.O00OOOOO)
      else O000O0OO O0000OOO You have no lag
    }
    elseif ($1 == O0000000) && (%tanks.O000OO0O == O00000OO) O0O0O000 0 $2-
    elseif ($1 == O000O0O0) {
      %tanks.OO0O0O00 = $2
      %tanks.OO00OOOO = $3
      %tanks.OO0000O0 = $4
      %tanks.OOO0OO00 = $5
      %tanks.O000O000 = $6
      %tanks.OOO0O000 = $7
      %tanks.OOO00O00 = $8
      %tanks.OO00000O = $9
      OOO000O0
      O000O00O
      if (%tanks.O000OO0O != O0000000) {
        O000OO0O
        O0O0OOOO
        O0OOO000
        O0OOOO00
        drawdot @Tanks
      }
    }
    elseif ($1 == O00OOO00) {
      %tanks.O000O00O [ $+ [ $4 ] ] = $2
      %tanks.OO000O00 [ $+ [ $4 ] ] = $3
      OO0OO0OO $4-
    }
    elseif ($1 == O00O000O) {
      if ($2) {
        %tanks.OOO0O000 = $2
        %tanks.OOO0OO0O [ $+ [ %tanks.OOO00O00 ] ] = $3
        %tanks.O0O0OO0O [ $+ [ %tanks.OOO00O00 ] ] = $4
      }
      OOO0O0OO $5-
    }
    elseif ($1 == O00O0O00) O00OO0OO $2-
    elseif ($1 == O00O00O0) OO00O0O0 $2-
    elseif ($1 == O00OO0OO) {
      %tanks.O0O0000O = $calc(+$2)
      if (-99 > %tanks.O0O0000O) %tanks.O0O0000O = $ifmatch
      elseif (99 < %tanks.O0O0000O) %tanks.O0O0000O = $ifmatch
    }
    elseif ($1 == O000O0OO) && (%tanksnochat != 1) O000O0OO O000OO00 %tanks.O00OO0OO [ $+ [ $2 ] ] %tanks.O0OO00O0 [ $+ [ $2 ] ] $3-
    elseif ($1 == O0000O00) && (%tanksnochat != 1) O000O0OO O000000O %tanks.O00OO0OO [ $+ [ $2 ] ] %tanks.O0OO00O0 [ $+ [ $2 ] ] $3-
    elseif (%tanksnochat != 1) || ($2 == %tanks.OOO00000) || ($2 == 0) && ($1 == O000OO00) O0O000OO $2-
    elseif ($1 == O0000OO0) {
      O00OOO00 0 $2
      %tanks.O0OO00O00 = $3
      O0000OOO
      close -@ @tanksO0000O00
      window -hl @tanksO0000O00
    }
    elseif ($1 == O000OOO0) O0OOOO0O $2-
    elseif ($1 == O00OO000) %tanksport = $2
    elseif ($1 == O0000OOO) O000O0OO O0000000 $2-
    elseif ($1 == O000O000) O0O00000 $2-
    elseif ($1 == O00O00OO) O0OOO00O O00O00OO $2-
    elseif ($1 == O00OO0O0) O0OOO00O $2-
    elseif ($1 == O00O0OOO) {
      if ($2) %tanks.OOO00000 = $2
      OO0000OO $3-
      if ($2) unset %tanks.O000OO0O
      else {
        O0OOO000
        drawdot @Tanks
        OOO000O0
      }
    }
    elseif ($1 == O00O0OO0) O0O0O00O $2-
    elseif ($1 == O00OOO0O) {
      OO000O00 The Tanks game at %tanksip is full.
      OOO0OO0O
    }
    elseif ($1 == O000OOOO) {
      OO000O00 Tanks: You're trying to reconnect too fast.
      OOO0OO0O
    }
    elseif ($1 == O00OO00O) {
      OO000O00 Tanks: You're banned from the server at %tanksip $+ .
      OOO0OO0O
    }
    elseif ($1 == O0000O0O) {
      OO000O00 Tanks: There is already a connection from your address.
      OOO0OO0O
    }
  }
}
alias -l OO00OO0O {
  drawpic -cnt @Tanks 16711935 206 409 202 26 110 23 %tanksbmp
  var %tanks.O00OOOOO = $O00OOOOO
  if (%tanks.O00OOOOO < %tanks.OOO0O000) %tanks.O00OOOOO = %tanks.OOO0O000
  drawpic -cnt @Tanks 16711935 208 411 204 102 $calc(1+21*%tanks.O00OOOOO) 19 %tanksbmp
  drawpic -cnt @Tanks 16711935 $calc(188+21*%tanks.OOO0O000) 416 $iif(%tanks.OOO00O00 == %tanks.OOO00000,130 104,130 113) 20 9 %tanksbmp
}
alias -l OO0000OO {
  while ($0) {
    O00OOO00 $1 $O00O0O0O($2)
    if (%tanksnochat) && ($sock(tanks)) && ($1 != %tanks.OOO00000) {
      if ($1 == 0) %tanks.O0OO00O00 = Server
      else %tanks.O0OO00O0 [ $+ [ $1 ] ] = Player $+ $1
    }
    else %tanks.O0OO00O0 [ $+ [ $1 ] ] = $3
    tokenize 32 $4-
  }
}
alias -l OO0O0O00 {
  var %tanks.O0O00OO0 = 0, %tanks.O00OOOOO
  while (%tanks.O0O00OO0 <= %tanks.O0OOO0OO) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.O0O00OO0 ] ] isnum) %tanks.O00OOOOO = %tanks.O00OOOOO %tanks.O0O00OO0 %tanks.OOO00O0O [ $+ [ %tanks.O0O00OO0 ] ] %tanks.O0OO00O0 [ $+ [ %tanks.O0O00OO0 ] ]
    inc %tanks.O0O00OO0
  }
  return %tanks.O00OOOOO
}
alias -l O0O0O00O {
  var %tanks.O0O00O0O
  if ($1 == 0) {
    %tanks.O0O00O0O = $2
    tokenize 32 $3-
  }
  %tanks.O0O00000 = $remtok(%tanks.O0O00000,$1,1,44)
  var %tanks.OOO0O00O = $O00O0O0O($2), %tanks.O0O000OO = $3
  if (* !iswm %tanks.O0O000OO) return
  if ($dialog(tanksbots)) && (%tanks.O0O00O0O isnum) {
    var %tanks.OO0O000O = 1
    while ($did(tanksbots,20,%tanks.OO0O000O) < $1) {
      inc %tanks.OO0O000O
    }
    did -i tanksbots 20 %tanks.OO0O000O $1
    did -i tanksbots 22 %tanks.OO0O000O %tanks.O0O000OO
  }
  $O0O00O00($1,$sock(tanks. [ $+ [ $1 ] ] ).ip,%tanks.O0O000OO)
  O00OOO00 $1 %tanks.OOO0O00O
  if (%tanksnochat) && ($sock(tanks)) && ($1 != %tanks.OOO00000) %tanks.O0O000OO = Player $+ $1
  %tanks.O0OO00O0 [ $+ [ $1 ] ] = %tanks.O0O000OO
  OO0OO0OO $1 $OO0OO0OO
  unset %tanks.O000000O [ $+ [ $1 ] ]
  if (* !iswm $timer(tanks.O00O0O00)) && (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] == 5) O00O0O00 0
  %tanks.OO000O00 [ $+ [ $1 ] ] = %tanks.O0O00O0O
  if (* !iswm $sock(tanks)) {
    O00OO0O0 $1 O0000OO0 %tanks.OOO00O0O0 %tanks.O0OO00O00
    O0O00O0O $iif(%tanks.O000OO0O !isin O00000OO O0000O00 O000000O,-) $1 1
    OOO00000 $1
    O00OO0O0 $1 O00O0OOO $1 $OO0O0O00
    if (%tanks.O0O00O0O isnum) %tanks.O0O00O0O = 0 %tanks.O0O00O0O
    O0OO0O00 O00O0OO0 %tanks.O0O00O0O $1 %tanks.OOO0O00O %tanks.O0O000OO
  }
  if ($1 == %tanks.OOO00000) && (%tankslog) && ($sock(tanks)) write " $+ $scriptdir $+ tanks.log" - Connect: %tanksip $+ : $+ %tanksport
  if ($1 == %tanks.OOO00000) && ($line(@tanksO0000O00,1)) && ($sock(tanks)) {
    %tanks.O000OO0O = O00000OO
    O0000OO0
  }
  else {
    O0OOOO00
    O0OOO000
    if ($1 == %tanks.OOO00000) OOO00OO0
  }
  O000O0OO O000O000 %tanks.O00OO0OO [ $+ [ $1 ] ] %tanks.O0O000OO $sock(tanks. [ $+ [ $1 ] ] ).ip
  O0OO0OOO
  O0000O00
}
menu @Tanks color {
  mouse:if ($window(@Tanks color)) O0OO00OO $mouse.x $mouse.y 1
  leave:O0OO00OO 0 0 1
  sclick:{
    var %tanks.OOO0O00O = $O0OO00OO($click(@Tanks color,$click(@Tanks color,0)).x,$click(@Tanks color,$click(@Tanks color,0)).y)
    if (%tanks.OOO0O00O) {
      close -@ @Tanks color @1
      if (%tanks.O00OOOO0 != 1) %tankscolor = %tanks.OOO0O00O
      if ($sock(tanks)) O0OO0O00 O000OOO0 %tanks.OOO0O00O
      elseif (%tanks.O00OOOO0) {
        unset %tanks.O00OOOO0
        if ($dialog(tanksbots)) {
          var %tanks.OO0O000O = 1
          :0
          if ($did(tanksbots,22,%tanks.OO0O000O).sel) {
            O0OOOO0O $did(tanksbots,20,$did(tanksbots,22,%tanks.OO0O000O).sel) %tanks.OOO0O00O
            inc %tanks.OO0O000O
            goto 0
          }
        }
      }
      else O0OOOO0O %tanks.OOO00000 %tanks.OOO0O00O
    }
  }
}
alias tanks {
  if (* !iswm $window(@Tanks)) OOO0OO0O
  else {
    window -a @Tanks
    if (* !iswm $1) return
  }
  $OOO0000O
  tokenize 32 $replace($1-,:,$chr(32))
  if (. isin $1) || ($1 isnum) && ($1 !ischan) && ($2 isnum) {
    %tanksip = $1
    if ($2) %tankssavedport = $2
    %tanksport = %tankssavedport
    OOO0OO0O
    sockopen tanks %tanksip %tanksport
    OO000O00 Tanks: Connecting to %tanksip $+ : $+ %tanksport . . .
    return
  }
  if ($sock(tanks.*,0)) && ($1 isnum 1-65534) O0O0OOO0 /port $1
  var %tanks.OOO00OO0 = $1, %tanks.OO00O00O = 1
  if ($1 == $me) tokenize 32 $2-
  elseif ($1 !isnum) && (. !isin $1) && ($1) {
    if (* !iswm $server) || (* !iswm $ip) {
      OO000O00 Tanks: You are not connected to IRC.
      return
    }
    %tankstempnick = $1
    O0O00OO0 request $tanksversion(1) %tanksip %tanksport
    OO000O00 Tanks invitation sent to $1 $+ .
    %tanks.OO00O00O = 0
    tokenize 32 $2-
  }
  if ($sock(tanks.*,0)) || ($sock(tanks)) return
  OOO0OO0O
  $OOOO0000
  tankscheck
  %tanks.OOO00000 = 0
  %tanks.O0OO00O00 = %tanksserver
  O00OOO00 0 %tankscolor
  if (* !iswm $timer(_tanksd)) {
    %tanks.OOO00000 = 1
    O00OOO00 1 %tankscolor
    %tanks.OO000O001 = 5
    %tanks.O0OO00O01 = $OO000000(%tanksname,1)
    OO0OO0OO 1 $OO0OO0OO
  }
  if (* !iswm %tanks.OOO00OO0) {
    OOO000OO %tanksskill
    %tankspublic = 0
  }
  else %tankspublic = %tanks.OO00O00O
  O0000OOO
  O0000OO0
  sockclose tanks.0
  %tanksip = $ip
  if (%tankssavedport !isnum 1-65534) %tankssavedport = $rand(3000,60000)
  %tanksport = %tankssavedport
  if ($1 isnum 1-65534) {
    %tankssavedport = $1
    %tanksport = $1
  }
  OO00O00O 0 1
  OOO000O0
}
alias -l OOO000O0 {
  if ($window(@Tanks)) {
    var %tanks.O00OOOOO, %tanks.OO00O00O = $iif(%tanks.O000OO0O isin O00000OO O0000O00 O000000O,1)
    if (%tanks.OO00O00O) && (%tankstitle & 1) {
      if (%tanks.O000O000 == 2) %tanks.O00OOOOO =  -  Round %tanks.OO0000O0 of %tanks.OOO0OO00
      else %tanks.O00OOOOO =  -  Round %tanks.OO0000O0
    }
    if (%tanks.OO00O00O) && (%tankstitle & 2) {
      if (%tanks.OOO00000 != 0) %tanks.O00OOOOO = %tanks.O00OOOOO  -  Frags: %tanks.O0OOOO0O [ $+ [ %tanks.OOO00000 ] ]
      if (%tanks.O000O000 == 1) %tanks.O00OOOOO = %tanks.O00OOOOO  -  Frag limit: %tanks.OOO0OO00
    }
    if ($0) %tanks.O00OOOOO =  -  $1-
    else {
      if (%tankstitle & 4) && (%tanks.O0OOO00O [ $+ [ %tanks.OOO00000 ] ] > 0) && (%tanks.OO00O00O) %tanks.O00OOOOO = %tanks.O00OOOOO  -  Accuracy: $calc(+$round($calc(100 * %tanks.OO0OOO00 [ $+ [ %tanks.OOO00000 ] ] / %tanks.O0OOO00O [ $+ [ %tanks.OOO00000 ] ] ),0)) $+ %
      var %tanks.O0O00OO0 = $iif(%tanks.O00OO0OO0 isnum,%tanks.O0OO00O00,%tanks.O0OO00O01)
      if ($sock(tanks)) || ($sock(tanks.*,0)) && (%tankstitle & 8) && (* iswm %tanks.O0O00OO0) && ((%tanksnochat != 1) || (* !iswm $sock(tanks))) %tanks.O00OOOOO = %tanks.O00OOOOO  -  Server: %tanks.O0O00OO0
    }
    titlebar @Tanks $iif(%tanks.OO0O0O00 & 1,instagib) %tanks.O00OOOOO
  }
}
on *:keydown:@tanks:*:{
  if (%tanks.OOO00O00 == %tanks.OOO00000) O00O0O00 0
  var %tanks.O00OOOOO = $keyval
  if ($mouse.key & 2) && (%tanks.O00OOOOO isnum 35-36) {
    if (%tanks.O00OOOOO == 35) %tankschat.O00OOO00 = 0
    else %tankschat.O00OOO00 = %tankschat.O00OO000 - 11
    if (%tankschat.O00OOO00 < 0) %tankschat.O00OOO00 = 0
    OOO00OO0
  }
  elseif (%tanks.O000OO0O %tanks.O00OOOOO == O00000O0 13) O00OOOO0
  elseif (%tanks.O000OO0O == O000000O) O0O0O000 $OOO00O0O($replace(%tanks.O00OOOOO,38,O000O0O0,40,O000OO0O,37,O000000O,39,O0000OOO,45,O000OOOO1,36,O000OOOO5,46,O000O0OO,35,O0000O00,49,O000OOOO1,50,O000OOOO2,51,O000OOOO3,52,O000OOOO4,53,O000OOOO5,13,O0000000,32,O00000OO,9,$iif(%tanksinc == 1,O000OO00,O000OOO0)))
  if ($istok(84 89 77,%tanks.O00OOOOO,32)) .timertanks.OOO0OO00 -o 1 0 OOO0OO00 $iif(%tanks.O00OOOOO == 77,1)
  elseif (%tanks.O00OOOOO == 33) OOO0O00O $iif($mouse.key !& 2,11)
  elseif (%tanks.O00OOOOO == 34) OOO00O00 $iif($mouse.key !& 2,11)
  elseif (%tanks.O00OOOOO == 219) O0O0O000 O000O00O
  elseif (%tanks.O00OOOOO == 221) O0O0O000 O0000OO0
}
alias -l O00OO0OO {
  if ($sock(tanks)) && ($1 != 1) return
  if ($sock(tanks.*,0)) O0OO0O00 O00O0O00 1
  var %tanks.O0O000OO = %tanks.O0OOO0OO, %tanks.OO0OO0O0
  while (%tanks.O0O000OO) {
    if (%tanks.O000O000 == 1) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) && (%tanks.O0OOOO0O [ $+ [ %tanks.O0O000OO ] ] >= %tanks.OOO0OO00) %tanks.OO0OO0O0 = 1
    elseif %tanks.O000O000 == 2) && (%tanks.OO0000O0 >= %tanks.OOO0OO00) %tanks.OO0OO0O0 = 1
    dec %tanks.O0O000OO
  }
  if (%tanks.OO0OO0O0) OO00O0O0
  else {
    inc %tanks.OO0000O0
    OO00000O
  }
}
alias -l O0O0000O {
  iline @tanksO0000O0O 1 $1-
  inc %tankschat.O00OO000
  if (%tankschat.O00OOO00 > 0) {
    inc %tankschat.O00O0000
    inc %tankschat.O000O000
    inc %tankschat.O00OOO00
  }
  if (%tankschat.O000OO00 > 0) inc %tankschat.O000OO00
  if (%tankschat.O00O0O0O) && (%tankschat.O00OOO00 == 0) {
    %tankschat.O00OOO00down = 1
    %tankschat.O00OOO00 = 1
    inc %tankschat.O00O0000
    inc %tankschat.O000O000
  }
}
alias -l OOO0O0O0 {
  if ($sock(tanks.*,0) == 0) return
  var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.O0O000OO = 0, %tanks.OOO0O0O0 = 0, %tanks.OO0OO0O0 = 0
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      if (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] !isnum 0-4) {
        if (%tanks.O000O00O [ $+ [ %tanks.OO00O00O ] ] ) inc %tanks.OOO0O0O0
        elseif (%tanks.O0OO0O00 [ $+ [ %tanks.OO00O00O ] ] > 0) return
        else inc %tanks.OO0OO0O0
      }
      inc %tanks.O0O000OO
    }
    dec %tanks.OO00O00O
  }
  if (%tanks.O0O000OO > 1) {
    if (%tanks.OOO0O0O0) return 1
    if (%tanks.OO0OO0O0 == 0) && (%tanksstopbots) return 2
  }
}
alias -l OO000000 {
  var %tanks.O0O000OO = $deltok($replace($remove($strip($1),$chr(1)),$chr(32), ),0,160), %tanks.O00OOO0O = 1
  while (%tanks.O00OOO0O <= $len(%tanks.O0O000OO)) {
    if ($asc($mid(%tanks.O0O000OO,%tanks.O00OOO0O,1)) < 33) {
      %tanks.O0O000OO = $left(%tanks.O0O000OO,$calc(%tanks.O00OOO0O -1))
      break
    }
    inc %tanks.O00OOO0O
  }
  if (* !iswm %tanks.O0O000OO) {
    if (%tanks.O0OO00O0 [ $+ [ $2 ] ] != $null) %tanks.O0O000OO = $ifmatch
    elseif ($me) %tanks.O0O000OO = $me
    else %tanks.O0O000OO = Tank $+ $right($ticks,5)
  }
  if ($left(%tanks.O0O000OO,-1) === Skill ) && ($right(%tanks.O0O000OO,1) isnum 0-4) && (%tanks.OO000O00 [ $+ [ $2 ] ] != $right(%tanks.O0O000OO,1)) %tanks.O0O000OO = %tanks.O0O000OO $+ $rand(0,9)
  %tanks.O00OOO0O = %tanks.O0OOO0OO
  while (%tanks.O00OOO0O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.O00OOO0O ] ] isnum) && (%tanks.O0O000OO === %tanks.O0OO00O0 [ $+ [ %tanks.O00OOO0O ] ] ) && (%tanks.O00OOO0O != $2) {
      %tanks.O0O000OO = %tanks.O0O000OO $+ $rand(0,9)
      %tanks.O00OOO0O = %tanks.O0OOO0OO
      continue
    }
    dec %tanks.O00OOO0O
  }
  return %tanks.O0O000OO
}
alias -l O0O000OO {
  if (* !iswm $2) || (%tanks.O0OO00O0 [ $+ [ $1 ] ] === $2) return
  if ($dialog(tanksbots)) {
    var %tanks.OO0O000O = $did(tanksbots,20).lines
    while (%tanks.OO0O000O) {
      if ($did(tanksbots,20,%tanks.OO0O000O) == $1) did $iif($did(tanksbots,22,%tanks.OO0O000O).state,-ock,-o) tanksbots 22 %tanks.OO0O000O $2
      dec %tanks.OO0O000O
    }
  }
  var %tanks.OO00O00O = %tanks.O0OO00O0 [ $+ [ $1 ] ]
  if ($1 == 0) %tanks.OO00O00O = (server)  $+ %tanks.OO00O00O
  %tanks.O0OO00O0 [ $+ [ $1 ] ] = $2
  if ($1 < 2) && (%tanks.OOO00000 == 0) OOO000O0
  O0OO0OOO
  O0OOO000
  OOO000O0
  O000O0OO O0000O00 %tanks.O00OO0OO [ $+ [ $1 ] ] %tanks.OO00O00O $2
  if ($sock(tanks.*,0)) {
    O0OO0O00 O000OO00 $1 $2
    O0000O00
  }
}
alias -l O0OO0000 {
  if ($1) $1-
  else {
    O0000000
    unset %tanks.O000OO0O
    drawdot @Tanks
    var %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.O0O000OO = 0, %tanks.OOO0O0O0 = 0
    while (%tanks.OO00O00O) {
      if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
        if (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] !isnum 0-4) inc %tanks.OOO0O0O0
        inc %tanks.O0O000OO
      }
      dec %tanks.OO00O00O
    }
    if (* !iswm $1) && (%tanks.O0O000OO > 1) {
      if (%tanks.OOO00O00 == %tanks.OOO00000) {
        %tanks.O000OO0O = O0000O00
        O000OOOO OO000OO0 3
      }
      elseif (%tanks.OO000O00 [ $+ [ %tanks.OOO00O00 ] ] isnum 0-4) && (* !iswm $sock(tanks)) {
        %tanks.O000OO0O = O00000OO
        .timertanks.OO0OOOO0 -om 1 $rand(275,400) OO0OOOO0
      }
      else %tanks.O000OO0O = O00000OO
    }
    if (%tanks.OOO00O00 == %tanks.OOO00000) {
      if (%tanksnopop != 1) && ($window(@Tanks).state == minimized) window -a @Tanks
      OO00O000 1
    }
  }
  O00O0O00 0
  if ($version != 6.02) {
    window -h @tanksO00000OO
    unset %tanks.O00OOO00
  }
}
menu @tanksO0000O00 {
  mouse:window -h @tanksO0000O00
  sclick:window -h @tanksO0000O00
}
alias -l O0OO0O00 {
  if ($sock(tanks)) sockwrite -tn tanks $1-
  else {
    var %tanks.O0O00OO0, %tanks.O0O000OO = %tanks.O0OOO0OO
    while (%tanks.O0O000OO) {
      %tanks.O0O00OO0 = tanks. $+ %tanks.O0O000OO
      if ($sock(%tanks.O0O00OO0)) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) sockwrite -tn %tanks.O0O00OO0 $1-
      dec %tanks.O0O000OO
    }
  }
}
on *:close:@Tanks:O0000O0O
alias -l OO00O0OO {
  %tanks.O00OOOO0 = $1
  if ($version != 6.02) window -h @tanksO00000OO
  var %tanks.O00OOOOO, %tanks.OOO0O00O = 1, %tanks.O0O000OO = $numtok(%tanks.O0OOOOO0,32), %tanks.O0O0OO00 = $calc(94+8*%tanks.O00O0000), %tanks.OOO0O0O0 = $calc(20+8*%tanks.OO0O0O0O)
  close -@ @Tanks color
  window -Bhdofpk +Ltf @Tanks color $int($calc($window(@Tanks).x +(%tankswidth -%tanks.O0O0OO00)/2)) $int($calc($window(@Tanks).y +(%tanksheight -%tanks.OOO0O0O0)/2)) %tanks.O0O0OO00 %tanks.OOO0O0O0
  drawrect -rfn @Tanks color %tanks.15 1 0 0 %tanks.O0O0OO00 %tanks.OOO0O0O0
  tokenize 32 %tanks.O00O0000 %tanks.OO0O0O0O
  if ($version < 6.02) tokenize 32 $calc($1 -1) $calc($2 -1)
  drawcopy -nt @tanksO000000O 16711935 0 0 $1-2 @Tanks color 10 10 $calc(8*%tanks.O00O0000 -1) $calc(8*%tanks.OO0O0O0O -1)
  var %tanks.O00OOO0O = $calc(20+8*%tanks.O00O0000), %tanks.O0000O00 = $calc(8*%tanks.OO0O0O0O -54)
  drawtext -rn @Tanks color 0 Fixedsys 15 %tanks.O00OOO0O 10 Selected
  drawrect -r @Tanks color %tanks.14 1 %tanks.O00OOO0O %tanks.O0000O00 64 64
  drawdot @Tanks color
  window -a @Tanks color
}
alias -l OO00OO00 {
  %tanksmode = $did(tanksserver,4).state
  %tanks.OO0O0O00 = %tanksmode
  %tankslimitmode = $did(tanksserver,5).state * $did(tanksserver,6,1).sel
  %tanks.O000O000 = %tankslimitmode
  if ($int($did(tanksserver,7)) isnum 1-999) %tankslimit = $ifmatch
  else %tankslimit = 10
  %tanks.OOO0OO00 = %tankslimit
  %tankscwind = $did(tanksserver,8,1).sel - 1
  %tanks.OO00OOOO = %tankscwind
  if ($int($did(tanksserver,9)) isnum 2-32) %tanksplayerlimit = $ifmatch
  else %tanksplayerlimit = 8
  %tanksonecon = 1 - $did(tanksserver,12).state
  OOO0OOO0
  if ($window(@Tanks)) {
    OOO000O0
    O000O00O
    O000OO0O
    O0O0OOOO
    O0OOO000
    O0OOOO00
    drawdot @Tanks
  }
  OOO00000
  O0OO0OOO
}
menu @Downloading Tanks {
  sclick:O0O0O0O0 $calc($mouse.dx -$window($OO0OOO00).x) $calc($mouse.dy -$window($OO0OOO00).y)
  &Cancel:{
    close -@ $OO0OOO00
    sockclose downloadtanks
  }
}
alias -l tanklistmsg {
  sockclose tanklist
  if (* !iswm $dialog(tanklist)) return
  did -rz tanklist 1,9,5
  did -a tanklist 1  
  did -a tanklist 1     $1-
  did -a tanklist 1  
  did -a tanklist 9 rem
  did -a tanklist 9 rem
  did -a tanklist 9 rem
}
alias -l O00O0O0O {
  if ($istok(%tanks.O0OOOOO0,$1,32)) return $1
  if (, isin $1) {
    var %tanks.OOO00OO0 = $1, %tanks.O00OOOOO = 1
    tokenize 44 $rgb($getdot(@tanksO000000O, [ $1 ] ))
    if ($1 > 222) && ($2 < 32) && ($3 > 222) %tanks.O00OOOOO = 0
    if ($gettok(%tanks.OOO00OO0,1,44) isnum 0- [ $+ [ $calc(%tanks.O00O0000 -1) ] ] ) if ($gettok(%tanks.OOO00OO0,2,44) isnum 0- [ $+ [ $calc(%tanks.OO0O0O0O -1) ] ] ) if (%tanks.O00OOOOO) return %tanks.OOO00OO0
  }
  return $gettok(%tanks.O0OOOOO0,$rand(1,$numtok(%tanks.O0OOOOO0,32)),32)
}
on *:dialog:abouttanks:init,sclick:*:{
  if ($devent == init) {
    did -a abouttanks 1 $tanksversion $+ $crlf $+ by Andy Dufilie
    tankscheck
  }
  if ($did == 3) tankscheck
  if ($did == 4) downloadtanks
  if ($did == 99) run http://pages.cthome.net/pdufilie/
  if ($did == 97) tanksreadme
}
alias -l OO0OO0OO {
  if ($isid) {
    if ($1) return %tanks.OOO000O0 [ $+ [ $1 ] ] %tanks.OO00O0O0 [ $+ [ $1 ] ] %tanks.OOO0OO0O [ $+ [ $1 ] ] %tanks.O0O0OO0O [ $+ [ $1 ] ] %tanks.O0O0O000 [ $+ [ $1 ] ] %tanks.O0OO0O00 [ $+ [ $1 ] ] %tanks.O00O0OOO [ $+ [ $1 ] ] %tanks.O0OOOO0O [ $+ [ $1 ] ] %tanks.OO0OOO00 [ $+ [ $1 ] ] %tanks.O0OOO00O [ $+ [ $1 ] ] %tanks.O00OO0O0 [ $+ [ $1 ] ]
    return 0 0 0 0 0 0 0 0 0 0 0
  }
  %tanks.OOO000O0 [ $+ [ $1 ] ] = $2
  %tanks.OO00O0O0 [ $+ [ $1 ] ] = $3
  %tanks.OOO0OO0O [ $+ [ $1 ] ] = $4
  %tanks.O0O0OO0O [ $+ [ $1 ] ] = $5
  %tanks.O0O0O000 [ $+ [ $1 ] ] = $6
  %tanks.O0OO0O00 [ $+ [ $1 ] ] = $7
  %tanks.O00O0OOO [ $+ [ $1 ] ] = $8
  %tanks.O0OOOO0O [ $+ [ $1 ] ] = $9
  %tanks.OO0OOO00 [ $+ [ $1 ] ] = $10
  %tanks.O0OOO00O [ $+ [ $1 ] ] = $11
  %tanks.O00OO0O0 [ $+ [ $1 ] ] = $12
}
alias -l OO0O000O {
  var %tanks.OOO0O00O = %tanks.O00OO0OO [ $+ [ $1 ] ] , %tanks.O00OOO0O = %tanks.OOO000O0 [ $+ [ $1 ] ] , %tanks.O0000O00 = %tanks.OO00O0O0 [ $+ [ $1 ] ] , %tanks.OOO00OOO = -8, %tanks.O000OOO0 = 9 + %tankswidth, %tanks.O0O000OO = %tanks.O0OOO0OO, %tanks.O0O00OO0 = %tanks.O0OO0O00 [ $+ [ $1 ] ] , %tanks.OO00O00O = 312, %tanks.O0O0O0O0 = %tanks.OOO0OO0O [ $+ [ $1 ] ]
  if (%tanks.OOO0O00O isnum) && (%tanks.O00OOO0O) { }
  else return
  while (%tanks.O0O000OO) {
    if (%tanks.O0OO0O00 [ $+ [ %tanks.O0O000OO ] ] > 0) && (%tanks.O00OO0OO [ $+ [ %tanks.O0O000OO ] ] isnum) && (%tanks.O0O000OO != $1) {
      var %tanks.OO0OO0O0 = %tanks.OOO000O0 [ $+ [ %tanks.O0O000OO ] ]
      if (%tanks.OO0OO0O0 < %tanks.O00OOO0O) && (%tanks.OO0OO0O0 > %tanks.OOO00OOO) %tanks.OOO00OOO = %tanks.OO0OO0O0
      if (%tanks.OO0OO0O0 > %tanks.O00OOO0O) && (%tanks.OO0OO0O0 < %tanks.O000OOO0) %tanks.O000OOO0 = %tanks.OO0OO0O0
    }
    dec %tanks.O0O000OO
  }
  inc %tanks.OOO00OOO 18
  dec %tanks.O000OOO0 18
  if (%tanks.O0O00OO0 < 1) {
    if (%tanks.OO0O0OO0 [ $+ [ $1 ] ] ) return
    %tanks.OOO0O00O = %tanks.OO000000
    %tanks.OO0O0OO0 [ $+ [ $1 ] ] = 1
  }
  else %tanks.OO0O0OO0 [ $+ [ $1 ] ] = 0
  var %tanks.O0O0OOOO = drawfill -srn @Tanks %tanks.OO000000 %tanks.OOO0O00O, %tanks.O000OOOO = drawfill -srn @Tanks %tanks.OOO0O00O 16777215
  %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
  var %tanks.O0OOO0O0 = %tanks.O00OOO0O - 6, %tanks.O0O0O00O = %tanks.O00OOO0O + 5, %tanks.O0O00OOO = %tanks.O00OOO0O, %tanks.OO0OOO0O = %tanks.O00OOO0O + 1, %tanks.OO0OO0O0, %tanks.O0O000OO = 1, %tanks.O00OOOOO = drawline -rn @Tanks 16777215 1
  if (%tanks.O0O0O0O0 > $iif(%tanks.O00OOO0O > $calc(%tankswidth /2),89,90)) {
    inc %tanks.O0OOO0O0
    inc %tanks.O0O0O00O
    dec %tanks.O0O00OOO 2
    dec %tanks.OO0OOO0O 4
    inc %tanks.OO00O00O 15
    %tanks.O0O000OO = -1
  }
  %tanks.O0O0O0O0 = $calc(%tanks.O0O0O0O0 *3.14159/180)
  var %tanks.OO0O0OOO = $round($calc(6*$cos(%tanks.O0O0O0O0)),0), %tanks.OOO00OO0 = $round($calc(7+6*$sin(%tanks.O0O0O0O0)),0), %tanks.O0OO0000, %tanks.OO0O000O = -1
  if ($2) %tanks.O0OO0000 = return $1
  :1
  inc %tanks.OO0O000O
  drawrect -rnf @Tanks %tanks.OO000000 1 $calc(%tanks.O00OOO0O -6) $calc(%tanks.O0000O00 -13) 11 12
  drawpic -cnt @Tanks 16711935 $calc(%tanks.O00OOO0O -8) $calc(%tanks.O0000O00 -9) %tanks.OO00O00O 0 15 10 %tanksbmp
  %tanks.O00OOOOO $calc(%tanks.OO0OOO0O +%tanks.OO0O0OOO) $calc(1+%tanks.O0000O00 -%tanks.OOO00OO0) %tanks.OO0OOO0O $calc(%tanks.O0000O00 -6)
  %tanks.O00OOOOO $calc(%tanks.O0O00OOO +%tanks.O0O000OO +%tanks.OO0O0OOO) $calc(%tanks.O0000O00 -%tanks.OOO00OO0) %tanks.O0O00OOO $calc(%tanks.O0000O00 -6)
  %tanks.O00OOOOO $calc(%tanks.O0O00OOO +%tanks.OO0O0OOO) $calc(%tanks.O0000O00 -%tanks.OOO00OO0) %tanks.O0O00OOO $calc(%tanks.O0000O00 -7)
  %tanks.O000OOOO %tanks.O00OOO0O %tanks.O0000O00
  if (%tanks.OOO0O00O == %tanks.OO000000) {
    var %tanks.O0OOOOOO = 21, %tanks.O000OO00, %tanks.OOO0O0O0
    while (%tanks.O0OOOOOO) {
      %tanks.O000OO00 = $calc(%tanks.O00OOO0O +%tanks.O0OOOOOO -11)
      %tanks.OOO0O0O0 = %tanks.O000OO00 - 1
      drawline -rn @Tanks %tanks.O0000OOO 1 %tanks.OOO0O0O0 $line(@tanksO0000O00,%tanks.O000OO00) %tanks.OOO0O0O0 %tanks.OO0O00O0
      dec %tanks.O0OOOOOO
    }
  }
  if (%tanks.OO0O000O) drawdot @Tanks
  if (%tanks.O0O00OO0 < 1) return
  var %tanks.O0OOOOOO = $iif(%tanks.O0000O00 >= $line(@tanksO0000O00,%tanks.O0OOO0O0),1), %tanks.OO0O00OO = $iif(%tanks.O0000O00 >= $line(@tanksO0000O00,%tanks.O0O0O00O),1)
  if (%tanks.O0OOOOOO) && (%tanks.OO0O00OO) goto 3
  if (%tanks.OO0O00OO) && (%tanks.OO0OO0O0 == O000000O) || ((%tanks.O0OOOOOO) && (%tanks.OO0OO0O0 == O0000000)) {
    %tanks.O0OO0000
    %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
    inc %tanks.O0000O00
    goto 1
  }
  var %tanks.OO0OO00O = 0 + $line(@tanksO0000O00,%tanks.O00OOO0O)
  if ($calc(2+%tanks.O0000O00) > %tanks.OO0OO00O) goto 3
  if (%tanks.OO0O00OO) {
    if (%tanks.O00OOO0O > %tanks.OOO00OOO) {
      %tanks.O0OO0000
      %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
      dec %tanks.O0O00OOO
      dec %tanks.OO0OOO0O
      dec %tanks.O00OOO0O
      dec %tanks.O0OOO0O0
      dec %tanks.O0O0O00O
      %tanks.OO0OO0O0 = O0000000
      goto 1
    }
  }
  elseif (%tanks.O0OOOOOO) {
    if (%tanks.O00OOO0O < %tanks.O000OOO0) {
      %tanks.O0OO0000
      %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
      inc %tanks.O0O00OOO
      inc %tanks.OO0OOO0O
      inc %tanks.O00OOO0O
      inc %tanks.O0OOO0O0
      inc %tanks.O0O0O00O
      %tanks.OO0OO0O0 = O000000O
      goto 1
    }
  }
  elseif ($calc(2+%tanks.O0000O00) < %tanks.OO0OO00O) {
    %tanks.O0OO0000
    %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
    inc %tanks.O0000O00 2
    goto 1
  }
  else {
    %tanks.O0OO0000
    %tanks.O0O0OOOO %tanks.O00OOO0O %tanks.O0000O00
    inc %tanks.O0000O00
    goto 1
  }
  :3
  %tanks.OOO000O0 [ $+ [ $1 ] ] = %tanks.O00OOO0O
  %tanks.OO00O0O0 [ $+ [ $1 ] ] = %tanks.O0000O00
}
on *:load:tanks.init
alias -l O00O000O {
  %tanks.O000OO0O = O00000OO
  O0000OO0 0
  OOO00OOO h1
  unset %tanks.O000OO0O
  O0OO0000
}
on *:close:@tanksO0000O00:O0000O0O
alias -l OO0OO000 {
  drawpic -c
  tokenize 32 15790320 0 8388608 32768 240 128 8388736 10526880 6316128 11579568 3158064 20644 15728640 16496 8421504 13684944 8388688 8411136 2121760
  close -@ @tanksO00000O0
  if ($version < 5.71) window -pd @tanksO00000O0
  else window -Bhp @tanksO00000O0
  var %tanks.O00OOO0O = 0, %tanks.OOO0O00O
  while ($1 isnum) {
    drawdot -r @tanksO00000O0 $1 0 1 1
    %tanks. [ $+ [ %tanks.O00OOO0O ] ] = $getdot(@tanksO00000O0,1,1)
    tokenize 32 $2-
    inc %tanks.O00OOO0O
  }
  close -@ @tanksO00000O0
  if (%tanks.14 == %tanks.8) %tanks.8 = $rgb(128,128,0)
}
alias -l O0O0OO0O {
  if ($dialog(tanksbots)) {
    did $iif($did(tanksbots,22,0).sel == 1,-e,-b) tanksbots 23
    did $iif($did(tanksbots,22,0).sel,-e,-b) tanksbots 24,25
  }
}
alias -l O0OO0OOO {
  if (* !iswm $window(@Tanks)) return
  var %tanks.O00OOOOO, %tanks.OO00O00O = %tanks.O0OOO0OO, %tanks.O0O000OO = 0, %tanks.O0O00OO0 = 0
  while (%tanks.OO00O00O) {
    if (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) {
      if (%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] == 5) %tanks.O0O00OO0 = 1
      inc %tanks.O0O000OO
      if ($len(%tanks.O00OOOOO) < 800) {
        var %tanks.OO0O000O = $sock(tanks. [ $+ [ %tanks.OO00O00O ] ] ).ip
        %tanks.O00OOOOO =   $iif(%tanks.OO0O000O,%tanks.OO0O000O,%tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] ) $replace(%tanks.O0OO00O0 [ $+ [ %tanks.OO00O00O ] ] ,%,$right(.%25,3),+,$right(.%2B,3),$chr(35),$right(.%23,3),&,$right(.%26,3)) %tanks.O00OOOOO
      }
    }
    dec %tanks.OO00O00O
  }
  %tanks.O00OOOOO = %tanks.O0OO00O00 %tanksport %tanks.O0O00OO0 %tanks.O0O000OO %tanksplayerlimit %tanks.OO0O0O00 %tanks.OO00OOOO %tanks.O000O000 %tanks.OOO0OO00 %tanks.O00OOOOO
  OOO0O000 action=add&game= $+ $replace(%tanks.O00OOOOO,$chr(32),$right(.%20,3))
  if ($sock(tanks.0)) .timertanks.O0OO0OOO -o 1 285 O0OO0OOO
}
alias -l OOO000OO {
  var %tanks.OO00O00O = 1
  while (1) {
    var %tanks.O0O00OO0 = tanks. $+ %tanks.OO00O00O
    if ($sock(%tanks.O0O00OO0)) || (%tanks.O00OO0OO [ $+ [ %tanks.OO00O00O ] ] isnum) inc %tanks.OO00O00O
    else break
  }
  if (%tanks.OO00O00O > %tanks.O0OOO0OO) return 1
  if ($1 !isnum 0-4) tokenize 32 $rand(0,4)
  else %tanksskill = $1
  %tanks.OO000O00 [ $+ [ %tanks.OO00O00O ] ] = $1
  O0O0O00O 0 $1 %tanks.OO00O00O 0 Skill  $+ $1
}
