ProjectX Snake — File Browser

ProjectXSnakev1.07 / ProjectXSnakev1.07 / pxsnk.mrc

pxsnk.mrc — 37.85 KB — Download this file

;---------<  ProjectX mIRC Scripters Crew >-----------
; Filename..: pxsnk.mrc [ProjectX Snake]
; Release...: v1.07
; Author....: SirNo3DfX
; Bugreport.: the.boss@no3dfx.com
; Date......: Monday, March 8, 2004
; URL.......: http://www.projectx.mx.dk/
; E-mail....: info@projectx.mx.dk
; Extra.....: This is a cute little snake game
; Short.....: pxsnk
; Base......: 3.41
;-----------------------------------------------------

;-------- -  -
; Aliases
;-------- -  -
alias pxsnk.unload if ($1- == $px.nam) { dlgx pxsnake.setup pxsnk.mod pxsnk.load | close -@ @Snaketen | close -@ @snakelvl | close -@ @Snake | close -@ @Snake.editor | hfree -w pxsnk* | hfree -w pxsk* | px.unreg | px.set pxsnk | px.set pxsnk_scores | px.echo -ae $px.nam(1) unloaded successfully. | .unload -rs $+(",$script,") }
alias -l gfx var %. = $shortfn($scriptdirpxsnkgfx.png) | if ($isfile(%.)) return %. | else { pxsnk.closea | var %: = $input(Can not find pxsnkgfx.png. $crlf Closing all addon @windows,260,Can not find graphichs file) | halt }
alias -l dlg dialog $iif($dialog($iif($3,$3,$1)),-v $3,-m $+ $2- $1) $1
alias -l dlgx var %i = $0 | while (%i) { var %d = $ [ $+ [ %i ] ] | if ($dialog(%d)) dialog -x %d | dec %i  }
alias -l pxsnk.editu var %i = 1 | while ($ini($scriptdirpxsnk_levels.ini,$+(level_untitled,%i))) inc %i | hadd -m pxsnk level Untitled $+ %i
alias -l pxsnk.snkclose close -@ @Snake | .timerpxsnk off | hfree -w pxsnk* | close -@ @snakelvl
alias -l linfo if (!$window(@snakelvl)) { window -aoBdfph +Ld @snakelvl $calc($window(@snake).x + 76) $calc($window(@snake).y + 150) 153 18 | $pxsnk.button(@snakelvl,0,0,153,18,3355443,10066329,2236962,1,Level: $iif($1,$1,not avaliable),9) | .timer -o 1 2 linfo.cls }
alias -l pxsnk.tenc hfree -w pxskten* | if ($window(@Snake)) window -a @Snake
alias -l pxsnk.dlgc if ($dialog(pxsnake.setup)) { did $iif($did(pxsnake.setup,23).seltext == <clean> || $window(@snake),-b,-e) pxsnake.setup 28 | did $iif($window(@snake.editor),-b,-e) pxsnake.setup 27 }
alias -l linfo.cls close -@ @snakelvl | if ($window(@Snake)) window -ra @Snake
alias -l pxsnk.tmpgfx if ($dialog(pxsnake.setup)) { window -fph +d @Snake.tmp -1 -1 28 28 | var %. = drawrect -fr @Snake.tmp,%h = $iif($gettok($px.get(pxsnk,n1),1,32),$ifmatch,52428),%b = $iif($gettok($px.get(pxsnk,n1),2,32),$ifmatch,16711680) | %. 3355443 0 0 0 28 28 | %. %b 0 13 8 4 10 | %. %b 0 1 18 16 4 | %. %h 0 13 8 4 4 | drawsave @Snake.tmp $shortfn($scriptdir) $+ tmp.bmp | did -g pxsnake.setup 12 $shortfn($scriptdir) $+ tmp.bmp | %. 3355443 0 0 0 28 28 | %. %b 0 13 0 4 13 | %. %b 0 1 12 16 4 | drawsave @Snake.tmp $shortfn($scriptdir) $+ tmp.bmp | did -g pxsnake.setup 13 $shortfn($scriptdir) $+ tmp.bmp | close -@ @Snake.tmp | .remove $shortfn($scriptdir) $+ tmp.bmp }
alias -l pxsnk.closea close -@ @snakelvl | close -@ @Snake | close -@ @Snake.editor | pxsnk.tenc | pxsnk.snkclose | pxsnk.editorc
alias -l pxsnk.start if ($window(@Snake)) window -aC @Snake | else window -hpdCusk0 $+ $iif($px.get(pxsnk,n3),o) +t @Snake 0 0 306 346 | pxsnk.dlgc | var %. = drawrect -nr @Snake 52428 1,%.. = drawtext -n @Snake 0 "Ms Serif" -7 | drawrect -nrf @Snake 3355443 1 0 0 302 330 | %. 4 4 290 290 | %. 4 296 290 19 | %. 54 296 240 19 | %. 158 296 72 19 | %. 6 298 47 15 | %. 56 298 101 15 | %. 160 298 68 15 | %. 231 298 61 15 | tokenize 32 $iif($gettok($px.get(pxsnk,n1),5,32),$px.get(pxsnk,n1),52428 16711680 1 <clean> 3) | %.. 162 299 speed: $gettok(snail slow normal fast extreme,$5,32) | %.. 234 299 points: 0 | write -c snake.mov $str(36 -1 $crlf ,4) 36 0 | hfree -w pxsnk | hadd -m pxsnk sc $1 | hadd -m pxsnk hc $2 | hadd -m pxsnk speed $5 | hadd -m pxsnk type $3 | $pxsnk.load($iif($3 == 2,level_ $+ $4,1),@Snake) | hadd -m pxsnk apples 1 | hadd -m pxsnk lives 3 | pxsnk.lifes | pxsnk.apple | drawdot @Snake
alias -l pxsnk.lvlinfo drawrect -nfr @Snake 3355443 1 57 299 99 13 | drawtext -n @Snake 0 "Ms Serif" -7 59 299 level: $iif($hget(pxsnk,type) == 1,$hget(pxsnk,level),$right($hget(pxsnk,level),-6)) | drawdot @Snake
alias -l pxsnk.points hadd -m pxsnk points $calc($hget(pxsnk,points)+$gettok(2 4 6 8 10,$hget(pxsnk,speed),32)) | drawrect -rf @Snake 3355443 1 233 299 57 13 | drawtext @Snake 0 "Ms Serif" -7 234 299 points: $hget(pxsnk,points)
alias -l pxsnk.delsnake var %. = 1 | while ($read(snake.mov,%.)) { %.. = $ifmatch | drawrect -r @snake 3355443 4 $calc(($gettok(%..,1,32)*4)+5) $calc(($gettok(%..,2,32)*4)+5) 4 4 | if (!$findtok($hget(pxsnk.ax,bah),$gettok(%..,1,32),32)) hadd -m pxsnk.ax bah $hget(pxsnk.ax,bah) $gettok(%..,1,32) | hadd -m pxsnk.x $gettok(%..,1,32) $+($hget(pxsnk.x,$gettok(%..,1,32)),,$gettok(%..,2,32),)) | inc %. } | dec %. 2 | drawrect -r @Snake $hget(pxsnk,sc) 4 $calc((36*4)+5) 5 4 4 | write -c snake.mov $str(36 -1 $crlf ,%.) 36 0
alias -l pxsnk.lclear drawrect -nrf @Snake.editor 2236962 1 5 5 288 288 | pxsnk.egrind | hfree -w pxsnk.free
alias -l pxsnk.egrind drawrect -nrf @Snake.editor 2236962 1 5 5 288 288 | var %i = 36 | while (%i) { drawline -nr @Snake.editor 3355443 2 4 $calc((%i *8)+5) 293 $calc((%i *8)+5) | drawline -nr @Snake.editor 3355443 2 $calc((%i *8)+5) 4 $calc((%i *8)+5) 293 | dec %i } | drawrect -nr @Snake.editor 52428 1 4 4 290 290 | drawrect -nfr @Snake.editor 3355443 1 141 5 16 8 | drawdot @Snake.editor
alias -l pxsnk.lifes var %.i = $hget(pxsnk,lives) | drawrect -nfr @Snake 3355443 4 8 300 43 11 | while (%.i > 0) { drawpic -nt @Snake 3355443 $calc((15*%.i)-7) 300 8 0 13 11 $gfx | dec %.i } | drawdot @Snake
alias -l pxsnk.-life pxsnk.p | var %l = $hget(pxsnk,lives),%. = $hget(pxsnk,level) | if (%l == 1) pxsnk.go | else linfo $iif($hget(pxsnk,type) == 1,%.,$right(%.,-6)) | hadd -m pxsnk lives $calc(%l -1) | pxsnk.delsnake | pxsnk.lifes
alias -l pxsnk.erase drawrect -rf @Snake.editor 3355443 0 $1 $2 8 8 | drawrect -fr @Snake.editor 2236962 0 $calc($1 +1) $calc($2 +1) 6 6
alias -l pxsnk.bclear if (!$window(@Snake)) { .timersnakeanimation off | return } | if (!$timer(snakeanimation)) .timersnakeanimation -om 5 100 pxsnk.bclear $1 | var %i = 32,%q = $calc(6-$timer(snakeanimation).reps) | while (%i) { drawrect -nrf @Snake 3355443 1 5 $calc(((9*%i)-%q)+1) 288 $iif(%q = 1,1,$calc(%q *2)) | drawrect -nr @Snake 52428 1 4 4 290 290 | dec %i } | if ($timer(snakeanimation).reps == 0) { $pxsnk.load($calc($hget(pxsnk,level)+1),@Snake) | hadd -m pxsnk apples 1 | pxsnk.apple | write -c snake.mov $str(36 -1 $crlf ,$calc($lines(snake.mov)-1)) 36 0 } | drawdot @Snake
alias -l pxsnk.nxtlvl if ($hget(pxsnk,level) > 9) pxsnk.go | else { pxsnk.p | pxsnk.bclear 1 }
alias -l pxsnk.cm var %.tmp = $read(snake.mov,$lines(snake.mov)),%. = $calc($gettok(%.tmp,1,32) $iif($1 == 37,-1,$iif($1 == 39,+1))) $calc($gettok(%.tmp,2,32) $iif($1 == 38,-1,$iif($1 == 40,+1))) | if (%. != $read(snake.mov,$calc($lines(snake.mov)-1))) return $true
alias -l pxsnk.apple if (!$gettok($calc($hget(pxsnk,apples)/11),2,46)) && ($hget(pxsnk,type) == 1) { pxsnk.nxtlvl | return } | var %.x = $gettok($hget(pxsnk.ax,bah),$r(1,$numtok($hget(pxsnk.ax,bah),32)),32),%.y = $gettok($hget(pxsnk.x,%.x),$r(1,$numtok($hget(pxsnk.x,%.x),1)),1) | drawpic -c @snake $calc((%.x *4)+5) $calc((%.y *4)+5) 8 11 4 4 $gfx | hadd -m pxsnk apple %.x %.y | hadd -m pxsnk apples $calc($hget(pxsnk,apples)+1)
alias -l pxsnk.save remini $shortfn($scriptdir) $+ pxsnk_levels.ini $+(level_,$1) | var %i = 0 | while (%i <= 35) { if ($hget(pxsnk.free,%i)) writeini $shortfn($scriptdir) $+ pxsnk_levels.ini $+(level_,$1) %i $ifmatch | inc %i }
alias -l pxsnk.button var %.f = "MS Serif", %.s = $iif($11,$11,7),%.x = $calc($2 + (($4 - $width($10-,%.f,%.s,0,0))/2) $iif($9 == 1,-1)),%.y = $calc(($3 +($5 - $height($10-,%.f,%.s))/2) -$iif($9 == 1,1)),%.1 = $iif($9 == 1,$7,$8),%.2 = $iif($9 == 0,$7,$8) | drawrect -nfr $1 $6 1 $2 $3 $4 $5 | drawline -nr $1 %.1 1 $2 $3 $2 $calc($3 + $5) | drawline -nr $1 %.1 1 $2 $3 $calc($2 + $4) $3 | drawline -nr $1 %.2 1 $2 $calc(($3 + $5)-1) $calc($2 + $4) $calc(($3 + $5)-1) | drawline -nr $1 %.2 1 $calc(($2 + $4)-1) $3 $calc(($2 + $4)-1) $calc($3 + $5) | if ($10) drawtext -n $1 0 %.f %.s %.x %.y $10 | drawdot $1
alias -l pxsnk.sclick if ($mouse.key != 1) { unset %.pxsnk.sclick | return } | if ($inrect($mouse.x,$mouse.y,6,6,286,286)) { var %.x = $int($calc(($mouse.x -5)/8)),%.y = $int($calc(($mouse.y -5)/8)),%.tmp = $findtok($hget(pxsnk.free,%.x),%.y,1,32) | if (%.y == 0) && (%.x isnum 17-18) || (($findtok($hget(pxsnk.free,%.x),%.y,1,32)) && (!$px.get(pxsnk,n2)) && ($hget(pxsnkt,epiece) != 7)) return | if ($findtok($hget(pxsnk.free,%.x),%.y,1,32)) hadd -m pxsnk.free %.x $deltok($hget(pxsnk.free,%.x),$+(%.tmp,-,$calc(%.tmp +1)),32) | if ($hget(pxsnkt,epiece) == 7) pxsnk.erase $calc((%.x *8)+5) $calc((%.y *8)+5) | else { drawpic @Snake.editor $calc((%.x *8)+5) $calc((%.y *8)+5) $iif($hget(pxsnkt,epiece) == 8,8 24,0 $calc(($hget(pxsnkt,epiece) *8)-8)) 8 8 $gfx | hadd -m pxsnk.free %.x $hget(pxsnk.free,%.x) %.y $gettok(a b c d e f g h,$hget(pxsnkt,epiece),32) } }
alias -l pxsnk.score var %... = $input($+(User:,$chr(32),$chr(32),$chr(32),$gettok($hget(pxskten,$+(tmps,$1)),1,59),$crlf,$crlf,Score:,$chr(32),$gettok($hget(pxskten,$+(tmps,$1)),2,59)) points,68,HighScore)
alias -l pxsnk.dscore var %.i = $1, %.c = $iif($2,52428,16777215), %t = $gettok($hget(pxskten,$+(tmps,%.i)),1,59) | if ($len(%t) > 20) %t = $mid(%pxbj.text,1,17) $+ ... | drawtext -nr @Snaketen %.c Arial 12 $calc(130 - $width(%t,Arial,12,0,0)) $calc(37+(%.i * 15)) %t | drawtext -nr @Snaketen %.c Arial 12 165 $calc(37+(%.i * 15)) $gettok($hget(pxskten,$+(tmps,%.i)),2,59) points | drawdot @snaketen
alias -l pxsnk.checkplace var %i = 1 | while (%i < 11) { if ($1 > $gettok($px.get(pxsnk_scores,$+(n,%i)),2,59)) || (!$gettok($px.get(pxsnk_scores,$+(n,%i)),2,59)) { return %i | break } | inc %i }
alias -l pxsnk.toptenadd var %num = $$pxsnk.checkplace($1) | var %user = $input(Congratulations $+ $chr(44) you made the top 10 players list with your score of $1 points. Enter your name under so you can be added to the high score list:,1,High score,$me) | if (%user && (%user != $chr(32))) { %i = %num | var %next = $+(%user,;,$1) | while (%i < 11) && (%next) { if ($px.get(pxsnk_scores,$+(n,%i))) { %next2 = $ifmatch } | unset %next2 | $px.set(pxsnk_scores,$+(n,%i),%next) | %next = %next2 | inc %i } }
alias -l pxsnk.p .timerpxsnk off | hdel pxsnk key
alias -l pxsnk.editorc hfree -w pxsnk* | close -@ @Snake.help | .timer -om 1 1 pxsnk.dlgc
alias -l pxsnk.color {
  if ($window(@Snake.color)) return
  window -ahopdCk0 +t @Snake.color 0 0 286 75
  drawrect -rf @Snake.color 3355443 1 0 0 280 50
  var %.1 = 5,%x = -10,%y = 0,%.2,%.3
  while (%.1) { %.2 = 5 
    while (%.2) {
      %.3 = 5 
      while (%.3) { inc %x 10 | drawrect -fr @Snake.color $rgb($gettok(0 64 128 192 255,%.1,32),$gettok(0 64 128 192 255,%.2,32),$gettok(0 64 128 192 255,%.3,32)) 1 %x %y 10 10 | if (%x >= 240) { %x = -10 | inc %y 10 } | dec %.3 } 
      dec %.2 
    } 
    dec %.1 
  }
  drawrect -rf @Snake.color $iif($gettok($px.get(pxsnk,n1),$hget(pxsnktmp,color),32),$ifmatch,15987699) 0 250 25 30 25
}
alias pxsnk.edit {
  if ($window(@Snake.editor)) return | window -adhpCusk0 +t @Snake.editor 0 0 306 346 | pxsnk.dlgc | drawrect -rf @Snake.editor 3355443 1 0 0 302 330 | drawrect -r @Snake.editor 52428 1 4 4 290 290 | drawrect -r @Snake.editor 52428 1 4 296 290 19
  var %i = 1 | while (9 > %i) { $pxsnk.button(@Snake.editor,$calc((%i *16)-9),299,13,13,$gettok(65535 13369344 255 13674 39168 15987699 3355443 3355443,%i,32),$gettok(43690 16737894 8421631 3513087 5111629 16777215 10066329 10066329,%i,32),$gettok(8454143 8912896 170 9030 26112 10592673 2236962 2236962,%i,32),1) | inc %i }
  %i = 4 | while (%i) { $pxsnk.button(@Snake.editor,$gettok(138 177 216 255,%i,32),299,36,13,3355443,10066329,2236962,1,$gettok(Clear Save Load Help,%i,32)) | dec %i }
  drawpic @Snake.editor 104 301 8 16 10 8 $gfx | drawpic @Snake.editor 121 301 8 24 8 8 $gfx | pxsnk.egrind | hadd -m pxsnkt epiece 1 | pxsnk.editu | if ($1) pxsnk.load $1 @Snake.editor
}
alias -l pxsnk.help {
  if ($window(@Snake.help)) { window -a @Snake.help | return }
  var %. = drawtext -n @Snake.help 0 "ms Serif" -8
  window -dhpCusk0 +t @Snake.help 0 0 304 325
  drawrect -nrf @Snake.help 3355443 1 0 0 302 304 
  drawrect -nr @Snake.help 52428 1 4 4 290 292
  drawtext -n @Snake.help 0 "MS Serif" -17 76 8 Snake editor help
  %. 10 35 bricks
  drawline -nr @Snake.help 52428 1 10 47 284 47
  $pxsnk.button(@Snake.help,13,60,13,13,65535,8454143,43690,1)
  $pxsnk.button(@Snake.help,29,60,13,13,13369344,16737894,8912896,1)
  $pxsnk.button(@Snake.help,18,76,13,13,255,8421631,170,1)
  $pxsnk.button(@Snake.help,34,76,13,13,13674,3513087,9030,1)
  $pxsnk.button(@Snake.help,23,92,13,13,39168,5111629,26112,1)
  $pxsnk.button(@Snake.help,39,92,13,13,15987699,16777215,10592673,1)
  %. 58 52 the brics are the building blocks you use to make levels.
  %. 58 64 you can choose between 6 different colors; yellow, red,
  %. 58 76 green, blue, brown and white. to set wich one to use,
  %. 58 88 click on the button with the color you want in the down
  %. 58 100 left corner.
  %. 10 118 eraser tool
  drawline -nr @Snake.help 52428 1 10 130 284 130
  $pxsnk.button(@Snake.help,26,153,13,13,3355443,10066329,2236962,1)
  drawpic @Snake.help 27 155 8 16 10 8 $gfx
  %. 58 135 this is the tool you use to delete bricks on the table.
  %. 58 147 to activate the tool, click on the button with the eraser
  %. 58 159 icon on it (same as the button you see to the left of this
  %. 58 171 text.)
  %. 10 189 exclude tool
  drawline -nr @Snake.help 52428 1 10 201 284 201
  $pxsnk.button(@Snake.help,26,240,13,13,3355443,10066329,2236962,1)
  drawpic @Snake.help 28 242 8 24 8 8 $gfx
  %. 58 206 since all apples are placed randomly on the level, i added
  %. 58 218 this tool. when you place a stop sign on the level, you
  %. 58 230 make sure that no apple is placed at that spot. that gives
  %. 58 242 the opportunity that add circles and closed areas on your
  %. 58 254 level. to select this tool, press the button with the stop
  %. 58 266 sign on it. (same as the button you see to the left of this
  %. 58 278 text.)
  drawdot @Snake.help
}
alias pxsnk.snake {
  if ($active != @Snake) || (!$appactive) { pxsnk.p | return } | var %.k = $hget(pxsnk,key),%. = $read(snake.mov,1),%.tmp = $read(snake.mov,$lines(snake.mov)),%.x = $calc($gettok(%.tmp,1,32) $iif(%.k == 37,-1,$iif(%.k == 39,+1))),%.y = $calc($gettok(%.tmp,2,32) $iif(%.k == 38,-1,$iif(%.k == 40,+1)))
  if (%.x !isnum 0-71) || (%.y !isnum 0-71) || ((!$findtok($hget(pxsnk.x,%.x),%.y,1,1)) && ($gettok($hget(pxsnk.free,$int($calc(%.x /2))),$calc($findtok($hget(pxsnk.free,$int($calc(%.x /2))),$int($calc(%.y /2)),32)+1),32) != h)) { pxsnk.-life | return } | drawrect -nr @snake $hget(pxsnk,sc) 4 $calc((%.x *4)+5) $calc((%.y *4)+5) 4 4 | hadd -m pxsnk.x %.x $remove($hget(pxsnk.x,%.x),$+(,%.y,)) | if (!$gettok($hget(pxsnk.x,%.x),1,1)) hadd -m pxsnk.ax bah $deltok($hget(pxsnk.ax,bah),$findtok($hget(pxsnk.ax,bah),%.x,32),32)
  if (%. != 36 -1) { if (!$findtok($hget(pxsnk.ax,bah),$gettok(%.,1,32),32)) hadd -m pxsnk.ax bah $hget(pxsnk.ax,bah) $gettok(%.,1,32) | hadd -m pxsnk.x $gettok(%.,1,32) $+($hget(pxsnk.x,$gettok(%.,1,32)),,$gettok(%.,2,32),)) | drawrect -nr @snake 3355443 4 $calc(($gettok(%.,1,32)*4)+5) $calc(($gettok(%.,2,32)*4)+5) 4 4 } | drawrect -nr @snake $hget(pxsnk,hc) 4 $calc(($gettok(%.tmp,1,32)*4)+5) $calc(($gettok(%.tmp,2,32)*4)+5) 4 4 | drawdot @Snake | write snake.mov %.x %.y | if (%.x %.y == $hget(pxsnk,apple)) { pxsnk.points | pxsnk.apple } | else write -dl1 snake.mov
}
alias pxsnk.go {
  if (!$window(@Snake)) { .timersnakeanimation off | return }
  if (!$timer(snakeanimation)) .timersnakeanimation -om 200 70 pxsnk.go
  var %q = $calc(200-$timer(snakeanimation).reps)
  if (%q < 17) { var %i = 10 | while (%i > 0) { drawrect -nrf @Snake 3355443 0 $calc(((32*%i)-12)-%q) 0 $iif(%q = 1,1,$calc(%q *2)) 330 | dec %i } }
  if (%q isnum 18-50) { var %r = $calc(51+((%q - 17)*5)),%l = $calc((%q -17)*3.9) | drawtext -r @Snake $rgb(%r,%r,%r) "Ms Sans Serif" 40 33 15 GAME OVER | drawrect -r @Snake 52428 2 $calc(150-%l) 55 $calc(2*%l) 2 }
  if (%q >= 51) {
    if (!$window(@pxsktmpgfx)) {
      window -fph +d @pxsktmpgfx 0 0 302 330
      drawrect -nrf @pxsktmpgfx 3355443 1 0 0 302 330
      var %. = drawtext -n @pxsktmpgfx 0 "MS Sans Serif" -9,%: = $replace(%.,-n,-no),%- = $pxsnk.checkplace($hget(pxsnk,points))
      drawline -nr @pxsktmpgfx 52428 1 24 89 274 89
      %. 23 75 game settings
      %: 28 96 speed:
      %. 108 96 $gettok(snail slow normal fast extreme,$hget(pxsnk,speed),32)
      %: 28 112 game type:
      %. 108 112 $iif(level_ isin $hget(pxsnk,level),custom,normal)
      %: 28 128 head color:
      drawrect -nr @pxsktmpgfx $hget(pxsnk,hc) 4 110 132 8 8
      %: 28 144 body color:
      drawrect -nr @pxsktmpgfx $hget(pxsnk,sc) 4 110 148 8 8
      drawline -onr @pxsktmpgfx 52428 1 24 176 274 176
      %. 23 162 game result
      %: 28 185 points:
      %. 108 185 $iif($hget(pxsnk,points),$ifmatch,0)
      %: 28 201 apples eaten:
      %. 108 201 $calc($lines(snake.mov)-5)
      %: 28 217 lives lost:
      %. 108 217 $calc(3-$hget(pxsnk,lives))
      %: 28 233 rank:
      %. 108 233 $iif(%-,%-,none)
      drawline -onr @pxsktmpgfx 52428 1 24 266 274 266
      %. 23 252 options
      $pxsnk.button(@pxsktmpgfx,28,276,59,18,3355443,10066329,2236962,1,new game,9)
      $pxsnk.button(@pxsktmpgfx,90,276,59,18,3355443,10066329,2236962,1,highscore list,9)
      $pxsnk.button(@pxsktmpgfx,152,276,59,18,3355443,10066329,2236962,1,settings,9)
      $pxsnk.button(@pxsktmpgfx,214,276,59,18,3355443,10066329,2236962,1,exit game,9)
    }
    drawcopy -tn @pxsktmpgfx 3355443 0 $calc(((%q -51)*3)+75) 302 3 @Snake 0 $calc(((%q -50)*3)+75)
    if (%q == 123) { hadd -m pxsnk butts 1 | close -@ @pxsktmpgfx | .timersnakeanimation off | pxsnk.toptenadd $hget(pxsnk,points) }
  }
  drawdot @Snake
}
alias pxsnk.load {
  hfree -w pxsnk.ax | hfree -w pxsnk.x | hfree -w pxsnk.free | if ($2 == @Snake) { linfo $iif($hget(pxsnk,type) == 1,$1,$right($1,-6)) | drawrect -nr @Snake $hget(pxsnk,sc) 4 $calc((36*4)+5) 5 4 4 } | var %.,%i.,%..,%.c,%.tmp,%i = 71,%r = 0 | while (%i) { %r = $+(,%i,,%r) | dec %i }
  while (%i < 36) {
    %. = $readini($shortfn($scriptdirpxsnk_levels.ini),$1,%i) 
    %i. = $calc($numtok(%.,32)-1)
    if (%i. < 71) && ($2 = @Snake) { hadd -m pxsnk.ax bah $hget(pxsnk.ax,bah) $calc(%i *2) $calc((%i *2)+1) | hadd -m pxsnk.x $calc(%i *2) %r | hadd -m pxsnk.x $calc((%i *2)+1) %r } 
    while (%i. > 0) { %.c = $gettok(%.,%i.,32) | %.. = $calc($findtok(a b c d e f g h,$gettok(%.,$calc(%i. +1),32),32) -1) | drawpic -tcn $2 3355443 $calc((%i *8)+5) $calc(($gettok(%.,%i.,32) *8)+5) $iif(%.. == 7,$iif($2 == @Snake.editor,8 24,8 32),0 $calc(%.. *8)) 8 8 $gfx | dec %i. 2 | if ($len(%.) < 169) { hadd -m pxsnk.x $calc(%i *2) $remove($hget(pxsnk.x,$calc(%i *2)),$+(,$calc(%.c *2),),$+(,$calc((%.c *2)+1),)) | hadd -m pxsnk.x $calc((%i *2)+1) $remove($hget(pxsnk.x,$calc((%i *2))+1),$+(,$calc((%.c *2)+1),),$+(,$calc(%.c *2),)) } } | hadd -m pxsnk.free %i %. | inc %i
  } 
  drawdot $2 | hadd -m pxsnk level $iif($2 == @Snake,$1,$right($1,-6)) | if ($2 == @Snake) pxsnk.lvlinfo
}
alias -l pxsnk.topten {
  if $window(@Snaketen) { window -aC @Snaketen | clear @Snaketen } | else window -hpdCusk0 $+ $iif($window(@Snake).ontop,o) +t @Snaketen 0 0 304 250 | drawrect -nfr @Snaketen 3355443 1 0 0 304 250 | drawrect -nr @Snaketen 16777215 1 5 5 288 215 | drawtext -nr @Snaketen 16777215 Arial 18 23 15 ProjectX Snake - Top 10 scores | var %i = 16,%t | while (%i) { if (%i !isnum 8-9) { drawline -nr @Snaketen 6052956 1 $calc(14 + (10 * %i)) $calc(42 + (10 * %i)) $calc(110 + (10 * %i)) $calc(42 + (10 * %i)) | drawline -nr @Snaketen 6052956 1 $calc(186 - (10 * %i)) $calc(42 + (10 * %i)) $calc(282 - (10 * %i)) $calc(42 + (10 * %i)) | } | dec %i } 
  drawtext -nr @Snaketen 6052956 Arial 26 88 112 PROJECT | if ($hget(pxskten,tmps1)) hdel -w pxskten tmps* | %i = 1 | while (%i <= 10) { %t = $iif($gettok($px.get(pxsnk_scores,$+(n,%i)),1,59),$ifmatch,none) | if ($len(%t) > 20) %t = $mid(%pxbj.text,1,17) $+ ... | drawtext -nr @Snaketen 16777215 Arial 12 $calc(130 - $width(%t,Arial,12,0,0)) $calc(37+(%i * 15)) %t | drawtext -nr @Snaketen 16777215 Arial 12 165 $calc(37+(%i * 15)) $iif($gettok($px.get(pxsnk_scores,$+(n,%i)),2,59),$ifmatch points,n/a) | if ($px.get(pxsnk_scores,$+(n,%i))) hadd -m pxskten tmps $+ %i $ifmatch | inc %i } | drawdot @Snaketen
}
;-------- -  -
; Popups
;-------- -  -
menu menubar,status,channel {
  $px.nam
  .$iif($window(@Snake.editor),$style(2)) New game:pxsnk.start
  .$iif($window(@Snake),$style(2)) Level creator/editor:pxsnk.edit
  .-
  .Options:dlg pxsnake.setup $iif($window(@Snake).ontop,o)
  .Top ten list:pxsnk.topten
  .-
  .Help:dlg pxsnk-help a
  .$iif(!$isfile($px.rm),$style(2)) &Read Me:px.readme
  .-
  .&About: px.about
  .&Unload $px.addon: if ($input(Are you sure you want to unload $+($crlf,$px.nam(1),?),136,ProjectX Unload Confirmation)) $+($px(9),.unload) $px.nam
  .-
  .Project&X Website: px.about | px.www $+($px(6),px.html)
}
menu @Snaketen {
  mouse: { var %.i = $int($calc(($mouse.y -37)/15)) | if ($hget(pxskten,tmps)) && ($ifmatch != %.i) { pxsnk.dscore $hget(pxskten,tmps) | hdel pxskten tmps } | if ($hget(pxskten,$+(tmps,%.i))) { pxsnk.dscore %.i 1 | hadd -m pxskten tmps %.i } }
  sclick: { if ($hget(pxskten,tmps) == $int($calc(($mouse.y -37)/15))) { pxsnk.dscore $hget(pxskten,tmps) | pxsnk.score $hget(pxskten,tmps) } }
  leave: { if ($hget(pxskten,tmps)) pxsnk.dscore $ifmatch }
  $iif(!$hget(pxskten,tmps1),$style(2)) Clear list:if ($input(Are you sure you want to clear the top 10 list?,1288,Clear confirmation)) { px.set pxsnk_scores | pxsnk.topten }
  -  
  Exit:{ close -@ @snaketen | pxsnk.tenc }
}
menu @Snake.editor {
  mouse:{
    if ($hget(pxsnk,history)) var %.tmpx = $gettok($ifmatch,1,32),%.tmpy = $gettok($ifmatch,2,32) | var %.x = $int($calc(($mouse.x -5)/8)),%.y = $int($calc(($mouse.y -5)/8)) | if ((%.y == 0) && (%.x isnum 17-18)) var %... = . | if (%.tmpx isnum 0-35) && (%.tmpy isnum 0-35) && (!$findtok($hget(pxsnk.free,%.tmpx),%.tmpy,1,32)) drawrect -fr @Snake.editor 2236962 0 $calc((%.tmpx *8)+6) $calc((%.tmpy *8)+6) 6 6 | if (!$findtok($hget(pxsnk.free,%.x),%.y,1,32)) && ($inrect($mouse.x,$mouse.y,6,6,286,286)) && (!%...) drawrect -fr @Snake.editor 10066329 0 $calc((%.x *8)+6) $calc((%.y *8)+6) 6 6 | if (%.pxsnk.sclick) pxsnk.sclick | if (!%...) hadd -m pxsnk history %.x %.y
    if ($hget(pxsnk,btmp)) { var %. = $ifmatch | if (!$inrect($mouse.x,$mouse.y,$gettok(138 177 216 255,%.,32),299,36,13)) { hdel pxsnk btmp | $pxsnk.button(@Snake.editor,$gettok(138 177 216 255,%.,32),299,36,13,3355443,10066329,2236962,1,$gettok(Clear Save Load Help,%.,32)) } }
  } 
  sclick: {
    if ($inrect($mouse.x,$mouse.y,7,299,324,13)) {
      var %.tmp = $hget(pxsnkt,epiece),%.,%i = 12 | while (%i) { if ($mouse.x isnum $gettok(7-19 23-35 39-51 55-67 71-83 87-99 103-115 119-131 138-174 177-213 216-252 255-291,%i,32)) { %. = %i | break } | dec %i } | if (!%.) return | if (%. > 8) { $pxsnk.button(@Snake.editor,$gettok(138 177 216 255,$calc(%. -8),32),299,36,13,3355443,10066329,2236962,0,$gettok(Clear Save Load Help,$calc(%. -8),32)) | hadd -m pxsnk btmp $calc(%. -8) | return } | $pxsnk.button(@Snake.editor,$calc((%.tmp *16)-9),299,13,13,$gettok(65535 13369344 255 13674 39168 15987699 3355443 3355443,%.tmp,32),$gettok(8454143 16737894 8421631 3513087 5111629 16777215 10066329 10066329,%.tmp,32),$gettok(43690 8912896 170 9030 26112 10592673 2236962 2236962,%.tmp,32),1)
      if (%.tmp isnum 7-8) { drawrect -rf @Snake.editor 3355443 0 $calc((16*%.tmp)-8) 300 11 11 | if (%.tmp == 7) drawpic @Snake.editor 104 301 8 16 10 8 $gfx | else drawpic @Snake.editor 121 301 8 24 8 8 $gfx } | $pxsnk.button(@Snake.editor,$calc((%. *16)-9),299,13,13,$gettok(65535 13369344 255 13674 39168 15987699 3355443 3355443,%.,32),$gettok(8454143 16737894 8421631 3513087 5111629 16777215 10066329 10066329,%.,32),$gettok(43690 8912896 170 9030 26112 10592673 2236962 2236962,%.,32),0) | if (%. isnum 7-8) { drawrect -rf @Snake.editor 3355443 0 $calc((16*%.)-8) 300 11 11 | if (%. == 7) drawpic @Snake.editor 105 302 8 16 10 8 $gfx | else drawpic @Snake.editor 122 302 8 24 8 8 $gfx } | hadd -m pxsnkt epiece %.
    }
    %.pxsnk.sclick = yes | pxsnk.sclick
  }
  uclick:{ unset %.pxsnk.sclick | if ($hget(pxsnk,btmp)) { var %. = $ifmatch | hdel pxsnk btmp | $pxsnk.button(@Snake.editor,$gettok(138 177 216 255,%.,32),299,36,13,3355443,10066329,2236962,1,$gettok(Clear Save Load Help,%.,32)) | goto %. | :1 | var %.tmp = $input(Save changes to $+(",$hget(pxsnk,level),",?),304,Save changes)) | if (%.tmp == $yes) { dlg pxsnk.mod a | hadd -m pxsnk clear 1 } | elseif (%.tmp == $cancel) return | else { pxsnk.lclear | pxsnk.editu | return } | :2 | dlg pxsnk.mod a | return | :3 | dlg pxsnk.mod a pxsnk.load | return | :4 | pxsnk.help } }
  leave: { if ($hget(pxsnk,history)) { var %.tmpx = $gettok($ifmatch,1,32), %.tmpy = $gettok($ifmatch,2,32) } | if (%.tmpx isnum 0-35) && (%.tmpy isnum 0-35) && (!$findtok($hget(pxsnk.free,%.tmpx),%.tmpy,1,32)) drawrect -fr @Snake.editor 2236962 0 $calc((%.tmpx *8)+6) $calc((%.tmpy *8)+6) 6 6 }
  Clear:{ var %.tmp = $input(Save changes to $+(",$hget(pxsnk,level),",?),304,Save changes)) | if (%.tmp == $yes) { dlg pxsnk.mod a } | elseif (%.tmp == $cancel) return | else { pxsnk.lclear | pxsnk.editu } }
  -
  Save:dlg pxsnk.mod a
  Load:dlg pxsnk.mod a pxsnk.load
  -
  $iif($px.get(pxsnk,n2),$style(1)) Overwrite occupied fields:px.set pxsnk n2 $iif($px.get(pxsnk,n2),0,1)
  -
  Help:pxsnk.help
}
menu @Snake {
  mouse:if ($hget(pxsnk,btmp)) { var %i = $ifmatch,%. = $gettok(28 90 152 214,%i,32) | if (!$inrect($mouse.x,$mouse.y,%.,276,59,18)) { hdel pxsnk btmp | $pxsnk.button(@Snake,%.,279,59,18,3355443,10066329,2236962,1,$gettok(new game;highscore list;settings;exit game,%i,59),9) } }
  sclick:if ($hget(pxsnk,butts)) { var %i = 4,%. | while (%i) { %. = $gettok(28 90 152 214,%i,32) | if ($inrect($mouse.x,$mouse.y,%.,276,59,18)) { hadd -m pxsnk btmp %i | $pxsnk.button(@Snake,%.,279,59,18,3355443,10066329,2236962,0,$gettok(new game;highscore list;settings;exit game,%i,59),9) } | dec %i } }
  uclick:if ($hget(pxsnk,btmp)) { hdel pxsnk btmp | var %. = $ifmatch | $pxsnk.button(@Snake,$gettok(28 90 152 214,%.,32),279,59,18,3355443,10066329,2236962,1,$gettok(new game;highscore list;settings;exit game,%.,59),9) | $gettok(pxsnk.start;pxsnk.topten;dlg pxsnake.setup $iif($window(@Snake).ontop,o) ;pxsnk.snkclose,%.,59) }
  New game:pxsnk.start
  -
  Options:dlg pxsnake.setup $iif($window(@Snake).ontop,o)
  Highscore list:pxsnk.topten
  -
  $iif($window(@Snake).ontop,$style(1)) Place ontop:window $iif($window(@Snake).ontop,-u,-o) @Snake | px.set pxsnk n3 $iif($window(@Snake).ontop,1,0)
  Exit:pxsnk.snkclose
}
menu @Snake.color {
  mouse:if ($inrect($mouse.x,$mouse.y,0,0,300,50)) drawcopy @Snake.color $mouse.x $mouse.y 1 1 @Snake.color 250 0 30 25
  sclick:if ($inrect($mouse.x,$mouse.y,0,0,300,50)) { px.set pxsnk n1 $puttok($px.get(pxsnk,n1),$getdot(@Snake.color,$mouse.x,$mouse.y),$hget(pxsnktmp,color),32) | close -@ @Snake.color | pxsnk.tmpgfx }
}
;-------- -  -
; Dialog
;-------- -  -
dialog pxsnake.setup {
  title "ProjectX - Snake options"
  size -1 -1 129 108
  option dbu
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 1, 32 24 90 2, disable
  icon 2, 10 18 15 15,  $shortfn($mircexe), 0
  button "OK", 4, 96 96 30 11, ok
  tab "Game mode", 14, 3 1 122 92
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 24, 32 48 90 2, disable tab 14
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 25, 32 72 90 2, disable tab 14
  text "Game mode", 19, 35 21 29 8, tab 14
  radio "Normal", 20, 35 32 40 10, tab 14 push
  radio "Custom", 21, 78 32 40 10, tab 14 push
  text "Level", 22, 35 45 13 8, tab 14
  combo 23, 35 55 83 50, tab 14 size drop
  text "Options", 26, 35 69 18 8, tab 14
  button "Start game", 27, 35 79 40 10, tab 14
  button "Edit level", 28, 78 79 40 10, tab 14 disable
  tab "Snake", 15
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 5, 32 48 90 2, disable tab 15
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 11, 32 72 90 2, disable tab 15
  text "Head", 3, 35 21 13 8, tab 15
  text "Body", 6, 35 45 12 8, tab 15
  button "Change", 7, 64 32 25 10, tab 15
  button "Default", 8, 93 32 25 10, tab 15
  button "Default", 9, 93 56 25 10, tab 15
  button "Change", 10, 64 56 25 10, tab 15
  icon 12, 38 30 14 14,  $shortfn($mircexe), 0, tab 15
  icon 13, 38 54 14 14,  $shortfn($mircexe), 0, tab 15
  text "Snake speed", 16, 35 69 32 8, tab 15
  combo 17, 35 78 83 50, tab 15 size drop
}

