Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; bot for Save The Earth
- ; http://madscripter.wordpress.com
- ;
- ; This is an AutoIT3 script
- ; Get AutoIT at http://www.autoitscript.com/autoit3/index.shtml
- ;
- ; v0.1 - clicks on aliens, alien carriers, motherships, supply boxes, Filcher (magnet ship)
- ; doesn't click on fast alien ship
- ; This bot is highly dependent on finding colors - it may not work on all machines - please send me feedback if it doesn't work
- ;
- ; v0.2
- ; finds starting coordinates
- ; auto-switch between aliens
- ;
- ; todo:
- ; use research tab for better color matching?
- Global $paused
- Global $MouseX
- Global $GCF1
- Global $GCF2
- Global $find1
- Global $find2
- Global $find3
- Global $find4
- Global $currentcolor
- Global $errorcount
- HotKeySet("{ESC}", "Terminate")
- HotKeySet("{PAUSE}","_pause")
- Opt("MouseCoordMode", 1)
- Opt("WinTitleMatchMode", 2)
- ;IE7/8
- WinActivate("[CLASS:IEFrame]", "")
- ;Firefox3
- WinActivate("[CLASS:MozillaUIWindowClass]", "")
- ;Firefox4
- WinActivate("[CLASS:MozillaWindowClass]", "")
- ;Opera
- WinActivate("[CLASS:aPluginWinClass]", "")
- ;Opera
- WinActivate("[CLASS:OperaWindowClass]", "")
- ;Chrome
- WinActivate("[CLASS:Chrome_WidgetWin_0]", "")
- WinActivate("[CLASS:Chrome_WidgetWin_1]", "")
- WinActivate("Save the Earth")
- ;Sleep(100)
- ; find starting coordinates
- ; find black line that is at least 1300 pixels long
- $GCF1 = PixelSearch(1, 1, 1000, 1000, 0x000000, 0)
- for $searchy = 1 to 500
- for $searchx = 1 to 1500
- $findcolor = (PixelGetColor($searchx, $searchy))
- $fail = 0
- If $findcolor = 0 Then
- for $x = 1 to 1300
- $findcolor = PixelGetColor($searchx + $x, $searchy)
- If $findcolor <> 0 Then
- $x=1300
- $fail = 1
- EndIf
- Next
- If $fail = 0 Then
- $foundx = $searchx
- $foundy = $searchy
- $searchx = 1500
- $searchy = 500
- EndIf
- EndIf
- Next
- Next
- ConsoleWrite ($foundx & " " & $foundy & @CRLF)
- $currentcolor = 0x8B7895
- $errorcount = 1
- While 1
- For $X = 1 to 100
- $GCF2 = PixelSearch($foundx+833, $foundy+611, $foundx+20, $foundy+57, $currentcolor, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- Else
- $errorcount = $errorcount + 1
- EndIf
- Next
- OtherShips()
- For $X = 1 to 200
- $GCF2 = PixelSearch($foundx+20, $foundy+57, $foundx+933, $foundy+611, $currentcolor, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- Else
- $errorcount = $errorcount + 1
- EndIf
- Next
- OtherShips()
- If $errorcount > 100 Then
- If $currentcolor = 0x8B7895 Then
- $currentcolor = 0x7B7E94
- ElseIf $currentcolor = 0x7B7E94 Then
- $currentcolor = 0x08B7895
- EndIf
- $errorcount = 1
- EndIf
- WEnd
- Func OtherShips()
- ; Supply Green
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0x569036, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- ;ConsoleWrite ("green supply clicked")
- EndIf
- ; Supply Yellow
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0xDB9B11, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- ;ConsoleWrite ("yellow supply clicked")
- EndIf
- ; Supply - Blue
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0x366B90, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- ;ConsoleWrite ("blue supply clicked")
- EndIf
- ; Mothership
- $Leave = 1
- While $Leave = 1
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0x7BB35D, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- Else
- $Leave = 2
- EndIf
- WEnd
- ; Alien Carrier
- $Leave = 1
- While $Leave = 1
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0xB6B0C5, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- ;ConsoleWrite ("Alien Carrier clicked")
- Else
- $Leave = 2
- EndIf
- WEnd
- ; Filcher - Magnet Ship
- $Leave = 1
- While $Leave = 1
- $GCF2 = PixelSearch(195, 146, 1108, 700, 0xE1AB6E, 4)
- If Not @error Then
- $find3 = $GCF2[0]
- $find4 = $GCF2[1]
- MouseMove ($find3, $find4, 0)
- MouseClick("left")
- Else
- $Leave = 2
- EndIf
- WEnd
- EndFunc
- Func _pause()
- $paused = NOT $paused
- While $paused
- Sleep(100)
- Wend
- EndFunc
- Func Terminate()
- Exit
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement