All pastes #908923 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-18 20:32 UTC
rendered paste body
menu * {
  Patience:p.start
}

alias p.start {
  drawpic -c
  if (!$window(@Patience)) window -aCdpk0 +d @Patience 0 0 589 391

  hdel -w p *

  var %cards 1 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13. $+ $&
    2 1.2 2.2 3.2 4.2 5.2 6.2 7.2 8.2 9.2 10.2 11.2 12.2 13. $+ $&
    3 1.3 2.3 3.3 4.3 5.3 6.3 7.3 8.3 9.3 10.3 11.3 12.3 13. $+ $&
    4 1.4 2.4 3.4 4.4 5.4 6.4 7.4 8.4 9.4 10.4 11.4 12.4 13,%7 7,%6 6,%5 5,%4 4,%3 3,%2 2,%1 1,%c 7

  while (%c) {
    while ($(,% $+ %c)) {
      var %card $gettok(%cards,$r(1,$numtok(%cards,46)),46),%cards $remtok(%cards,%card,1,46)
      hadd -m p %c $addtok($hget(p,%c),$iif($(,% $+ %c) == 1,a:) $+ %card,46)
      dec % $+ %c
    }
    dec %c
  }

  p.restore

  ;dll $qt($scriptdirmouseevents.dll) hidemouse NA
}

alias p.restore {
  drawpic -c @Patience 0 0 $qt($scriptdirbg.png)
  drawpic -ct @Patience 4227327 12 6 144 151 71 96 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 258 6 144 248 71 96 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 340 6 144 248 71 96 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 422 6 144 248 71 96 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 504 6 144 248 71 96 $qt($scriptdirspray.png)
  drawtext @Patience 1 arial 11 5 371 New game (F2)   $chr(124)   Close (F9)

  var %c 7
  while (%c) {
    var %d 1
    while ($gettok($hget(p,%c),%d,46)) {
      if (a:* iswm $v1) p.draw $calc(-70+82* %c) $calc(102+5* %d) $mid($v2,3)
      else drawpic -ct @Patience 4227327 $calc(-70+82* %c) $calc(102+5* %d) 144 54 71 96 $qt($scriptdirspray.png)
      inc %d
    }
    dec %c
  }
}

alias p.stop {
  close -@ @Patience
  ;dll $qt($scriptdirmouseevents.dll) showmouse NA
}

menu @Patience {
  sclick:{
    if ($mouse.x isnum 2-89) && ($mouse.y isnum 370-388) p.start
    if ($mouse.x isnum 91-163) && ($mouse.y isnum 370-388) p.stop
  }
}

on *:KEYDOWN:@Patience:*:{
  if ($keyval == 113) p.start
  if ($keyval == 120) p.stop
}

alias p.draw {
  drawpic -ct @Patience 4227327 $1 $2 144 345 71 96 $qt($scriptdirspray.png)

  drawpic -ct @Patience 4227327 $calc($1 -1) $calc($2 +2) $calc(($4 -1)*18) $iif($3 isin 13,0,18) 16 16 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 $calc($1 -1) $calc($2 +15) $calc(54+ $3 *18) 36 16 16 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 $calc($1 +55) $calc($2 +64) $calc(54+ $3 *18) 442 16 16 $qt($scriptdirspray.png)
  drawpic -ct @Patience 4227327 $calc($1 +55) $calc($2 +77) $calc(($4 -1)*18) $iif($3 isin 13,478,460) 16 16 $qt($scriptdirspray.png)

  if ($istok(1 3 5 9,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +27) $calc($2 +40) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(2 3,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +27) $calc($2 +9) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(2 3,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +27) $calc($2 +71) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)

  if ($istok(4 5 6 7 8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +16) $calc($2 +9) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(4 5 6 7 8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +38) $calc($2 +9) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(4 5 6 7 8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +16) $calc($2 +71) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)
  if ($istok(4 5 6 7 8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +38) $calc($2 +71) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)

  if ($istok(6 7,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +16) $calc($2 +40) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(6 7,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +38) $calc($2 +40) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)


  if ($istok(8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +16) $calc($2 +28) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +38) $calc($2 +28) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +16) $calc($2 +52) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)
  if ($istok(8 9 10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +38) $calc($2 +52) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)

  if ($istok(10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +27) $calc($2 +19) $calc(-18+18* $3) 36 16 16 $qt($scriptdirspray.png)
  if ($istok(10,$4,32)) drawpic -ct @Patience 4227327 $calc($1 +27) $calc($2 +61) $calc(-18+18* $3) 442 16 16 $qt($scriptdirspray.png)
  if ($4 > 10) drawpic -ct @Patience 4227327 $calc(12+ $1) $calc(11+ $2) $calc(-528+48* $4) $calc(-21+75* $3) 47 74 $qt($scriptdirspray.png)
}