Advertisement
Guest User

Save The Earth The Incremental bot script v0.2

a guest
Oct 18th, 2014
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. ; bot for Save The Earth
  2. ; http://madscripter.wordpress.com
  3. ;
  4. ; This is an AutoIT3 script
  5. ; Get AutoIT at http://www.autoitscript.com/autoit3/index.shtml
  6. ;
  7. ; v0.1 - clicks on aliens, alien carriers, motherships, supply boxes, Filcher (magnet ship)
  8. ; doesn't click on fast alien ship
  9. ; This bot is highly dependent on finding colors - it may not work on all machines - please send me feedback if it doesn't work
  10. ;
  11. ; v0.2
  12. ; finds starting coordinates
  13. ; auto-switch between aliens
  14. ;
  15. ; todo:
  16. ; use research tab for better color matching?
  17.  
  18. Global $paused
  19. Global $MouseX
  20. Global $GCF1
  21. Global $GCF2
  22. Global $find1
  23. Global $find2
  24. Global $find3
  25. Global $find4
  26. Global $currentcolor
  27. Global $errorcount
  28.  
  29. HotKeySet("{ESC}", "Terminate")
  30. HotKeySet("{PAUSE}","_pause")
  31.  
  32. Opt("MouseCoordMode", 1)
  33. Opt("WinTitleMatchMode", 2)
  34.  
  35. ;IE7/8
  36. WinActivate("[CLASS:IEFrame]", "")
  37. ;Firefox3
  38. WinActivate("[CLASS:MozillaUIWindowClass]", "")
  39. ;Firefox4
  40. WinActivate("[CLASS:MozillaWindowClass]", "")
  41. ;Opera
  42. WinActivate("[CLASS:aPluginWinClass]", "")
  43. ;Opera
  44. WinActivate("[CLASS:OperaWindowClass]", "")
  45. ;Chrome
  46. WinActivate("[CLASS:Chrome_WidgetWin_0]", "")
  47. WinActivate("[CLASS:Chrome_WidgetWin_1]", "")
  48. WinActivate("Save the Earth")
  49.  
  50. ;Sleep(100)
  51.  
  52. ; find starting coordinates
  53. ; find black line that is at least 1300 pixels long
  54.  
  55. $GCF1 = PixelSearch(1, 1, 1000, 1000, 0x000000, 0)
  56. for $searchy = 1 to 500
  57. for $searchx = 1 to 1500
  58.  
  59. $findcolor = (PixelGetColor($searchx, $searchy))
  60. $fail = 0
  61. If $findcolor = 0 Then
  62. for $x = 1 to 1300
  63. $findcolor = PixelGetColor($searchx + $x, $searchy)
  64. If $findcolor <> 0 Then
  65. $x=1300
  66. $fail = 1
  67. EndIf
  68. Next
  69. If $fail = 0 Then
  70. $foundx = $searchx
  71. $foundy = $searchy
  72. $searchx = 1500
  73. $searchy = 500
  74. EndIf
  75. EndIf
  76.  
  77. Next
  78.  
  79. Next
  80.  
  81. ConsoleWrite ($foundx & " " & $foundy & @CRLF)
  82.  
  83. $currentcolor = 0x8B7895
  84. $errorcount = 1
  85.  
  86. While 1
  87. For $X = 1 to 100
  88. $GCF2 = PixelSearch($foundx+833, $foundy+611, $foundx+20, $foundy+57, $currentcolor, 4)
  89. If Not @error Then
  90. $find3 = $GCF2[0]
  91. $find4 = $GCF2[1]
  92. MouseMove ($find3, $find4, 0)
  93. MouseClick("left")
  94. Else
  95. $errorcount = $errorcount + 1
  96. EndIf
  97. Next
  98.  
  99. OtherShips()
  100.  
  101. For $X = 1 to 200
  102. $GCF2 = PixelSearch($foundx+20, $foundy+57, $foundx+933, $foundy+611, $currentcolor, 4)
  103. If Not @error Then
  104. $find3 = $GCF2[0]
  105. $find4 = $GCF2[1]
  106. MouseMove ($find3, $find4, 0)
  107. MouseClick("left")
  108. Else
  109. $errorcount = $errorcount + 1
  110. EndIf
  111. Next
  112.  
  113. OtherShips()
  114.  
  115. If $errorcount > 100 Then
  116. If $currentcolor = 0x8B7895 Then
  117. $currentcolor = 0x7B7E94
  118. ElseIf $currentcolor = 0x7B7E94 Then
  119. $currentcolor = 0x08B7895
  120. EndIf
  121. $errorcount = 1
  122. EndIf
  123.  
  124. WEnd
  125.  
  126. Func OtherShips()
  127. ; Supply Green
  128. $GCF2 = PixelSearch(195, 146, 1108, 700, 0x569036, 4)
  129. If Not @error Then
  130. $find3 = $GCF2[0]
  131. $find4 = $GCF2[1]
  132. MouseMove ($find3, $find4, 0)
  133. MouseClick("left")
  134. ;ConsoleWrite ("green supply clicked")
  135. EndIf
  136.  
  137. ; Supply Yellow
  138. $GCF2 = PixelSearch(195, 146, 1108, 700, 0xDB9B11, 4)
  139. If Not @error Then
  140. $find3 = $GCF2[0]
  141. $find4 = $GCF2[1]
  142. MouseMove ($find3, $find4, 0)
  143. MouseClick("left")
  144. ;ConsoleWrite ("yellow supply clicked")
  145. EndIf
  146.  
  147. ; Supply - Blue
  148. $GCF2 = PixelSearch(195, 146, 1108, 700, 0x366B90, 4)
  149. If Not @error Then
  150. $find3 = $GCF2[0]
  151. $find4 = $GCF2[1]
  152. MouseMove ($find3, $find4, 0)
  153. MouseClick("left")
  154. ;ConsoleWrite ("blue supply clicked")
  155. EndIf
  156.  
  157. ; Mothership
  158. $Leave = 1
  159. While $Leave = 1
  160. $GCF2 = PixelSearch(195, 146, 1108, 700, 0x7BB35D, 4)
  161. If Not @error Then
  162. $find3 = $GCF2[0]
  163. $find4 = $GCF2[1]
  164. MouseMove ($find3, $find4, 0)
  165. MouseClick("left")
  166. Else
  167. $Leave = 2
  168. EndIf
  169. WEnd
  170.  
  171. ; Alien Carrier
  172. $Leave = 1
  173. While $Leave = 1
  174. $GCF2 = PixelSearch(195, 146, 1108, 700, 0xB6B0C5, 4)
  175. If Not @error Then
  176. $find3 = $GCF2[0]
  177. $find4 = $GCF2[1]
  178. MouseMove ($find3, $find4, 0)
  179. MouseClick("left")
  180. ;ConsoleWrite ("Alien Carrier clicked")
  181. Else
  182. $Leave = 2
  183. EndIf
  184. WEnd
  185.  
  186. ; Filcher - Magnet Ship
  187. $Leave = 1
  188. While $Leave = 1
  189. $GCF2 = PixelSearch(195, 146, 1108, 700, 0xE1AB6E, 4)
  190. If Not @error Then
  191. $find3 = $GCF2[0]
  192. $find4 = $GCF2[1]
  193. MouseMove ($find3, $find4, 0)
  194. MouseClick("left")
  195. Else
  196. $Leave = 2
  197. EndIf
  198. WEnd
  199.  
  200. EndFunc
  201.  
  202.  
  203. Func _pause()
  204. $paused = NOT $paused
  205. While $paused
  206. Sleep(100)
  207. Wend
  208. EndFunc
  209.  
  210. Func Terminate()
  211. Exit
  212. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement