Advertisement
Guest User

Untitled

a guest
May 10th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.19 KB | None | 0 0
  1. alias project1 {
  2. if (!$window(@random)) { window -pdoC @random 0 0 1000 1000 }
  3. .timerdrawrandom -h 0 30 /drawrandom $1
  4. unset %time
  5. inc -c %time
  6. set %frames 0
  7. }
  8. alias drawrandom {
  9. drawrect -rnf @random $rgb(0,0,0) 1 0 0 1000 1000
  10. var %random 1
  11. while (%random < $1) {
  12. drawdot -rn @random $r(0,16777215) $r(10,30) $r(20,980) $r(20,980)
  13. inc %random
  14. }
  15. inc %frames
  16. fps
  17. drawdot @random
  18. }
  19. on *:CLOSE:@random: {
  20. .timerdraw* off
  21. unset %frames
  22. unset %time
  23. }
  24. alias project2 {
  25. if (!$window(@random)) { window -pdoC @random 0 0 500 500 }
  26. if (!$window(@randombuf)) { window -ph @randombuf 0 0 600 600 }
  27. drawpic @randombuf 5 5 soldiers.png
  28. .timerdrawrandom -h 0 30 /drawtest
  29. set %dot.loc.x 200
  30. set %dot.loc.y 30
  31. unset %time
  32. inc -c %time
  33. set %frames 0
  34. set %click 1
  35. set %kills 0
  36. }
  37. alias drawtest {
  38. inc %frames
  39. drawrect -rnf @random $rgb(0,0,0) 1 0 0 $window(@random).w $window(@random).h
  40. if ($mouse.win == @random) && ($getside(@random, %dot.loc.x, %dot.loc.y, $mouse.x, $mouse.y)) { drawcopy -t @randombuf $rgb(255,0,255) $calc(10 + (($ifmatch - 1) * 25)) 10 20 20 @random $calc(%dot.loc.x - 10) $calc(%dot.loc.y - 10) }
  41. else { drawdot -rn @random $rgb(255,255,255) 11 %dot.loc.x %dot.loc.y }
  42. drawline -rn @random $rgb(255,255,255) 1 0 20 400 100
  43. drawline -rn @random $rgb(255,255,255) 1 500 120 100 200
  44. drawline -rn @random $rgb(255,255,255) 1 0 220 400 300
  45. drawline -rn @random $rgb(255,255,255) 1 500 320 100 400
  46. ;;; cursor draw ;;;
  47. if ($mouse.win == @random) {
  48. drawtext -rn @random $rgb(255,255,255) 10 445 SIDE: $replace($getside(@random, %dot.loc.x, %dot.loc.y, $mouse.x, $mouse.y), 1, NORTH, 2, NORTH-EAST, 3, EAST, 4, SOUTH-EAST, 5, SOUTH, 6, SOUTH-WEST, 7, WEST, 8, NORTH-WEST)
  49. drawline -rn @random $rgb(0,0,255) 1 %dot.loc.x %dot.loc.y $window(@random).w $calc($window(@random).h / 3) $window(@random).w $calc(($window(@random).h / 3) * 2) %dot.loc.x %dot.loc.y
  50. drawline -rn @random $rgb(0,0,255) 1 %dot.loc.x %dot.loc.y 0 $calc($window(@random).h / 3) 0 $calc(($window(@random).h / 3) * 2)) %dot.loc.x %dot.loc.y
  51. drawline -rn @random $rgb(0,0,255) 1 %dot.loc.x %dot.loc.y $calc(($window(@random).w / 3) * 2) 0 $calc($window(@random).w / 3) 0 %dot.loc.x %dot.loc.y
  52. drawline -rn @random $rgb(0,0,255) 1 %dot.loc.x %dot.loc.y $calc(($window(@random).w / 3) * 2) $window(@random).h $calc($window(@random).w / 3) $window(@random).h %dot.loc.x %dot.loc.y
  53. }
  54. ;;; end cursor ;;;
  55. ;;drawline -rn @random $rgb(255,0,0) 1 $calc(%dot.loc.x - 10) $calc(%dot.loc.y - 5) $calc(%dot.loc.x - 10) $calc(%dot.loc.y + 5) $calc(%dot.loc.x - 5) $calc(%dot.loc.y + 10) $calc(%dot.loc.x + 5) $calc(%dot.loc.y + 10) $calc(%dot.loc.x + 10) $calc(%dot.loc.y + 5) $calc(%dot.loc.x + 10) $calc(%dot.loc.y - 5) $calc(%dot.loc.x + 5) $calc(%dot.loc.y - 10) $calc(%dot.loc.x - 5) $calc(%dot.loc.y - 10) $calc(%dot.loc.x - 10) $calc(%dot.loc.y - 5)
  56. drawdot @random
  57. if (%dot.loc.x > $window(@random).w) || (%dot.loc.y > $window(@random).h) {
  58. set %dot.loc.x 10
  59. set %dot.loc.y 0
  60. }
  61. if ($onpoly(2, 8,500,120,100,200, $calc(%dot.loc.x - 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x - 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x - 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x + 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x + 6), $calc(%dot.loc.y - 12), $calc(%dot.loc.x - 6), $calc(%dot.loc.y - 12))) {
  62. dec %dot.loc.x 5
  63. inc %dot.loc.y 1
  64. }
  65. elseif ($onpoly(2, 8,0,20,400,100, $calc(%dot.loc.x - 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x - 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x - 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x + 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x + 6), $calc(%dot.loc.y - 12), $calc(%dot.loc.x - 6), $calc(%dot.loc.y - 12))) {
  66. inc %dot.loc.x 5
  67. inc %dot.loc.y 1
  68. }
  69. elseif ($onpoly(2, 8,0,220,400,300, $calc(%dot.loc.x - 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x - 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x - 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x + 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x + 6), $calc(%dot.loc.y - 12), $calc(%dot.loc.x - 6), $calc(%dot.loc.y - 12))) {
  70. inc %dot.loc.x 5
  71. inc %dot.loc.y 1
  72. }
  73. elseif ($onpoly(2, 8,500,320,100,400, $calc(%dot.loc.x - 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x - 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x - 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 6), $calc(%dot.loc.y + 12), $calc(%dot.loc.x + 12), $calc(%dot.loc.y + 6), $calc(%dot.loc.x + 12), $calc(%dot.loc.y - 6), $calc(%dot.loc.x + 6), $calc(%dot.loc.y - 12), $calc(%dot.loc.x - 6), $calc(%dot.loc.y - 12))) {
  74. dec %dot.loc.x 5
  75. inc %dot.loc.y 1
  76. }
  77. else {
  78. inc %dot.loc.y 5
  79. }
  80. fps
  81. }
  82. alias project3 {
  83. if (!$window(@random)) { window -pdoC @random 0 0 500 500 }
  84. if (!$window(@randombuf)) { window -ph @randombuf 0 0 600 600 }
  85. drawpic @randombuf 5 5 soldiers.png
  86. .timerdrawrandom -h 0 30 /project3.draw
  87. .timerdrawkeys -h 0 1 /project.keys
  88. set %loc.x 240
  89. set %loc.y 240
  90. unset %time
  91. inc -c %time
  92. set %frames 0
  93. set %side 1
  94. }
  95. alias project3.draw {
  96. inc %frames
  97. if ($mouse.win == @random) { set %side $iif($getside(@random, %loc.x, %loc.y, $mouse.x, $mouse.y), $ifmatch, %side) }
  98. drawrect -rnf @random $rgb(39,77,33) 1 0 0 $window(@random).w $window(@random).h
  99. if (%tremor) { drawdot -rn @random $rgb(253,143,77) %tremor %t.x %t.y }
  100. if (%tremorcool) { drawdot -rn @random $rgb(39,133,88) 100 %t.x %t.y }
  101. if (%fire) { drawrect -rfn @random $rgb(255,0,0) 1 $drawfire }
  102. if (%firecool) { drawrect -rfn @random $rgb(33,77,60) 1 $drawfire }
  103. drawcopy -nt @randombuf $rgb(255,0,255) $calc(10 + ((%side * 25) - 25)) 10 20 20 @random %loc.x %loc.y
  104. fps
  105. drawdot @random
  106. }
  107. on *:KEYDOWN:@random:*: {
  108. set %keys $addtok(%keys, $keyval, 46)
  109. }
  110. on *:KEYUP:@random:*: {
  111. set %keys $deltok(%keys, $findtok(%keys, $keyval, 1, 46), 46)
  112. }
  113. alias project.keys {
  114. ;; 48 - 57 | 0 - 9
  115. if (!%tremorcool) && (49 isin %keys) { drawtremor }
  116. if (!%firecool) && (50 isin %keys) { drawfire }
  117. if (87 isin %keys) { dec %loc.y }
  118. if (65 isin %keys) { dec %loc.x }
  119. if (83 isin %keys) { inc %loc.y }
  120. if (68 isin %keys) { inc %loc.x }
  121. }
  122. alias drawtremor {
  123. if (!%tremor) { set %tremor 1 | set %t.x $calc(%loc.x + 10) | set %t.y $calc(%loc.y + 10) }
  124. inc %tremor
  125. if (%tremor < 100) { .timertremor -m 1 1 /drawtremor }
  126. else { set -z %tremorcool 15 | unset %tremor }
  127. }
  128. alias drawfire {
  129. if ($isid) {
  130. if (%f.side == 5) {
  131. return %f.x %f.y 20 %f.L
  132. }
  133. elseif (%f.side == 1) {
  134. return %f.x $calc(%f.y - %f.L) 20 %f.L
  135. }
  136. elseif (%f.side == 3) {
  137. return %f.x %f.y %f.L 20
  138. }
  139. elseif (%f.side == 7) {
  140. return $calc(%f.x - %f.L) %f.y %f.L 20
  141. }
  142. }
  143. if (!%fire) { set %fire 50 | set %f.x %loc.x | set %f.y %loc.y | set %f.side %side }
  144. inc %fire 10
  145. set %f.L %fire
  146. if (%fire < 300) { .timerfire -m 1 30 /drawfire }
  147. else { set -z %firecool 5 | unset %fire }
  148. }
  149. alias getside {
  150. ;;; $getside(@window,Xo,Yo,Xm,Ym)
  151. ;;; @window = Picture window name
  152. ;;; Xo - Yo = X and Y object position
  153. ;;; Xm - Ym = X and Y of mouse position
  154. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  155. ;;; Returns 1 to 8
  156. ;;; 1 = UP, 3 = RIGHT, 5 = DOWN, 7 = LEFT
  157. ;;; 2 = UP/RIGHT, 4 = RIGHT/DOWN, 6 = DOWN/LEFT, 8 = LEFT/UP
  158. ;;; OR
  159. ;;; 1 = NORTH, 2 = NORTH-EAST, 3 = EAST, 4 = SOUTH-EAST
  160. ;;; 5 = SOUTH, 6 = SOUTH-WEST, 7 = WEST, 8 = NORTH-WEST
  161. if ($1) && ($2) && ($3) && (4) && ($5) {
  162. if ($inpoly($4,$5, $2, $3, $calc(($window($1).w / 3) * 2), 0, $calc($window($1).w / 3), 0)) {
  163. return 1
  164. }
  165. elseif ($inpoly($4,$5, $2, $3, $calc(($window($1).w / 3) * 2), 0, $window($1).w, 0, $window($1).w, $calc($window($1).h / 3))) {
  166. return 2
  167. }
  168. elseif ($inpoly($4,$5, $2, $3, $window($1).w, $calc($window($1).h / 3), $window($1).w, $calc(($window($1).h / 3) * 2))) {
  169. return 3
  170. }
  171. elseif ($inpoly($4,$5, $2, $3, $window($1).w, $calc(($window($1).h / 3) * 2), $window($1).w, $window($1).h, $calc(($window($1).w / 3) * 2), $window($1).h)) {
  172. return 4
  173. }
  174. elseif ($inpoly($4,$5, $2, $3, $calc(($window($1).w / 3) * 2), $window($1).h, $calc($window($1).w / 3), $window($1).h)) {
  175. return 5
  176. }
  177. elseif ($inpoly($4,$5, $2, $3, $calc($window($1).w / 3), $window($1).h, 0, $window($1).h, 0, $calc(($window($1).h / 3) * 2))) {
  178. return 6
  179. }
  180. elseif ($inpoly($4,$5, $2, $3, 0, $calc($window($1).h / 3), 0, $calc(($window($1).h / 3) * 2))) {
  181. return 7
  182. }
  183. elseif ($inpoly($4,$5, $2, $3, 0, $calc($window($1).h / 3), 0, 0, $calc($window($1).w / 3), 0)) {
  184. return 8
  185. }
  186. }
  187. else { echo -s Error getside }
  188. }
  189. alias FPS {
  190. if (!$window(@FPS)) { !window -k0pdo +L @FPS 300 300 600 90 }
  191. !tokenize 32 $int($calc(%frames / %time)) %frames %time
  192. !drawrect -frn @FPS $rgb(0,0,0) 1 0 0 600 100
  193. !drawtext -rn @FPS $rgb(255,255,255) 10 10 Report:
  194. !drawtext -rn @FPS $rgb(255,255,255) 10 35 FPS( $+ $1 $+ ):
  195. !if ($1 isnum 1-25) {
  196. !drawtext -rn @FPS $rgb(255,0,0) 73 35 $str(|,$1)
  197. !if ($3 > 20) { drawtext -rn @FPS $rgb(255,0,0) 68 10 FPS to low, contact maker or look for fix. }
  198. !else { drawtext -rn @FPS $rgb(255,0,0) 68 10 FPS starting up, please wait. }
  199. }
  200. !if ($1 isnum 26-35) {
  201. !drawtext -rn @FPS $rgb(255,0,0) 73 35 $str(|,25)
  202. !drawtext -rn @FPS $rgb(0,255,0) 273 35 $str(|,$calc($1 - 25))
  203. !if ($3 > 20) { drawtext -rn @FPS $rgb(0,255,0) 68 10 FPS is perfect }
  204. !else { drawtext -rn @FPS $rgb(255,0,0) 68 10 FPS starting up, please wait. }
  205. }
  206. !if ($1 > 35) {
  207. !drawtext -rn @FPS $rgb(255,0,0) 73 35 $str(|,25)
  208. !drawtext -rn @FPS $rgb(0,255,0) 273 35 $str(|,10)
  209. !drawtext -rn @FPS $rgb(0,0,255) 353 35 $str(|,$calc($1 - 35))
  210. !if ($3 > 20) { drawtext -rn @FPS $rgb(0,0,255) 68 10 FPS to high, chance application will run to fast to use. }
  211. !else { drawtext -rn @FPS $rgb(255,0,0) 68 10 FPS starting up, please wait. }
  212. }
  213. !titlebar @FPS $1 Time(s): $3 Frames: $2
  214. !drawdot @FPS
  215. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement