Advertisement
Guest User

c21kf

a guest
Nov 25th, 2015
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 40.66 KB | None
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn  ; Recommended for catching common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. SetKeyDelay -1,-1
  6. ;SetBatchLines -1
  7. Process, Priority,, High
  8. #MaxThreadsPerHotkey 1
  9.  
  10. ;Delay between inputs
  11. Delay       := 1
  12. ;Coordinate for next piece box
  13. nextXpos    := 429
  14. nextYpos    := 224
  15. ;Coordinate for initial ghost piece
  16. ;vs mode
  17. ghostXpos   := 164
  18. ghostYpos   := 677
  19. ;cheese mode
  20. ;~ ghostXpos    := 181
  21. ;~ ghostYpos    := 412
  22.  
  23. ;Key config
  24. drop := "Numpad8" ; drop piece
  25. left := "Numpad1" ; move left
  26. right := "Numpad3" ; move right
  27. ccw := "Numpad4" ; rotate ccw
  28. cw := "Numpad6" ; rotate cw
  29. 180 := "Numpad5" ; rotate 180
  30.  
  31. ;no error if user forgets to press space
  32. Piece = "#"
  33. ;Player must press space bar during the countdown before the game starts to get the color of the first piece.
  34. Space::
  35. Piece := getPiece(ghostXpos,ghostYpos)
  36. return
  37.  
  38. A::
  39. if (Piece = "O") {
  40.     Piece := getPiece(nextXpos,nextYpos)
  41.     send, {%left% down}
  42.     send, {%left% up}
  43.     sleep, (Delay)
  44.     send, {%left% down}
  45.     send, {%left% up}
  46.     sleep, (Delay)
  47.     send, {%left% down}
  48.     send, {%left% up}
  49.     sleep, (Delay)
  50.     send, {%left% down}
  51.     send, {%left% up}
  52.     sleep, (Delay)
  53.     send, {%drop% down}
  54.     send, {%drop% up}
  55.     sleep, (Delay)
  56.     return
  57. }
  58. else {
  59.     Piece := getPiece(nextXpos,nextYpos)
  60.     send, {%left% down}
  61.     send, {%left% up}
  62.     sleep, (Delay)
  63.     send, {%left% down}
  64.     send, {%left% up}
  65.     sleep, (Delay)
  66.     send, {%left% down}
  67.     send, {%left% up}
  68.     sleep, (Delay)
  69.     send, {%drop% down}
  70.     send, {%drop% up}
  71.     sleep, (Delay)
  72.     return
  73. }
  74. return
  75.  
  76. S::
  77. if (Piece = "O") {
  78.     Piece := getPiece(nextXpos,nextYpos)
  79.     send, {%left% down}
  80.     send, {%left% up}
  81.     sleep, (Delay)
  82.     send, {%left% down}
  83.     send, {%left% up}
  84.     sleep, (Delay)
  85.     send, {%left% down}
  86.     send, {%left% up}
  87.     sleep, (Delay)
  88.     send, {%drop% down}
  89.     send, {%drop% up}
  90.     sleep, (Delay)
  91.     return
  92. }
  93. else {
  94.     Piece := getPiece(nextXpos,nextYpos)
  95.     send, {%left% down}
  96.     send, {%left% up}
  97.     sleep, (Delay)
  98.     send, {%left% down}
  99.     send, {%left% up}
  100.     sleep, (Delay)
  101.     send, {%drop% down}
  102.     send, {%drop% up}
  103.     sleep, (Delay)
  104.     return
  105. }
  106. return
  107.  
  108. D::
  109. if (Piece = "O") {
  110.     Piece := getPiece(nextXpos,nextYpos)
  111.     send, {%left% down}
  112.     send, {%left% up}
  113.     sleep, (Delay)
  114.     send, {%left% down}
  115.     send, {%left% up}
  116.     sleep, (Delay)
  117.     send, {%drop% down}
  118.     send, {%drop% up}
  119.     sleep, (Delay)
  120.     return
  121. }
  122. else {
  123.     Piece := getPiece(nextXpos,nextYpos)
  124.     send, {%left% down}
  125.     send, {%left% up}
  126.     sleep, (Delay)
  127.     send, {%drop% down}
  128.     send, {%drop% up}
  129.     sleep, (Delay)
  130.     return
  131. }
  132. return
  133.  
  134. F::
  135. if (Piece = "O") {
  136.     Piece := getPiece(nextXpos,nextYpos)
  137.     send, {%left% down}
  138.     send, {%left% up}
  139.     sleep, (Delay)
  140.     send, {%drop% down}
  141.     send, {%drop% up}
  142.     sleep, (Delay)
  143.     return
  144. }
  145. else {
  146.     Piece := getPiece(nextXpos,nextYpos)
  147.     send, {%drop% down}
  148.     send, {%drop% up}
  149.     sleep, (Delay)
  150.     return
  151. }
  152. return
  153.  
  154. G::
  155. if (Piece = "O") {
  156.     Piece := getPiece(nextXpos,nextYpos)
  157.     send, {%drop% down}
  158.     send, {%drop% up}
  159.     sleep, (Delay)
  160.     return
  161. }
  162. else {
  163.     Piece := getPiece(nextXpos,nextYpos)
  164.     send, {%right% down}
  165.     send, {%right% up}
  166.     sleep, (Delay)
  167.     send, {%drop% down}
  168.     send, {%drop% up}
  169.     sleep, (Delay)
  170.     return
  171. }
  172. return
  173.  
  174. H::
  175. if (Piece = "O") {
  176.     Piece := getPiece(nextXpos,nextYpos)
  177.     send, {%right% down}
  178.     send, {%right% up}
  179.     sleep, (Delay)
  180.     send, {%drop% down}
  181.     send, {%drop% up}
  182.     sleep, (Delay)
  183.     return
  184. }
  185. else {
  186.     Piece := getPiece(nextXpos,nextYpos)
  187.     send, {%right% down}
  188.     send, {%right% up}
  189.     sleep, (Delay)
  190.     send, {%right% down}
  191.     send, {%right% up}
  192.     sleep, (Delay)
  193.     send, {%drop% down}
  194.     send, {%drop% up}
  195.     sleep, (Delay)
  196.     return
  197. }
  198. return
  199.  
  200. J::
  201. if (Piece = "O") {
  202.     Piece := getPiece(nextXpos,nextYpos)
  203.     send, {%right% down}
  204.     send, {%right% up}
  205.     sleep, (Delay)
  206.     send, {%right% down}
  207.     send, {%right% up}
  208.     sleep, (Delay)
  209.     send, {%drop% down}
  210.     send, {%drop% up}
  211.     sleep, (Delay)
  212.     return
  213. }
  214. else {
  215.     Piece := getPiece(nextXpos,nextYpos)
  216.     send, {%right% down}
  217.     send, {%right% up}
  218.     sleep, (Delay)
  219.     send, {%right% down}
  220.     send, {%right% up}
  221.     sleep, (Delay)
  222.     send, {%right% down}
  223.     send, {%right% up}
  224.     sleep, (Delay)
  225.     send, {%drop% down}
  226.     send, {%drop% up}
  227.     sleep, (Delay)
  228.     return
  229. }
  230. return
  231.  
  232. K::
  233. if (Piece = "O") {
  234.     Piece := getPiece(nextXpos,nextYpos)
  235.     send, {%right% down}
  236.     send, {%right% up}
  237.     sleep, (Delay)
  238.     send, {%right% down}
  239.     send, {%right% up}
  240.     sleep, (Delay)
  241.     send, {%right% down}
  242.     send, {%right% up}
  243.     sleep, (Delay)
  244.     send, {%drop% down}
  245.     send, {%drop% up}
  246.     sleep, (Delay)
  247.     return
  248. }
  249. else if (Piece = "I") {
  250.     Piece := getPiece(nextXpos,nextYpos)
  251.     send, {%right% down}
  252.     send, {%right% up}
  253.     sleep, (Delay)
  254.     send, {%right% down}
  255.     send, {%right% up}
  256.     sleep, (Delay)
  257.     send, {%right% down}
  258.     send, {%right% up}
  259.     sleep, (Delay)
  260.     send, {%drop% down}
  261.     send, {%drop% up}
  262.     sleep, (Delay)
  263.     return
  264. }
  265. else {
  266.     Piece := getPiece(nextXpos,nextYpos)
  267.     send, {%right% down}
  268.     send, {%right% up}
  269.     sleep, (Delay)
  270.     send, {%right% down}
  271.     send, {%right% up}
  272.     sleep, (Delay)
  273.     send, {%right% down}
  274.     send, {%right% up}
  275.     sleep, (Delay)
  276.     send, {%right% down}
  277.     send, {%right% up}
  278.     sleep, (Delay)
  279.     send, {%drop% down}
  280.     send, {%drop% up}
  281.     sleep, (Delay)
  282.     return
  283. }
  284. return
  285.  
  286. L::
  287. if (Piece = "O") {
  288.     Piece := getPiece(nextXpos,nextYpos)
  289.     send, {%right% down}
  290.     send, {%right% up}
  291.     sleep, (Delay)
  292.     send, {%right% down}
  293.     send, {%right% up}
  294.     sleep, (Delay)
  295.     send, {%right% down}
  296.     send, {%right% up}
  297.     sleep, (Delay)
  298.     send, {%right% down}
  299.     send, {%right% up}
  300.     sleep, (Delay)
  301.     send, {%drop% down}
  302.     send, {%drop% up}
  303.     sleep, (Delay)
  304.     return
  305. }
  306. else if (Piece = "I") {
  307.     Piece := getPiece(nextXpos,nextYpos)
  308.     send, {%right% down}
  309.     send, {%right% up}
  310.     sleep, (Delay)
  311.     send, {%right% down}
  312.     send, {%right% up}
  313.     sleep, (Delay)
  314.     send, {%right% down}
  315.     send, {%right% up}
  316.     sleep, (Delay)
  317.     send, {%drop% down}
  318.     send, {%drop% up}
  319.     sleep, (Delay)
  320.     return
  321. }
  322. else {
  323.     Piece := getPiece(nextXpos,nextYpos)
  324.     send, {%right% down}
  325.     send, {%right% up}
  326.     sleep, (Delay)
  327.     send, {%right% down}
  328.     send, {%right% up}
  329.     sleep, (Delay)
  330.     send, {%right% down}
  331.     send, {%right% up}
  332.     sleep, (Delay)
  333.     send, {%right% down}
  334.     send, {%right% up}
  335.     sleep, (Delay)
  336.     send, {%drop% down}
  337.     send, {%drop% up}
  338.     sleep, (Delay)
  339.     return
  340. }
  341. return
  342.  
  343. Z::
  344. if (Piece = "O") {
  345.     Piece := getPiece(nextXpos,nextYpos)
  346.     send, {%left% down}
  347.     send, {%left% up}
  348.     sleep, (Delay)
  349.     send, {%left% down}
  350.     send, {%left% up}
  351.     sleep, (Delay)
  352.     send, {%left% down}
  353.     send, {%left% up}
  354.     sleep, (Delay)
  355.     send, {%left% down}
  356.     send, {%left% up}
  357.     sleep, (Delay)
  358.     send, {%drop% down}
  359.     send, {%drop% up}
  360.     sleep, (Delay)
  361.     return
  362. }
  363. else if (Piece = "S") OR (Piece = "Z") {
  364.     Piece := getPiece(nextXpos,nextYpos)
  365.     send, {%left% down}
  366.     send, {%left% up}
  367.     sleep, (Delay)
  368.     send, {%left% down}
  369.     send, {%left% up}
  370.     sleep, (Delay)
  371.     send, {%left% down}
  372.     send, {%left% up}
  373.     sleep, (Delay)
  374.     send, {%ccw% down}
  375.     send, {%ccw% up}
  376.     sleep, (Delay)
  377.     send, {%drop% down}
  378.     send, {%drop% up}
  379.     sleep, (Delay)
  380.     return
  381. }
  382. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  383.     Piece := getPiece(nextXpos,nextYpos)
  384.     send, {%left% down}
  385.     send, {%left% up}
  386.     sleep, (Delay)
  387.     send, {%left% down}
  388.     send, {%left% up}
  389.     sleep, (Delay)
  390.     send, {%left% down}
  391.     send, {%left% up}
  392.     sleep, (Delay)
  393.     send, {%cw% down}
  394.     send, {%cw% up}
  395.     sleep, (Delay)
  396.     send, {%left% down}
  397.     send, {%left% up}
  398.     sleep, (Delay)
  399.     send, {%drop% down}
  400.     send, {%drop% up}
  401.     sleep, (Delay)
  402.     return
  403. }
  404. else {
  405.     Piece := getPiece(nextXpos,nextYpos)
  406.     send, {%left% down}
  407.     send, {%left% up}
  408.     sleep, (Delay)
  409.     send, {%left% down}
  410.     send, {%left% up}
  411.     sleep, (Delay)
  412.     send, {%left% down}
  413.     send, {%left% up}
  414.     sleep, (Delay)
  415.     send, {%ccw% down}
  416.     send, {%ccw% up}
  417.     sleep, (Delay)
  418.     send, {%left% down}
  419.     send, {%left% up}
  420.     sleep, (Delay)
  421.     send, {%drop% down}
  422.     send, {%drop% up}
  423.     sleep, (Delay)
  424.     return
  425. }
  426. return
  427.  
  428. X::
  429. if (Piece = "O") {
  430.     Piece := getPiece(nextXpos,nextYpos)
  431.     send, {%left% down}
  432.     send, {%left% up}
  433.     sleep, (Delay)
  434.     send, {%left% down}
  435.     send, {%left% up}
  436.     sleep, (Delay)
  437.     send, {%left% down}
  438.     send, {%left% up}
  439.     sleep, (Delay)
  440.     send, {%drop% down}
  441.     send, {%drop% up}
  442.     sleep, (Delay)
  443.     return
  444. }
  445. else if (Piece = "S") OR (Piece = "Z") {
  446.     Piece := getPiece(nextXpos,nextYpos)
  447.     send, {%left% down}
  448.     send, {%left% up}
  449.     sleep, (Delay)
  450.     send, {%left% down}
  451.     send, {%left% up}
  452.     sleep, (Delay)
  453.     send, {%ccw% down}
  454.     send, {%ccw% up}
  455.     sleep, (Delay)
  456.     send, {%drop% down}
  457.     send, {%drop% up}
  458.     sleep, (Delay)
  459.     return
  460. }
  461. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  462.     Piece := getPiece(nextXpos,nextYpos)
  463.     send, {%left% down}
  464.     send, {%left% up}
  465.     sleep, (Delay)
  466.     send, {%left% down}
  467.     send, {%left% up}
  468.     sleep, (Delay)
  469.     send, {%left% down}
  470.     send, {%left% up}
  471.     sleep, (Delay)
  472.     send, {%cw% down}
  473.     send, {%cw% up}
  474.     sleep, (Delay)
  475.     send, {%drop% down}
  476.     send, {%drop% up}
  477.     sleep, (Delay)
  478.     return
  479. }
  480. else {
  481.     Piece := getPiece(nextXpos,nextYpos)
  482.     send, {%left% down}
  483.     send, {%left% up}
  484.     sleep, (Delay)
  485.     send, {%left% down}
  486.     send, {%left% up}
  487.     sleep, (Delay)
  488.     send, {%left% down}
  489.     send, {%left% up}
  490.     sleep, (Delay)
  491.     send, {%ccw% down}
  492.     send, {%ccw% up}
  493.     sleep, (Delay)
  494.     send, {%drop% down}
  495.     send, {%drop% up}
  496.     sleep, (Delay)
  497.     return
  498. }
  499. return
  500.  
  501. C::
  502. if (Piece = "O") {
  503.     Piece := getPiece(nextXpos,nextYpos)
  504.     send, {%left% down}
  505.     send, {%left% up}
  506.     sleep, (Delay)
  507.     send, {%left% down}
  508.     send, {%left% up}
  509.     sleep, (Delay)
  510.     send, {%drop% down}
  511.     send, {%drop% up}
  512.     sleep, (Delay)
  513.     return
  514. }
  515. else if (Piece = "S") OR (Piece = "Z") {
  516.     Piece := getPiece(nextXpos,nextYpos)
  517.     send, {%left% down}
  518.     send, {%left% up}
  519.     sleep, (Delay)
  520.     send, {%ccw% down}
  521.     send, {%ccw% up}
  522.     sleep, (Delay)
  523.     send, {%drop% down}
  524.     send, {%drop% up}
  525.     sleep, (Delay)
  526.     return
  527. }
  528. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  529.     Piece := getPiece(nextXpos,nextYpos)
  530.     send, {%left% down}
  531.     send, {%left% up}
  532.     sleep, (Delay)
  533.     send, {%left% down}
  534.     send, {%left% up}
  535.     sleep, (Delay)
  536.     send, {%cw% down}
  537.     send, {%cw% up}
  538.     sleep, (Delay)
  539.     send, {%drop% down}
  540.     send, {%drop% up}
  541.     sleep, (Delay)
  542.     return
  543. }
  544. else {
  545.     Piece := getPiece(nextXpos,nextYpos)
  546.     send, {%left% down}
  547.     send, {%left% up}
  548.     sleep, (Delay)
  549.     send, {%left% down}
  550.     send, {%left% up}
  551.     sleep, (Delay)
  552.     send, {%ccw% down}
  553.     send, {%ccw% up}
  554.     sleep, (Delay)
  555.     send, {%drop% down}
  556.     send, {%drop% up}
  557.     sleep, (Delay)
  558.     return
  559. }
  560. return
  561.  
  562. V::
  563. if (Piece = "O") {
  564.     Piece := getPiece(nextXpos,nextYpos)
  565.     send, {%left% down}
  566.     send, {%left% up}
  567.     sleep, (Delay)
  568.     send, {%drop% down}
  569.     send, {%drop% up}
  570.     sleep, (Delay)
  571.     return
  572. }
  573. else if (Piece = "S") OR (Piece = "Z") {
  574.     Piece := getPiece(nextXpos,nextYpos)
  575.     send, {%ccw% down}
  576.     send, {%ccw% up}
  577.     sleep, (Delay)
  578.     send, {%drop% down}
  579.     send, {%drop% up}
  580.     sleep, (Delay)
  581.     return
  582. }
  583. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  584.     Piece := getPiece(nextXpos,nextYpos)
  585.     send, {%left% down}
  586.     send, {%left% up}
  587.     sleep, (Delay)
  588.     send, {%cw% down}
  589.     send, {%cw% up}
  590.     sleep, (Delay)
  591.     send, {%drop% down}
  592.     send, {%drop% up}
  593.     sleep, (Delay)
  594.     return
  595. }
  596. else {
  597.     Piece := getPiece(nextXpos,nextYpos)
  598.     send, {%left% down}
  599.     send, {%left% up}
  600.     sleep, (Delay)
  601.     send, {%ccw% down}
  602.     send, {%ccw% up}
  603.     sleep, (Delay)
  604.     send, {%drop% down}
  605.     send, {%drop% up}
  606.     sleep, (Delay)
  607.     return
  608. }
  609. return
  610.  
  611. B::
  612. if (Piece = "O") {
  613.     Piece := getPiece(nextXpos,nextYpos)
  614.     send, {%drop% down}
  615.     send, {%drop% up}
  616.     sleep, (Delay)
  617.     return
  618. }
  619. else if (Piece = "S") OR (Piece = "Z") {
  620.     Piece := getPiece(nextXpos,nextYpos)
  621.     send, {%cw% down}
  622.     send, {%cw% up}
  623.     sleep, (Delay)
  624.     send, {%drop% down}
  625.     send, {%drop% up}
  626.     sleep, (Delay)
  627.     return
  628. }
  629. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  630.     Piece := getPiece(nextXpos,nextYpos)
  631.     send, {%cw% down}
  632.     send, {%cw% up}
  633.     sleep, (Delay)
  634.     send, {%drop% down}
  635.     send, {%drop% up}
  636.     sleep, (Delay)
  637.     return
  638. }
  639. else {
  640.     Piece := getPiece(nextXpos,nextYpos)
  641.     send, {%ccw% down}
  642.     send, {%ccw% up}
  643.     sleep, (Delay)
  644.     send, {%drop% down}
  645.     send, {%drop% up}
  646.     sleep, (Delay)
  647.     return
  648. }
  649. return
  650.  
  651. N::
  652. if (Piece = "O") {
  653.     Piece := getPiece(nextXpos,nextYpos)
  654.     send, {%right% down}
  655.     send, {%right% up}
  656.     sleep, (Delay)
  657.     send, {%drop% down}
  658.     send, {%drop% up}
  659.     sleep, (Delay)
  660.     return
  661. }
  662. else if (Piece = "S") OR (Piece = "Z") {
  663.     Piece := getPiece(nextXpos,nextYpos)
  664.     send, {%right% down}
  665.     send, {%right% up}
  666.     sleep, (Delay)
  667.     send, {%cw% down}
  668.     send, {%cw% up}
  669.     sleep, (Delay)
  670.     send, {%drop% down}
  671.     send, {%drop% up}
  672.     sleep, (Delay)
  673.     return
  674. }
  675. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  676.     Piece := getPiece(nextXpos,nextYpos)
  677.     send, {%right% down}
  678.     send, {%right% up}
  679.     sleep, (Delay)
  680.     send, {%cw% down}
  681.     send, {%cw% up}
  682.     sleep, (Delay)
  683.     send, {%drop% down}
  684.     send, {%drop% up}
  685.     sleep, (Delay)
  686.     return
  687. }
  688. else {
  689.     Piece := getPiece(nextXpos,nextYpos)
  690.     send, {%cw% down}
  691.     send, {%cw% up}
  692.     sleep, (Delay)
  693.     send, {%drop% down}
  694.     send, {%drop% up}
  695.     sleep, (Delay)
  696.     return
  697. }
  698. return
  699.  
  700. M::
  701. if (Piece = "O") {
  702.     Piece := getPiece(nextXpos,nextYpos)
  703.     send, {%right% down}
  704.     send, {%right% up}
  705.     sleep, (Delay)
  706.     send, {%right% down}
  707.     send, {%right% up}
  708.     sleep, (Delay)
  709.     send, {%drop% down}
  710.     send, {%drop% up}
  711.     sleep, (Delay)
  712.     return
  713. }
  714. else if (Piece = "S") OR (Piece = "Z") {
  715.     Piece := getPiece(nextXpos,nextYpos)
  716.     send, {%right% down}
  717.     send, {%right% up}
  718.     sleep, (Delay)
  719.     send, {%right% down}
  720.     send, {%right% up}
  721.     sleep, (Delay)
  722.     send, {%cw% down}
  723.     send, {%cw% up}
  724.     sleep, (Delay)
  725.     send, {%drop% down}
  726.     send, {%drop% up}
  727.     sleep, (Delay)
  728.     return
  729. }
  730. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  731.     Piece := getPiece(nextXpos,nextYpos)
  732.     send, {%right% down}
  733.     send, {%right% up}
  734.     sleep, (Delay)
  735.     send, {%right% down}
  736.     send, {%right% up}
  737.     sleep, (Delay)
  738.     send, {%cw% down}
  739.     send, {%cw% up}
  740.     sleep, (Delay)
  741.     send, {%drop% down}
  742.     send, {%drop% up}
  743.     sleep, (Delay)
  744.     return
  745. }
  746. else {
  747.     Piece := getPiece(nextXpos,nextYpos)
  748.     send, {%right% down}
  749.     send, {%right% up}
  750.     sleep, (Delay)
  751.     send, {%cw% down}
  752.     send, {%cw% up}
  753.     sleep, (Delay)
  754.     send, {%drop% down}
  755.     send, {%drop% up}
  756.     sleep, (Delay)
  757.     return
  758. }
  759. return
  760.  
  761. ,::
  762. if (Piece = "O") {
  763.     Piece := getPiece(nextXpos,nextYpos)
  764.     send, {%right% down}
  765.     send, {%right% up}
  766.     sleep, (Delay)
  767.     send, {%right% down}
  768.     send, {%right% up}
  769.     sleep, (Delay)
  770.     send, {%right% down}
  771.     send, {%right% up}
  772.     sleep, (Delay)
  773.     send, {%drop% down}
  774.     send, {%drop% up}
  775.     sleep, (Delay)
  776.     return
  777. }
  778. else if (Piece = "S") OR (Piece = "Z") {
  779.     Piece := getPiece(nextXpos,nextYpos)
  780.     send, {%right% down}
  781.     send, {%right% up}
  782.     sleep, (Delay)
  783.     send, {%right% down}
  784.     send, {%right% up}
  785.     sleep, (Delay)
  786.     send, {%right% down}
  787.     send, {%right% up}
  788.     sleep, (Delay)
  789.     send, {%cw% down}
  790.     send, {%cw% up}
  791.     sleep, (Delay)
  792.     send, {%drop% down}
  793.     send, {%drop% up}
  794.     sleep, (Delay)
  795.     return
  796. }
  797. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  798.     Piece := getPiece(nextXpos,nextYpos)
  799.     send, {%right% down}
  800.     send, {%right% up}
  801.     sleep, (Delay)
  802.     send, {%right% down}
  803.     send, {%right% up}
  804.     sleep, (Delay)
  805.     send, {%right% down}
  806.     send, {%right% up}
  807.     sleep, (Delay)
  808.     send, {%cw% down}
  809.     send, {%cw% up}
  810.     sleep, (Delay)
  811.     send, {%drop% down}
  812.     send, {%drop% up}
  813.     sleep, (Delay)
  814.     return
  815. }
  816. else {
  817.     Piece := getPiece(nextXpos,nextYpos)
  818.     send, {%right% down}
  819.     send, {%right% up}
  820.     sleep, (Delay)
  821.     send, {%right% down}
  822.     send, {%right% up}
  823.     sleep, (Delay)
  824.     send, {%cw% down}
  825.     send, {%cw% up}
  826.     sleep, (Delay)
  827.     send, {%drop% down}
  828.     send, {%drop% up}
  829.     sleep, (Delay)
  830.     return
  831. }
  832. return
  833.  
  834. .::
  835. if (Piece = "O") {
  836.     Piece := getPiece(nextXpos,nextYpos)
  837.     send, {%right% down}
  838.     send, {%right% up}
  839.     sleep, (Delay)
  840.     send, {%right% down}
  841.     send, {%right% up}
  842.     sleep, (Delay)
  843.     send, {%right% down}
  844.     send, {%right% up}
  845.     sleep, (Delay)
  846.     send, {%right% down}
  847.     send, {%right% up}
  848.     sleep, (Delay)
  849.     send, {%drop% down}
  850.     send, {%drop% up}
  851.     sleep, (Delay)
  852.     return
  853. }
  854. else if (Piece = "S") OR (Piece = "Z") {
  855.     Piece := getPiece(nextXpos,nextYpos)
  856.     send, {%right% down}
  857.     send, {%right% up}
  858.     sleep, (Delay)
  859.     send, {%right% down}
  860.     send, {%right% up}
  861.     sleep, (Delay)
  862.     send, {%right% down}
  863.     send, {%right% up}
  864.     sleep, (Delay)
  865.     send, {%right% down}
  866.     send, {%right% up}
  867.     sleep, (Delay)
  868.     send, {%cw% down}
  869.     send, {%cw% up}
  870.     sleep, (Delay)
  871.     send, {%drop% down}
  872.     send, {%drop% up}
  873.     sleep, (Delay)
  874.     return
  875. }
  876. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  877.     Piece := getPiece(nextXpos,nextYpos)
  878.     send, {%right% down}
  879.     send, {%right% up}
  880.     sleep, (Delay)
  881.     send, {%right% down}
  882.     send, {%right% up}
  883.     sleep, (Delay)
  884.     send, {%right% down}
  885.     send, {%right% up}
  886.     sleep, (Delay)
  887.     send, {%right% down}
  888.     send, {%right% up}
  889.     sleep, (Delay)
  890.     send, {%cw% down}
  891.     send, {%cw% up}
  892.     sleep, (Delay)
  893.     send, {%drop% down}
  894.     send, {%drop% up}
  895.     sleep, (Delay)
  896.     return
  897. }
  898. else {
  899.     Piece := getPiece(nextXpos,nextYpos)
  900.     send, {%right% down}
  901.     send, {%right% up}
  902.     sleep, (Delay)
  903.     send, {%right% down}
  904.     send, {%right% up}
  905.     sleep, (Delay)
  906.     send, {%right% down}
  907.     send, {%right% up}
  908.     sleep, (Delay)
  909.     send, {%cw% down}
  910.     send, {%cw% up}
  911.     sleep, (Delay)
  912.     send, {%drop% down}
  913.     send, {%drop% up}
  914.     sleep, (Delay)
  915.     return
  916. }
  917. return
  918.  
  919. Q::
  920. if (Piece = "O") {
  921.     Piece := getPiece(nextXpos,nextYpos)
  922.     send, {%left% down}
  923.     send, {%left% up}
  924.     sleep, (Delay)
  925.     send, {%left% down}
  926.     send, {%left% up}
  927.     sleep, (Delay)
  928.     send, {%left% down}
  929.     send, {%left% up}
  930.     sleep, (Delay)
  931.     send, {%left% down}
  932.     send, {%left% up}
  933.     sleep, (Delay)
  934.     send, {%drop% down}
  935.     send, {%drop% up}
  936.     sleep, (Delay)
  937.     return
  938. }
  939. else if (Piece = "S") OR (Piece = "Z") {
  940.     Piece := getPiece(nextXpos,nextYpos)
  941.     send, {%left% down}
  942.     send, {%left% up}
  943.     sleep, (Delay)
  944.     send, {%left% down}
  945.     send, {%left% up}
  946.     sleep, (Delay)
  947.     send, {%left% down}
  948.     send, {%left% up}
  949.     sleep, (Delay)
  950.     send, {%ccw% down}
  951.     send, {%ccw% up}
  952.     sleep, (Delay)
  953.     send, {%drop% down}
  954.     send, {%drop% up}
  955.     sleep, (Delay)
  956.     return
  957. }
  958. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  959.     Piece := getPiece(nextXpos,nextYpos)
  960.     send, {%left% down}
  961.     send, {%left% up}
  962.     sleep, (Delay)
  963.     send, {%left% down}
  964.     send, {%left% up}
  965.     sleep, (Delay)
  966.     send, {%left% down}
  967.     send, {%left% up}
  968.     sleep, (Delay)
  969.     send, {%ccw% down}
  970.     send, {%ccw% up}
  971.     sleep, (Delay)
  972.     send, {%drop% down}
  973.     send, {%drop% up}
  974.     sleep, (Delay)
  975.     return
  976. }
  977. else {
  978.     Piece := getPiece(nextXpos,nextYpos)
  979.     send, {%left% down}
  980.     send, {%left% up}
  981.     sleep, (Delay)
  982.     send, {%left% down}
  983.     send, {%left% up}
  984.     sleep, (Delay)
  985.     send, {%left% down}
  986.     send, {%left% up}
  987.     sleep, (Delay)
  988.     send, {%ccw% down}
  989.     send, {%ccw% up}
  990.     sleep, (Delay)
  991.     send, {%left% down}
  992.     send, {%left% up}
  993.     sleep, (Delay)
  994.     send, {%drop% down}
  995.     send, {%drop% up}
  996.     sleep, (Delay)
  997.     return
  998. }
  999. return
  1000.  
  1001. W::
  1002. if (Piece = "O") {
  1003.     Piece := getPiece(nextXpos,nextYpos)
  1004.     send, {%left% down}
  1005.     send, {%left% up}
  1006.     sleep, (Delay)
  1007.     send, {%left% down}
  1008.     send, {%left% up}
  1009.     sleep, (Delay)
  1010.     send, {%left% down}
  1011.     send, {%left% up}
  1012.     sleep, (Delay)
  1013.     send, {%drop% down}
  1014.     send, {%drop% up}
  1015.     sleep, (Delay)
  1016.     return
  1017. }
  1018. else if (Piece = "S") OR (Piece = "Z") {
  1019.     Piece := getPiece(nextXpos,nextYpos)
  1020.     send, {%left% down}
  1021.     send, {%left% up}
  1022.     sleep, (Delay)
  1023.     send, {%left% down}
  1024.     send, {%left% up}
  1025.     sleep, (Delay)
  1026.     send, {%ccw% down}
  1027.     send, {%ccw% up}
  1028.     sleep, (Delay)
  1029.     send, {%drop% down}
  1030.     send, {%drop% up}
  1031.     sleep, (Delay)
  1032.     return
  1033. }
  1034. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1035.     Piece := getPiece(nextXpos,nextYpos)
  1036.     send, {%left% down}
  1037.     send, {%left% up}
  1038.     sleep, (Delay)
  1039.     send, {%left% down}
  1040.     send, {%left% up}
  1041.     sleep, (Delay)
  1042.     send, {%ccw% down}
  1043.     send, {%ccw% up}
  1044.     sleep, (Delay)
  1045.     send, {%drop% down}
  1046.     send, {%drop% up}
  1047.     sleep, (Delay)
  1048.     return
  1049. }
  1050. else {
  1051.     Piece := getPiece(nextXpos,nextYpos)
  1052.     send, {%left% down}
  1053.     send, {%left% up}
  1054.     sleep, (Delay)
  1055.     send, {%left% down}
  1056.     send, {%left% up}
  1057.     sleep, (Delay)
  1058.     send, {%left% down}
  1059.     send, {%left% up}
  1060.     sleep, (Delay)
  1061.     send, {%ccw% down}
  1062.     send, {%ccw% up}
  1063.     sleep, (Delay)
  1064.     send, {%drop% down}
  1065.     send, {%drop% up}
  1066.     sleep, (Delay)
  1067.     return
  1068. }
  1069. return
  1070.  
  1071. E::
  1072. if (Piece = "O") {
  1073.     Piece := getPiece(nextXpos,nextYpos)
  1074.     send, {%left% down}
  1075.     send, {%left% up}
  1076.     sleep, (Delay)
  1077.     send, {%left% down}
  1078.     send, {%left% up}
  1079.     sleep, (Delay)
  1080.     send, {%drop% down}
  1081.     send, {%drop% up}
  1082.     sleep, (Delay)
  1083.     return
  1084. }
  1085. else if (Piece = "S") OR (Piece = "Z") {
  1086.     Piece := getPiece(nextXpos,nextYpos)
  1087.     send, {%left% down}
  1088.     send, {%left% up}
  1089.     sleep, (Delay)
  1090.     send, {%ccw% down}
  1091.     send, {%ccw% up}
  1092.     sleep, (Delay)
  1093.     send, {%drop% down}
  1094.     send, {%drop% up}
  1095.     sleep, (Delay)
  1096.     return
  1097. }
  1098. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1099.     Piece := getPiece(nextXpos,nextYpos)
  1100.     send, {%left% down}
  1101.     send, {%left% up}
  1102.     sleep, (Delay)
  1103.     send, {%ccw% down}
  1104.     send, {%ccw% up}
  1105.     sleep, (Delay)
  1106.     send, {%drop% down}
  1107.     send, {%drop% up}
  1108.     sleep, (Delay)
  1109.     return
  1110. }
  1111. else {
  1112.     Piece := getPiece(nextXpos,nextYpos)
  1113.     send, {%left% down}
  1114.     send, {%left% up}
  1115.     sleep, (Delay)
  1116.     send, {%left% down}
  1117.     send, {%left% up}
  1118.     sleep, (Delay)
  1119.     send, {%ccw% down}
  1120.     send, {%ccw% up}
  1121.     sleep, (Delay)
  1122.     send, {%drop% down}
  1123.     send, {%drop% up}
  1124.     sleep, (Delay)
  1125.     return
  1126. }
  1127. return
  1128.  
  1129. R::
  1130. if (Piece = "O") {
  1131.     Piece := getPiece(nextXpos,nextYpos)
  1132.     send, {%left% down}
  1133.     send, {%left% up}
  1134.     sleep, (Delay)
  1135.     send, {%drop% down}
  1136.     send, {%drop% up}
  1137.     sleep, (Delay)
  1138.     return
  1139. }
  1140. else if (Piece = "S") OR (Piece = "Z") {
  1141.     Piece := getPiece(nextXpos,nextYpos)
  1142.     send, {%ccw% down}
  1143.     send, {%ccw% up}
  1144.     sleep, (Delay)
  1145.     send, {%drop% down}
  1146.     send, {%drop% up}
  1147.     sleep, (Delay)
  1148.     return
  1149. }
  1150. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1151.     Piece := getPiece(nextXpos,nextYpos)
  1152.     send, {%ccw% down}
  1153.     send, {%ccw% up}
  1154.     sleep, (Delay)
  1155.     send, {%drop% down}
  1156.     send, {%drop% up}
  1157.     sleep, (Delay)
  1158.     return
  1159. }
  1160. else {
  1161.     Piece := getPiece(nextXpos,nextYpos)
  1162.     send, {%left% down}
  1163.     send, {%left% up}
  1164.     sleep, (Delay)
  1165.     send, {%ccw% down}
  1166.     send, {%ccw% up}
  1167.     sleep, (Delay)
  1168.     send, {%drop% down}
  1169.     send, {%drop% up}
  1170.     sleep, (Delay)
  1171.     return
  1172. }
  1173. return
  1174.  
  1175. T::
  1176. if (Piece = "O") {
  1177.     Piece := getPiece(nextXpos,nextYpos)
  1178.     send, {%drop% down}
  1179.     send, {%drop% up}
  1180.     sleep, (Delay)
  1181.     return
  1182. }
  1183. else if (Piece = "S") OR (Piece = "Z") {
  1184.     Piece := getPiece(nextXpos,nextYpos)
  1185.     send, {%cw% down}
  1186.     send, {%cw% up}
  1187.     sleep, (Delay)
  1188.     send, {%drop% down}
  1189.     send, {%drop% up}
  1190.     sleep, (Delay)
  1191.     return
  1192. }
  1193. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1194.     Piece := getPiece(nextXpos,nextYpos)
  1195.     send, {%right% down}
  1196.     send, {%right% up}
  1197.     sleep, (Delay)
  1198.     send, {%ccw% down}
  1199.     send, {%ccw% up}
  1200.     sleep, (Delay)
  1201.     send, {%drop% down}
  1202.     send, {%drop% up}
  1203.     sleep, (Delay)
  1204.     return
  1205. }
  1206. else {
  1207.     Piece := getPiece(nextXpos,nextYpos)
  1208.     send, {%ccw% down}
  1209.     send, {%ccw% up}
  1210.     sleep, (Delay)
  1211.     send, {%drop% down}
  1212.     send, {%drop% up}
  1213.     sleep, (Delay)
  1214.     return
  1215. }
  1216. return
  1217.  
  1218. Y::
  1219. if (Piece = "O") {
  1220.     Piece := getPiece(nextXpos,nextYpos)
  1221.     send, {%right% down}
  1222.     send, {%right% up}
  1223.     sleep, (Delay)
  1224.     send, {%drop% down}
  1225.     send, {%drop% up}
  1226.     sleep, (Delay)
  1227.     return
  1228. }
  1229. else if (Piece = "S") OR (Piece = "Z") {
  1230.     Piece := getPiece(nextXpos,nextYpos)
  1231.     send, {%right% down}
  1232.     send, {%right% up}
  1233.     sleep, (Delay)
  1234.     send, {%cw% down}
  1235.     send, {%cw% up}
  1236.     sleep, (Delay)
  1237.     send, {%drop% down}
  1238.     send, {%drop% up}
  1239.     sleep, (Delay)
  1240.     return
  1241. }
  1242. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1243.     Piece := getPiece(nextXpos,nextYpos)
  1244.     send, {%right% down}
  1245.     send, {%right% up}
  1246.     sleep, (Delay)
  1247.     send, {%right% down}
  1248.     send, {%right% up}
  1249.     sleep, (Delay)
  1250.     send, {%ccw% down}
  1251.     send, {%ccw% up}
  1252.     sleep, (Delay)
  1253.     send, {%drop% down}
  1254.     send, {%drop% up}
  1255.     sleep, (Delay)
  1256.     return
  1257. }
  1258. else {
  1259.     Piece := getPiece(nextXpos,nextYpos)
  1260.     send, {%cw% down}
  1261.     send, {%cw% up}
  1262.     sleep, (Delay)
  1263.     send, {%drop% down}
  1264.     send, {%drop% up}
  1265.     sleep, (Delay)
  1266.     return
  1267. }
  1268. return
  1269.  
  1270. U::
  1271. if (Piece = "O") {
  1272.     Piece := getPiece(nextXpos,nextYpos)
  1273.     send, {%right% down}
  1274.     send, {%right% up}
  1275.     sleep, (Delay)
  1276.     send, {%right% down}
  1277.     send, {%right% up}
  1278.     sleep, (Delay)
  1279.     send, {%drop% down}
  1280.     send, {%drop% up}
  1281.     sleep, (Delay)
  1282.     return
  1283. }
  1284. else if (Piece = "S") OR (Piece = "Z") {
  1285.     Piece := getPiece(nextXpos,nextYpos)
  1286.     send, {%right% down}
  1287.     send, {%right% up}
  1288.     sleep, (Delay)
  1289.     send, {%right% down}
  1290.     send, {%right% up}
  1291.     sleep, (Delay)
  1292.     send, {%cw% down}
  1293.     send, {%cw% up}
  1294.     sleep, (Delay)
  1295.     send, {%drop% down}
  1296.     send, {%drop% up}
  1297.     sleep, (Delay)
  1298.     return
  1299. }
  1300. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1301.     Piece := getPiece(nextXpos,nextYpos)
  1302.     send, {%right% down}
  1303.     send, {%right% up}
  1304.     sleep, (Delay)
  1305.     send, {%right% down}
  1306.     send, {%right% up}
  1307.     sleep, (Delay)
  1308.     send, {%right% down}
  1309.     send, {%right% up}
  1310.     sleep, (Delay)
  1311.     send, {%ccw% down}
  1312.     send, {%ccw% up}
  1313.     sleep, (Delay)
  1314.     send, {%drop% down}
  1315.     send, {%drop% up}
  1316.     sleep, (Delay)
  1317.     return
  1318. }
  1319. else {
  1320.     Piece := getPiece(nextXpos,nextYpos)
  1321.     send, {%right% down}
  1322.     send, {%right% up}
  1323.     sleep, (Delay)
  1324.     send, {%cw% down}
  1325.     send, {%cw% up}
  1326.     sleep, (Delay)
  1327.     send, {%drop% down}
  1328.     send, {%drop% up}
  1329.     sleep, (Delay)
  1330.     return
  1331. }
  1332. return
  1333.  
  1334. I::
  1335. if (Piece = "O") {
  1336.     Piece := getPiece(nextXpos,nextYpos)
  1337.     send, {%right% down}
  1338.     send, {%right% up}
  1339.     sleep, (Delay)
  1340.     send, {%right% down}
  1341.     send, {%right% up}
  1342.     sleep, (Delay)
  1343.     send, {%right% down}
  1344.     send, {%right% up}
  1345.     sleep, (Delay)
  1346.     send, {%drop% down}
  1347.     send, {%drop% up}
  1348.     sleep, (Delay)
  1349.     return
  1350. }
  1351. else if (Piece = "S") OR (Piece = "Z") {
  1352.     Piece := getPiece(nextXpos,nextYpos)
  1353.     send, {%right% down}
  1354.     send, {%right% up}
  1355.     sleep, (Delay)
  1356.     send, {%right% down}
  1357.     send, {%right% up}
  1358.     sleep, (Delay)
  1359.     send, {%right% down}
  1360.     send, {%right% up}
  1361.     sleep, (Delay)
  1362.     send, {%cw% down}
  1363.     send, {%cw% up}
  1364.     sleep, (Delay)
  1365.     send, {%drop% down}
  1366.     send, {%drop% up}
  1367.     sleep, (Delay)
  1368.     return
  1369. }
  1370. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1371.     Piece := getPiece(nextXpos,nextYpos)
  1372.     send, {%right% down}
  1373.     send, {%right% up}
  1374.     sleep, (Delay)
  1375.     send, {%right% down}
  1376.     send, {%right% up}
  1377.     sleep, (Delay)
  1378.     send, {%right% down}
  1379.     send, {%right% up}
  1380.     sleep, (Delay)
  1381.     send, {%right% down}
  1382.     send, {%right% up}
  1383.     sleep, (Delay)
  1384.     send, {%ccw% down}
  1385.     send, {%ccw% up}
  1386.     sleep, (Delay)
  1387.     send, {%drop% down}
  1388.     send, {%drop% up}
  1389.     sleep, (Delay)
  1390.     return
  1391. }
  1392. else {
  1393.     Piece := getPiece(nextXpos,nextYpos)
  1394.     send, {%right% down}
  1395.     send, {%right% up}
  1396.     sleep, (Delay)
  1397.     send, {%right% down}
  1398.     send, {%right% up}
  1399.     sleep, (Delay)
  1400.     send, {%cw% down}
  1401.     send, {%cw% up}
  1402.     sleep, (Delay)
  1403.     send, {%drop% down}
  1404.     send, {%drop% up}
  1405.     sleep, (Delay)
  1406.     return
  1407. }
  1408. return
  1409.  
  1410. O::
  1411. if (Piece = "O") {
  1412.     Piece := getPiece(nextXpos,nextYpos)
  1413.     send, {%right% down}
  1414.     send, {%right% up}
  1415.     sleep, (Delay)
  1416.     send, {%right% down}
  1417.     send, {%right% up}
  1418.     sleep, (Delay)
  1419.     send, {%right% down}
  1420.     send, {%right% up}
  1421.     sleep, (Delay)
  1422.     send, {%right% down}
  1423.     send, {%right% up}
  1424.     sleep, (Delay)
  1425.     send, {%drop% down}
  1426.     send, {%drop% up}
  1427.     sleep, (Delay)
  1428.     return
  1429. }
  1430. else if (Piece = "S") OR (Piece = "Z") {
  1431.     Piece := getPiece(nextXpos,nextYpos)
  1432.     send, {%right% down}
  1433.     send, {%right% up}
  1434.     sleep, (Delay)
  1435.     send, {%right% down}
  1436.     send, {%right% up}
  1437.     sleep, (Delay)
  1438.     send, {%right% down}
  1439.     send, {%right% up}
  1440.     sleep, (Delay)
  1441.     send, {%right% down}
  1442.     send, {%right% up}
  1443.     sleep, (Delay)
  1444.     send, {%cw% down}
  1445.     send, {%cw% up}
  1446.     sleep, (Delay)
  1447.     send, {%drop% down}
  1448.     send, {%drop% up}
  1449.     sleep, (Delay)
  1450.     return
  1451. }
  1452. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1453.     Piece := getPiece(nextXpos,nextYpos)
  1454.     send, {%right% down}
  1455.     send, {%right% up}
  1456.     sleep, (Delay)
  1457.     send, {%right% down}
  1458.     send, {%right% up}
  1459.     sleep, (Delay)
  1460.     send, {%right% down}
  1461.     send, {%right% up}
  1462.     sleep, (Delay)
  1463.     send, {%right% down}
  1464.     send, {%right% up}
  1465.     sleep, (Delay)
  1466.     send, {%ccw% down}
  1467.     send, {%ccw% up}
  1468.     sleep, (Delay)
  1469.     send, {%right% down}
  1470.     send, {%right% up}
  1471.     sleep, (Delay)
  1472.     send, {%drop% down}
  1473.     send, {%drop% up}
  1474.     sleep, (Delay)
  1475.     return
  1476. }
  1477. else {
  1478.     Piece := getPiece(nextXpos,nextYpos)
  1479.     send, {%right% down}
  1480.     send, {%right% up}
  1481.     sleep, (Delay)
  1482.     send, {%right% down}
  1483.     send, {%right% up}
  1484.     sleep, (Delay)
  1485.     send, {%right% down}
  1486.     send, {%right% up}
  1487.     sleep, (Delay)
  1488.     send, {%cw% down}
  1489.     send, {%cw% up}
  1490.     sleep, (Delay)
  1491.     send, {%drop% down}
  1492.     send, {%drop% up}
  1493.     sleep, (Delay)
  1494.     return
  1495. }
  1496. return
  1497.  
  1498. P::
  1499. if (Piece = "O") {
  1500.     Piece := getPiece(nextXpos,nextYpos)
  1501.     send, {%right% down}
  1502.     send, {%right% up}
  1503.     sleep, (Delay)
  1504.     send, {%right% down}
  1505.     send, {%right% up}
  1506.     sleep, (Delay)
  1507.     send, {%right% down}
  1508.     send, {%right% up}
  1509.     sleep, (Delay)
  1510.     send, {%right% down}
  1511.     send, {%right% up}
  1512.     sleep, (Delay)
  1513.     send, {%drop% down}
  1514.     send, {%drop% up}
  1515.     sleep, (Delay)
  1516.     return
  1517. }
  1518. else if (Piece = "S") OR (Piece = "Z") {
  1519.     Piece := getPiece(nextXpos,nextYpos)
  1520.     send, {%right% down}
  1521.     send, {%right% up}
  1522.     sleep, (Delay)
  1523.     send, {%right% down}
  1524.     send, {%right% up}
  1525.     sleep, (Delay)
  1526.     send, {%right% down}
  1527.     send, {%right% up}
  1528.     sleep, (Delay)
  1529.     send, {%right% down}
  1530.     send, {%right% up}
  1531.     sleep, (Delay)
  1532.     send, {%cw% down}
  1533.     send, {%cw% up}
  1534.     sleep, (Delay)
  1535.     send, {%drop% down}
  1536.     send, {%drop% up}
  1537.     sleep, (Delay)
  1538.     return
  1539. }
  1540. else if (Piece = "L") OR (Piece = "J") OR (Piece = "T") {
  1541.     Piece := getPiece(nextXpos,nextYpos)
  1542.     send, {%right% down}
  1543.     send, {%right% up}
  1544.     sleep, (Delay)
  1545.     send, {%right% down}
  1546.     send, {%right% up}
  1547.     sleep, (Delay)
  1548.     send, {%right% down}
  1549.     send, {%right% up}
  1550.     sleep, (Delay)
  1551.     send, {%right% down}
  1552.     send, {%right% up}
  1553.     sleep, (Delay)
  1554.     send, {%ccw% down}
  1555.     send, {%ccw% up}
  1556.     sleep, (Delay)
  1557.     send, {%right% down}
  1558.     send, {%right% up}
  1559.     sleep, (Delay)
  1560.     send, {%drop% down}
  1561.     send, {%drop% up}
  1562.     sleep, (Delay)
  1563.     return
  1564. }
  1565. else {
  1566.     Piece := getPiece(nextXpos,nextYpos)
  1567.     send, {%right% down}
  1568.     send, {%right% up}
  1569.     sleep, (Delay)
  1570.     send, {%right% down}
  1571.     send, {%right% up}
  1572.     sleep, (Delay)
  1573.     send, {%right% down}
  1574.     send, {%right% up}
  1575.     sleep, (Delay)
  1576.     send, {%cw% down}
  1577.     send, {%cw% up}
  1578.     sleep, (Delay)
  1579.     send, {%right% down}
  1580.     send, {%right% up}
  1581.     sleep, (Delay)
  1582.     send, {%drop% down}
  1583.     send, {%drop% up}
  1584.     sleep, (Delay)
  1585.     return
  1586. }
  1587. return
  1588.  
  1589. 1::
  1590. if (Piece = "O") {
  1591.     Piece := getPiece(nextXpos,nextYpos)
  1592.     send, {%left% down}
  1593.     send, {%left% up}
  1594.     sleep, (Delay)
  1595.     send, {%left% down}
  1596.     send, {%left% up}
  1597.     sleep, (Delay)
  1598.     send, {%left% down}
  1599.     send, {%left% up}
  1600.     sleep, (Delay)
  1601.     send, {%left% down}
  1602.     send, {%left% up}
  1603.     sleep, (Delay)
  1604.     send, {%drop% down}
  1605.     send, {%drop% up}
  1606.     sleep, (Delay)
  1607.     return
  1608. }
  1609. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1610.     Piece := getPiece(nextXpos,nextYpos)
  1611.     send, {%left% down}
  1612.     send, {%left% up}
  1613.     sleep, (Delay)
  1614.     send, {%left% down}
  1615.     send, {%left% up}
  1616.     sleep, (Delay)
  1617.     send, {%left% down}
  1618.     send, {%left% up}
  1619.     sleep, (Delay)
  1620.     send, {%drop% down}
  1621.     send, {%drop% up}
  1622.     sleep, (Delay)
  1623.     return
  1624. }
  1625. else {
  1626.     Piece := getPiece(nextXpos,nextYpos)
  1627.     send, {%left% down}
  1628.     send, {%left% up}
  1629.     sleep, (Delay)
  1630.     send, {%left% down}
  1631.     send, {%left% up}
  1632.     sleep, (Delay)
  1633.     send, {%left% down}
  1634.     send, {%left% up}
  1635.     sleep, (Delay)
  1636.     send, {%180% down}
  1637.     send, {%180% up}
  1638.     sleep, (Delay)
  1639.     send, {%drop% down}
  1640.     send, {%drop% up}
  1641.     sleep, (Delay)
  1642.     return
  1643. }
  1644. return
  1645.  
  1646. 2::
  1647. if (Piece = "O") {
  1648.     Piece := getPiece(nextXpos,nextYpos)
  1649.     send, {%left% down}
  1650.     send, {%left% up}
  1651.     sleep, (Delay)
  1652.     send, {%left% down}
  1653.     send, {%left% up}
  1654.     sleep, (Delay)
  1655.     send, {%left% down}
  1656.     send, {%left% up}
  1657.     sleep, (Delay)
  1658.     send, {%drop% down}
  1659.     send, {%drop% up}
  1660.     sleep, (Delay)
  1661.     return
  1662. }
  1663. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1664.     Piece := getPiece(nextXpos,nextYpos)
  1665.     send, {%left% down}
  1666.     send, {%left% up}
  1667.     sleep, (Delay)
  1668.     send, {%left% down}
  1669.     send, {%left% up}
  1670.     sleep, (Delay)
  1671.     send, {%drop% down}
  1672.     send, {%drop% up}
  1673.     sleep, (Delay)
  1674.     return
  1675. }
  1676. else {
  1677.     Piece := getPiece(nextXpos,nextYpos)
  1678.     send, {%left% down}
  1679.     send, {%left% up}
  1680.     sleep, (Delay)
  1681.     send, {%left% down}
  1682.     send, {%left% up}
  1683.     sleep, (Delay)
  1684.     send, {%180% down}
  1685.     send, {%180% up}
  1686.     sleep, (Delay)
  1687.     send, {%drop% down}
  1688.     send, {%drop% up}
  1689.     sleep, (Delay)
  1690.     return
  1691. }
  1692. return
  1693.  
  1694. 3::
  1695. if (Piece = "O") {
  1696.     Piece := getPiece(nextXpos,nextYpos)
  1697.     send, {%left% down}
  1698.     send, {%left% up}
  1699.     sleep, (Delay)
  1700.     send, {%left% down}
  1701.     send, {%left% up}
  1702.     sleep, (Delay)
  1703.     send, {%drop% down}
  1704.     send, {%drop% up}
  1705.     sleep, (Delay)
  1706.     return
  1707. }
  1708. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1709.     Piece := getPiece(nextXpos,nextYpos)
  1710.     send, {%left% down}
  1711.     send, {%left% up}
  1712.     sleep, (Delay)
  1713.     send, {%drop% down}
  1714.     send, {%drop% up}
  1715.     sleep, (Delay)
  1716.     return
  1717. }
  1718. else {
  1719.     Piece := getPiece(nextXpos,nextYpos)
  1720.     send, {%left% down}
  1721.     send, {%left% up}
  1722.     sleep, (Delay)
  1723.     send, {%180% down}
  1724.     send, {%180% up}
  1725.     sleep, (Delay)
  1726.     send, {%drop% down}
  1727.     send, {%drop% up}
  1728.     sleep, (Delay)
  1729.     return
  1730. }
  1731. return
  1732.  
  1733. 4::
  1734. if (Piece = "O") {
  1735.     Piece := getPiece(nextXpos,nextYpos)
  1736.     send, {%left% down}
  1737.     send, {%left% up}
  1738.     sleep, (Delay)
  1739.     send, {%drop% down}
  1740.     send, {%drop% up}
  1741.     sleep, (Delay)
  1742.     return
  1743. }
  1744. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1745.     Piece := getPiece(nextXpos,nextYpos)
  1746.     send, {%drop% down}
  1747.     send, {%drop% up}
  1748.     sleep, (Delay)
  1749.     return
  1750. }
  1751. else {
  1752.     Piece := getPiece(nextXpos,nextYpos)
  1753.     send, {%180% down}
  1754.     send, {%180% up}
  1755.     sleep, (Delay)
  1756.     send, {%drop% down}
  1757.     send, {%drop% up}
  1758.     sleep, (Delay)
  1759.     return
  1760. }
  1761. return
  1762.  
  1763. 5::
  1764. if (Piece = "O") {
  1765.     Piece := getPiece(nextXpos,nextYpos)
  1766.     send, {%drop% down}
  1767.     send, {%drop% up}
  1768.     sleep, (Delay)
  1769.     return
  1770. }
  1771. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1772.     Piece := getPiece(nextXpos,nextYpos)
  1773.     send, {%right% down}
  1774.     send, {%right% up}
  1775.     sleep, (Delay)
  1776.     send, {%drop% down}
  1777.     send, {%drop% up}
  1778.     sleep, (Delay)
  1779.     return
  1780. }
  1781. else {
  1782.     Piece := getPiece(nextXpos,nextYpos)
  1783.     send, {%right% down}
  1784.     send, {%right% up}
  1785.     sleep, (Delay)
  1786.     send, {%180% down}
  1787.     send, {%180% up}
  1788.     sleep, (Delay)
  1789.     send, {%drop% down}
  1790.     send, {%drop% up}
  1791.     sleep, (Delay)
  1792.     return
  1793. }
  1794. return
  1795.  
  1796. 6::
  1797. if (Piece = "O") {
  1798.     Piece := getPiece(nextXpos,nextYpos)
  1799.     send, {%right% down}
  1800.     send, {%right% up}
  1801.     sleep, (Delay)
  1802.     send, {%drop% down}
  1803.     send, {%drop% up}
  1804.     sleep, (Delay)
  1805.     return
  1806. }
  1807. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1808.     Piece := getPiece(nextXpos,nextYpos)
  1809.     send, {%right% down}
  1810.     send, {%right% up}
  1811.     sleep, (Delay)
  1812.     send, {%right% down}
  1813.     send, {%right% up}
  1814.     sleep, (Delay)
  1815.     send, {%drop% down}
  1816.     send, {%drop% up}
  1817.     sleep, (Delay)
  1818.     return
  1819. }
  1820. else {
  1821.     Piece := getPiece(nextXpos,nextYpos)
  1822.     send, {%right% down}
  1823.     send, {%right% up}
  1824.     sleep, (Delay)
  1825.     send, {%right% down}
  1826.     send, {%right% up}
  1827.     sleep, (Delay)
  1828.     send, {%180% down}
  1829.     send, {%180% up}
  1830.     sleep, (Delay)
  1831.     send, {%drop% down}
  1832.     send, {%drop% up}
  1833.     sleep, (Delay)
  1834.     return
  1835. }
  1836. return
  1837.  
  1838. 7::
  1839. if (Piece = "O") {
  1840.     Piece := getPiece(nextXpos,nextYpos)
  1841.     send, {%right% down}
  1842.     send, {%right% up}
  1843.     sleep, (Delay)
  1844.     send, {%right% down}
  1845.     send, {%right% up}
  1846.     sleep, (Delay)
  1847.     send, {%drop% down}
  1848.     send, {%drop% up}
  1849.     sleep, (Delay)
  1850.     return
  1851. }
  1852. else if (Piece = "S") OR (Piece = "Z") OR (Piece = "I") {
  1853.     Piece := getPiece(nextXpos,nextYpos)
  1854.     send, {%right% down}
  1855.     send, {%right% up}
  1856.     sleep, (Delay)
  1857.     send, {%right% down}
  1858.     send, {%right% up}
  1859.     sleep, (Delay)
  1860.     send, {%right% down}
  1861.     send, {%right% up}
  1862.     sleep, (Delay)
  1863.     send, {%drop% down}
  1864.     send, {%drop% up}
  1865.     sleep, (Delay)
  1866.     return
  1867. }
  1868. else {
  1869.     Piece := getPiece(nextXpos,nextYpos)
  1870.     send, {%right% down}
  1871.     send, {%right% up}
  1872.     sleep, (Delay)
  1873.     send, {%right% down}
  1874.     send, {%right% up}
  1875.     sleep, (Delay)
  1876.     send, {%right% down}
  1877.     send, {%right% up}
  1878.     sleep, (Delay)
  1879.     send, {%180% down}
  1880.     send, {%180% up}
  1881.     sleep, (Delay)
  1882.     send, {%drop% down}
  1883.     send, {%drop% up}
  1884.     sleep, (Delay)
  1885.     return
  1886. }
  1887. return
  1888.  
  1889. 8::
  1890. if (Piece = "O") {
  1891.     Piece := getPiece(nextXpos,nextYpos)
  1892.     send, {%right% down}
  1893.     send, {%right% up}
  1894.     sleep, (Delay)
  1895.     send, {%right% down}
  1896.     send, {%right% up}
  1897.     sleep, (Delay)
  1898.     send, {%right% down}
  1899.     send, {%right% up}
  1900.     sleep, (Delay)
  1901.     send, {%drop% down}
  1902.     send, {%drop% up}
  1903.     sleep, (Delay)
  1904.     return
  1905. }
  1906. else if (Piece = "S") OR (Piece = "Z") {
  1907.     Piece := getPiece(nextXpos,nextYpos)
  1908.     send, {%right% down}
  1909.     send, {%right% up}
  1910.     sleep, (Delay)
  1911.     send, {%right% down}
  1912.     send, {%right% up}
  1913.     sleep, (Delay)
  1914.     send, {%right% down}
  1915.     send, {%right% up}
  1916.     sleep, (Delay)
  1917.     send, {%right% down}
  1918.     send, {%right% up}
  1919.     sleep, (Delay)
  1920.     send, {%drop% down}
  1921.     send, {%drop% up}
  1922.     sleep, (Delay)
  1923.     return
  1924. }
  1925. else if (Piece = "I") {
  1926.     Piece := getPiece(nextXpos,nextYpos)
  1927.     send, {%right% down}
  1928.     send, {%right% up}
  1929.     sleep, (Delay)
  1930.     send, {%right% down}
  1931.     send, {%right% up}
  1932.     sleep, (Delay)
  1933.     send, {%right% down}
  1934.     send, {%right% up}
  1935.     sleep, (Delay)
  1936.     send, {%drop% down}
  1937.     send, {%drop% up}
  1938.     sleep, (Delay)
  1939.     return
  1940.     return
  1941. }
  1942. else {
  1943.     Piece := getPiece(nextXpos,nextYpos)
  1944.     send, {%right% down}
  1945.     send, {%right% up}
  1946.     sleep, (Delay)
  1947.     send, {%right% down}
  1948.     send, {%right% up}
  1949.     sleep, (Delay)
  1950.     send, {%right% down}
  1951.     send, {%right% up}
  1952.     sleep, (Delay)
  1953.     send, {%right% down}
  1954.     send, {%right% up}
  1955.     sleep, (Delay)
  1956.     send, {%180% down}
  1957.     send, {%180% up}
  1958.     sleep, (Delay)
  1959.     send, {%drop% down}
  1960.     send, {%drop% up}
  1961.     sleep, (Delay)
  1962.     return
  1963. }
  1964. return
  1965.  
  1966. 9::
  1967. if (Piece = "O") {
  1968.     Piece := getPiece(nextXpos,nextYpos)
  1969.     send, {%right% down}
  1970.     send, {%right% up}
  1971.     sleep, (Delay)
  1972.     send, {%right% down}
  1973.     send, {%right% up}
  1974.     sleep, (Delay)
  1975.     send, {%right% down}
  1976.     send, {%right% up}
  1977.     sleep, (Delay)
  1978.     send, {%right% down}
  1979.     send, {%right% up}
  1980.     sleep, (Delay)
  1981.     send, {%drop% down}
  1982.     send, {%drop% up}
  1983.     sleep, (Delay)
  1984.     return
  1985. }
  1986. else if (Piece = "S") OR (Piece = "Z") {
  1987.     Piece := getPiece(nextXpos,nextYpos)
  1988.     send, {%right% down}
  1989.     send, {%right% up}
  1990.     sleep, (Delay)
  1991.     send, {%right% down}
  1992.     send, {%right% up}
  1993.     sleep, (Delay)
  1994.     send, {%right% down}
  1995.     send, {%right% up}
  1996.     sleep, (Delay)
  1997.     send, {%right% down}
  1998.     send, {%right% up}
  1999.     sleep, (Delay)
  2000.     send, {%drop% down}
  2001.     send, {%drop% up}
  2002.     sleep, (Delay)
  2003.     return
  2004. }
  2005. else if (Piece = "I") {
  2006.     Piece := getPiece(nextXpos,nextYpos)
  2007.     send, {%right% down}
  2008.     send, {%right% up}
  2009.     sleep, (Delay)
  2010.     send, {%right% down}
  2011.     send, {%right% up}
  2012.     sleep, (Delay)
  2013.     send, {%right% down}
  2014.     send, {%right% up}
  2015.     sleep, (Delay)
  2016.     send, {%drop% down}
  2017.     send, {%drop% up}
  2018.     sleep, (Delay)
  2019.     return
  2020.     return
  2021. }
  2022. else {
  2023.     Piece := getPiece(nextXpos,nextYpos)
  2024.     send, {%right% down}
  2025.     send, {%right% up}
  2026.     sleep, (Delay)
  2027.     send, {%right% down}
  2028.     send, {%right% up}
  2029.     sleep, (Delay)
  2030.     send, {%right% down}
  2031.     send, {%right% up}
  2032.     sleep, (Delay)
  2033.     send, {%right% down}
  2034.     send, {%right% up}
  2035.     sleep, (Delay)
  2036.     send, {%180% down}
  2037.     send, {%180% up}
  2038.     sleep, (Delay)
  2039.     send, {%drop% down}
  2040.     send, {%drop% up}
  2041.     sleep, (Delay)
  2042.     return
  2043. }
  2044. return
  2045.  
  2046. 0::
  2047. if (Piece = "O") {
  2048.     Piece := getPiece(nextXpos,nextYpos)
  2049.     send, {%right% down}
  2050.     send, {%right% up}
  2051.     sleep, (Delay)
  2052.     send, {%right% down}
  2053.     send, {%right% up}
  2054.     sleep, (Delay)
  2055.     send, {%right% down}
  2056.     send, {%right% up}
  2057.     sleep, (Delay)
  2058.     send, {%right% down}
  2059.     send, {%right% up}
  2060.     sleep, (Delay)
  2061.     send, {%drop% down}
  2062.     send, {%drop% up}
  2063.     sleep, (Delay)
  2064.     return
  2065. }
  2066. else if (Piece = "S") OR (Piece = "Z") {
  2067.     Piece := getPiece(nextXpos,nextYpos)
  2068.     send, {%right% down}
  2069.     send, {%right% up}
  2070.     sleep, (Delay)
  2071.     send, {%right% down}
  2072.     send, {%right% up}
  2073.     sleep, (Delay)
  2074.     send, {%right% down}
  2075.     send, {%right% up}
  2076.     sleep, (Delay)
  2077.     send, {%right% down}
  2078.     send, {%right% up}
  2079.     sleep, (Delay)
  2080.     send, {%drop% down}
  2081.     send, {%drop% up}
  2082.     sleep, (Delay)
  2083.     return
  2084. }
  2085. else if (Piece = "I") {
  2086.     Piece := getPiece(nextXpos,nextYpos)
  2087.     send, {%right% down}
  2088.     send, {%right% up}
  2089.     sleep, (Delay)
  2090.     send, {%right% down}
  2091.     send, {%right% up}
  2092.     sleep, (Delay)
  2093.     send, {%right% down}
  2094.     send, {%right% up}
  2095.     sleep, (Delay)
  2096.     send, {%drop% down}
  2097.     send, {%drop% up}
  2098.     sleep, (Delay)
  2099.     return
  2100.     return
  2101. }
  2102. else {
  2103.     Piece := getPiece(nextXpos,nextYpos)
  2104.     send, {%right% down}
  2105.     send, {%right% up}
  2106.     sleep, (Delay)
  2107.     send, {%right% down}
  2108.     send, {%right% up}
  2109.     sleep, (Delay)
  2110.     send, {%right% down}
  2111.     send, {%right% up}
  2112.     sleep, (Delay)
  2113.     send, {%right% down}
  2114.     send, {%right% up}
  2115.     sleep, (Delay)
  2116.     send, {%180% down}
  2117.     send, {%180% up}
  2118.     sleep, (Delay)
  2119.     send, {%drop% down}
  2120.     send, {%drop% up}
  2121.     sleep, (Delay)
  2122.     return
  2123. }
  2124. return
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135. ;Detect which piece is on a specific coordinate
  2136. getPiece(x,y)
  2137.     {
  2138.     PixelGetColor, b, x, y
  2139.     r := Mod( b, 0x100 )
  2140.     b -= r
  2141.     b /= 0x100
  2142.     g := Mod( b, 0x100 )
  2143.     b -= g
  2144.     b /= 0x100
  2145.     If ( r < 20 AND g < 20 AND b < 20 ) ; black
  2146.         return "#"
  2147.     Else If ( ABS( g - r ) <= 7 AND ABS( g - b ) <= 5 ) ; white
  2148.         return "*"
  2149.     Else If ( r >= 2*g AND r >= 2*b ) ; red
  2150.         return "Z"
  2151.     Else If ( ( b >= 2*r OR b - 80 >= r ) AND ( b >= 2*g OR b - 80 >= g ) ) ; blue
  2152.         return "J"
  2153.     Else If ( g >= 2*r AND g >= 2*b ) ; green
  2154.         return "S" 
  2155.     Else If ( r >= 2*g AND ABS( r - b ) <= 0.25*r ) ; purple
  2156.         return "T"
  2157.     Else If ( g >= 2*r AND ABS( g - b ) <= 0.25*g ) ; cyan
  2158.         return "I"
  2159.     Else If ( ( g >= 2*b OR g - 70 >= b ) AND ABS( g - 1.07*r ) <= 0.25*g  AND ( r < g OR ( r = 255 AND b >= 85 ) )  ) ; yellow
  2160.         return "O"
  2161.     Else If ( r >= 2*b AND ( ABS( r - 1.4*g ) <= 0.25*r OR ( r = 255 AND g > 180 AND b < 85 ) ) ) ; orange
  2162.         return "L"
  2163.     }
  2164. Return
Advertisement
RAW Paste Data Copied
Advertisement