2n2u

Untitled

Apr 12th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.90 KB | None | 0 0
  1. #include <BlockInputEx.au3>
  2.  
  3.  
  4. HotKeySet("f", "ExitProg") ;;Sets F as a hotkey to exit the progam
  5. HotKeySet("s", "StartProg") ;;Sets S as a hotkey to start the program
  6. HotKeySet("d", "TogglePause");;Sets D as a hotkey to start the program
  7.  
  8. Global $Paused
  9. const $ballcolor = 0xFFEB00
  10. const $playercolor = 0x186DFF
  11. Const $distball = 50
  12. Const $ScreenWidth = 1680
  13. Const $ScreenHeight = 1050
  14.  
  15. Dim $ball = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $ballcolor);
  16. Dim $player = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $playercolor)
  17. $distance = 0
  18. ;Const $pixeltolerance = 0
  19.  
  20. While 1    ;;;Waits for function call
  21. Wend
  22.  
  23. Func StartProg()  
  24. while 1
  25.    
  26.         Dim $ball = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $ballcolor)
  27.         Dim $player = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $playercolor)
  28.         calcdist()
  29.        
  30.     If IsArray($player) And IsArray($ball) Then
  31.     $distance = sqrt(abs(($ball[0] - $player[0])) ^2 + abs(($ball[1] - $player[0]) ^2))
  32.    
  33.     If NOT @error Then
  34.     Mousemove( $ball[0], $ball[1], 0)
  35.    
  36.     While ($distance < $distball)
  37.         $xball=$ball[0]
  38.         $yball=$ball[1]    
  39.         calcdist()
  40.         refresh()
  41.         If IsArray($player) And IsArray($ball) Then
  42.     MouseClick("left",$ball[0],$ball[1], 1, 0)
  43.     refresh()
  44.     Else
  45.     $distance = $distance + 100
  46.     EndIf
  47.     WEnd         
  48.     EndIf
  49.    
  50. EndIf
  51. WEnd
  52. EndFunc
  53.  
  54. Func TogglePause()
  55.     $Paused = NOT $Paused
  56.     While $Paused              
  57.     WEnd    
  58. EndFunc
  59.  
  60. Func ExitProg()
  61.     Exit 0  ;;;Exits the program
  62. EndFunc
  63.  
  64. Func Refresh()
  65.     If IsArray($player) And IsArray($ball) Then
  66.     Dim $ball = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $ballcolor)
  67.     Dim $player = PixelSearch( 0, 0, $ScreenWidth, $ScreenHeight, $playercolor)
  68.     EndIf
  69. EndFunc
  70.  
  71. Func calcdist()
  72.     refresh()
  73.     If IsArray($player) And IsArray($ball) Then
  74.     $distance = sqrt((abs(($ball[0] - $player[0])) ^2) + abs((($ball[1] - $player[1])) ^2))
  75.     EndIf
  76.     return $distance
  77.     EndFunc
Advertisement
Add Comment
Please, Sign In to add comment