dialog pxsnk.mod {
  title "Save changes"
  size -1 -1 125 40
  option dbu
  icon pxsnk.ico, 0
  icon 1, 3 6 15 15, $shortfn($mircexe), 0
  button "&Save", 2, 58 27 30 11, default
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 3, 26 7 96 2, disable
  text "Save changes", 4, 29 4 35 8
  edit "", 5, 51 13 69 10,
  text "Save as:", 6, 29 14 21 8,
  combo 7, 51 13 69 60,size drop hide
  button "&Load", 8, 58 27 30 11,hide
  text "Load level", 9, 29 4 25 8,hide
  button "&Cancel", 10, 90 27 30 11, cancel
}
dialog pxsnk-help {
  title $px.nam - Help
  size -1 -1 200 136
  option dbu
  text "Topics:", 2, 5 4 17 7
  list 3, 5 13 70 102, size
  text "Details:", 4, 80 4 18 7
  edit "", 5, 80 13 115 102, read multi vsbar
  button "&Close", 6, 80 120 40 12, ok
}

;-------- -  -
; Remote
;-------- -  -
on *:DIALOG:pxsnk-help:init:*:if (!$isfile($px.help)) goto e | loadbuf -ottopics $dname 3 $px.help | did -a $dname 5 Select a topic you wish to find help on. | if (!$did(3).lines) { :e | did -ab $dname 3 Empty! | did -a $dname 5 No help topics found. | return }
on *:DIALOG:pxsnk-help:sclick:3:did -r $dname 5 | if (!$readini($px.help,$did(3).seltext,n0)) did -a $dname 5 No help is available for $+(",$did(3).seltext,".) | elseif (!$readini($px.help,$did(3).seltext,n1)) did -a $dname 5 $readini($px.help,$did(3).seltext,n0) | else { var %n = 0 | while ($readini($px.help,$did(3).seltext,$+(n,%n))) { did -a $dname 5 $ifmatch $+ $iif($readini($px.help,$did(3).seltext,$+(n,$calc(%n + 1))),$+($crlf,$crlf)) | inc %n } | did -c $dname 5 1 }
on *:DIALOG:pxsnk.*:sclick:*:{
  if ($did == 8) && ($window(@Snake.editor)) && ($did(7)) { pxsnk.lclear | pxsnk.load $+(level_,$did(7)) @Snake.editor | dlgx $dname }
  if ($did == 2) { if (!$did(5)) { var %. = $input(You didn't enter a valid name,260) | halt } | if ($ini($shortfn($scriptdirpxsnk_levels.ini),$+(level_,$did(5)))) && ($did(5) != $hget(pxsnk,level)) { if (!$input($+(",$did(5),") allready exsist $+ $chr(44) do you wish to replace it?,264)) || (!$dialog($dname)) || (!$window(@Snake.editor)) { if ($dialog($dname)) dialog -v $dname | halt } } | pxsnk.save $did(5) | hadd -m pxsnk level $did(5) | dlgx $dname | window -a @Snake.editor | if ($hget(pxsnk,clear)) { hfree pxsnk clear | pxsnk.lclear | pxsnk.editu } }
}
on *:DIALOG:pxsnake.setup:sclick:*:{
  if ($did == 4) { px.set pxsnk n1 $gettok($px.get(pxsnk,n1),1-2,32) $iif($did(20).state == 1,1,2) $did(23) $did(17).sel | if ($window(@Snake)) { dialog -c $dname | var %. = $input(Game settings will not update before you start a new game.,68) | if ($window(@snake)) window -a @Snake } }
  if ($did == 7) { hadd -m pxsnktmp color 1 | pxsnk.color }
  if ($did == 8) { px.set pxsnk n1 $puttok($px.get(pxsnk,n1),52428,1,32) | pxsnk.tmpgfx }
  if ($did == 9) { px.set pxsnk n1 $puttok($px.get(pxsnk,n1),16711680,2,32) | pxsnk.tmpgfx }
  if ($did == 10) { hadd -m pxsnktmp color 2 | pxsnk.color }
  if ($did == 23) pxsnk.dlgc
  if ($did == 27) { dialog -k $dname | .timer -m 1 10 pxsnk.start }
  if ($did == 28) { if ($window(@Snake.editor)) pxsnk.load $+(level_,$did(23).seltext) @Snake.editor | else pxsnk.edit $+(level_,$did(23).seltext) }
}
on *:DIALOG:pxsnk.mod:edit:5:if ($chr(32) isin $did(5)) did -ra $dname 5 $remove($did(5),$chr(32))
on *:DIALOG:pxsnake.setup:init:*:if (!$gettok($px.get(pxsnk,n1),5,32)) px.set pxsnk n1 52428 16711680 1 <clean> 3 | tokenize 32 $px.get(pxsnk,n1) | if ($isfile($shortfn($scriptdirpxsnk.ico))) did -g $dname 2 $shortfn($scriptdirpxsnk.ico) | pxsnk.tmpgfx | did -a $dname 23 <clean> | var %i = $ini($scriptdirpxsnk_levels.ini,0),%. | while (%i) { %. = $ini($scriptdirpxsnk_levels.ini,%i) | if (level_* iswm %.) { did -a $dname 23 $right(%.,-6) | if ($right(%.,-6) == $4) var %sel = $did(23).lines } | dec %i } | %i = did -a $dname 17 | %i snail <moves every 250 ms> | %i slow <moves every 200 ms> | %i normal <moves every 130 ms> | %i fast <moves every 70 ms> | %i extreme <moves every 20 ms> | did -c $dname 17 $5 | did -c $dname 23 $iif(%sel,%sel,1) | pxsnk.dlgc | did -c $dname $iif($3 == 1,20,21)
on *:DIALOG:pxsnk.*:init:*:if ($isfile($shortfn($scriptdirpxsnk.ico))) did -g $dname 1 $shortfn($scriptdirpxsnk.ico) | if (load isin $dname) { did -ra $dname 6 Load: | dialog -t $dname Load level | did -h $dname 2,4,5 | did -v $dname 7,8,9 | var %i = $ini($scriptdirpxsnk_levels.ini,0),%. | while (%i) { %. = $ini($scriptdirpxsnk_levels.ini,%i) | if (level_* iswm %.) did -a $dname 7 $right(%.,-6) | dec %i } | did -c $dname 7 1 } | else { did -a $dname 5 $hget(pxsnk,level) }
on *:KEYDOWN:@snake:*:if ($keyval == 19) || ($keyval == 80) { pxsnk.p | return } | if ($keyval isnum 37-40) && ($pxsnk.cm($keyval)) { if (!$timer(pxsnk)) && ($hget(pxsnk,lives)) && (!$timer(snakeanimation)) .timerpxsnk -om 0 $gettok(250 200 130 50 20,$hget(pxsnk,speed),32) pxsnk.snake | hadd -m pxsnk key $keyval }
on *:CONNECT:px.reg
on *:CLOSE:@Snake:.timer -om 1 1 pxsnk.dlgc | pxsnk.snkclose
on *:CLOSE:@Snaketen:pxsnk.tenc
on *:CLOSE:@Snake.help:window -a @Snake.editor
on *:CLOSE:@Snake.editor:pxsnk.editorc
on *:DISCONNECT: unset %px.using
on *:LOAD: if ($version > 6.11) { px.echo -ae $px.nam(1) loaded. (by $px(3) < $+ $px(4) $+ >) | px.reg | px.about | px.set pxsnk n1 52428 16711680 1 <clean> 3 }
on *:START:if ($version < 6.12) { px.echo -ae $px.nam(1) requires mIRC 6.12 or higher. Visit http://www.mirc.com/ for the latest version of mIRC. | $+($px(9),.unload) $px.nam }
;-------- -  -
; ProjectX
;-------- -  -
alias -l px.about %px.scr = $px(9) | dlg ProjectX
alias -l px.acq return $gettok($read($1,$calc($2 + 1)),3-,32)
alias -l px.nfo var %. = did -a projectx | %. 7 $px.acq($1-,3) | %. 9 $px.acq($1-,4) | %. 11 $remove($px.acq($1-,2),v) - (Base v $+ $px.acq($1-,10) $+ ) | %. 13 $px.acq($1-,5) | %. 15 $px.acq($1-,8)
alias -l px.get return $readini(projectx.ini,$1,$$2)
alias -l px return $gettok($read($+(",$script,"),$calc($1 + 1)),3-,32)
alias -l px.nam return $remove($gettok($px(1),2-,32),[,]) $iif($1,$px(2))
alias -l px.addon return $gettok($px.nam,2-,32)
alias -l px.echo echo $color(info) $1 $px.lp $2-
alias -l px.lp return $iif($isalias(pxt.lp),$pxt.lp,***)
alias -l px.using return ProjectX %px.using (12 $+ $px(6) $+ )
alias -l px.set $iif($3 != $null,writeini,remini) projectx.ini $$1-
alias -l px.www if ($+(",$readini($mircini,files,browser),")) run $ifmatch $$1-
alias -l px.reg %px.using = %px.using $+ $iif(%px.using,$chr(44)) $px.addon $+ ( $+ $px(2) $+ )
alias -l px.unreg if ($remtok(%px.using,$matchtok(%px.using,$px.addon,1,44),44)) %px.using = $ifmatch | else unset %px.using
alias -l px.help return $replace($script,.mrc,-help.cfg)
alias -l px.rm return $replace($script,mrc,txt)
alias -l px.readme $iif($isfile($px.rm),run $px.rm,px.echo -a Could not locate $nopath($px.rm))
alias -l px.win {
  var %px = drawline -r @px | window -fph +d @px 0 0 276 122 | drawrect -fr @px 0 0 0 0 276 122 | var %i = 0, %x, %y, %m = mIRC Scripting Crew | while (%i < 81) { %x = $calc(147 + %i) | %y = $calc(22 + %i) | %px 4210752 1 %x %y $calc(32 + %x) %y | %px 6316128 1 $calc(1 + %x) $calc(%y - 1) $calc(33 + %x) $calc(%y - 1) | %x = $calc(227 - %i) | %px 4210752 1 %x %y $calc(32 + %x) %y | %px 6316128 1 $calc(1 + %x) $calc(%y - 1) $calc(33 + %x) $calc(%y - 1) | inc %i 4 }
  %px 4210752 1 18 62 193 62 | %px 6316128 1 18 61 193 61 | %px = drawtext -r @px | %px 4210752 arial 27 15 34 Project | %px 4210752 arial 27 16 33 Project | %px 6316128 arial 27 17 32 Project | %i = 0 | %x = 28 | %y = 78 | while (%i < 42) { %px $rgb(%i,%i,%i) arial 14 %x %y %m | dec %y | inc %x | inc %i 3 } | %px 6052956 arial 14 40 65 %m | drawsave @px $+(",$scriptdirpx.bmp,") | close -@ @px
}
on *:dialog:projectx:init:0: if (%px.scr == $px(9)) { did -a $dname 2,16,19 $str(¯,49) | if (!$isfile($px.rm)) did -b $dname 20 | var %. = $replace($script,mrc,png), %` , %- | if (!$isfile(%.)) px.win | did -g $dname 1 $+(",$iif($isfile(%.),%.,$scriptdirpx.bmp),") | %. = $script(0) | while (%.) { %` = $script(%.) | %- = $nopath(%`) | if ($left(%-,2) == px) { %- = $remove($gettok($px.acq(%`,1),2-,32),[,],ProjectX) | did -i $dname 5 1 %- ( $+ $nopath(%`) $+ ) | if (%` == $script) px.nfo %` } | dec %. } | did -c $dname 5 $didwm(5,$px.addon *,1) }
on *:dialog:projectx:sclick:*: {
  if (%px.scr == $px(9)) {
    var %- = $script($remove($gettok($did(5).seltext,2,40),$chr(41))), %. = $script(0), %px.readme = $replace(%-,mrc,txt) | while (%.) { if ($script(%.) == %-) { %- = $ifmatch | %. = 1 } | dec %. }
    if ($did == 5) { did $iif($isfile(%px.readme),-e,-b) $dname 20 | %. = $replace(%-,mrc,png) | if (!$isfile(%.)) px.win | did -rg $dname 1 $+(",$iif($isfile(%.),%.,$scriptdirpx.bmp),") | px.nfo %- }
    if ($did == 9) px.www $+(mailto:,$did(9),?subject=,$remove($gettok($px.acq(%-,1),2-,32),[,]) $px.acq(%-,2)) | if ($did == 18) px.www $px(6) | if ($did == 20) .run %px.readme | if ($did == 21) unset %px.scr
  }
}
dialog projectx {
  title "ProjectX Addon Information"
  size -1 -1 153 193
  option dbu
  icon 1, 7 7 138 61
  text "", 2, 3 76 147 3,disable
  text " Information ", 3, 6 73 31 7
  text "Addon:", 4, 14 84 19 7
  combo 5, 46 83 100 71,drop
  text "Author:", 6, 14 98 19 7
  text "", 7, 46 98 99 7
  text "E-mail:", 8, 14 108 16 7
  link "", 9, 46 108 99 8
  text "Version:", 10, 14 118 20 7
  text "", 11, 46 118 99 7
  text "Updated:", 12, 14 128 23 7
  text "", 13, 46 128 99 7
  text "Extra Info:", 14, 14 138 27 7
  text "", 15, 46 138 99 14
  text "", 16, 3 155 147 3,disable
  text "The ProjectX Website:", 17, 13 160 54 8
  link $px(6), 18, 71 160 69 7
  text "", 19, 3 171 147 3,disable
  button "&Read Me", 20, 5 177 37 12
  button "&OK", 21, 111 177 37 12,cancel
}
;alias quit if ($server) quit $iif($1,$1-,ProjectX :: $px(6))
;ctcp &*:VERSION:*: .ctcpreply $nick VERSION $px.using | halt