AutoIt - AIMBOT for Health Bars

02/02/2012 02:46 darksoltan#1
Hey guys... newbie here trying to make a simple little bot, but stuck in one important aspect. Clicking BELOW the moving Health Bar.

What I want to do is... once the mouse is in the area of a moving health bar, autoit pixelsearches a fixed parameters of say 50height x 150length relative to the position of the mouse, for the health bar, once it finds it, the mouse follows the moving bar indefinitely or until the bar disappears, while at the same time, and this is the hard part, clicking in a box right below the moving blue bar. Where the mouse is, is irrelevant, as long as its able to click the box below the bar.

This one has me stomped. Any pros can solve this?

Health Bar Example: [Only registered and activated users can see links. Click Here To Register...]

Code:
HotKeySet('{ESC}','_exit')
sleep(2000)

While 1
Global $mouse = MouseGetPos()

            $Coord = PixelSearch( $mouse[0]-150, $mouse[1]-45, $mouse[0]+150, $mouse[1]+45, 0x3F48CC, 5, 5) ; Search a blue bar near mouse position
                While @error = 0
                MouseClick("left",$coord[0]+45,$coord[1]+40)
                MouseMove($coord[0], $coord[1], 1)
                $Coord = PixelSearch( $mouse[0]-40, $mouse[1]-40, $mouse[0]+40, $mouse[1]+40, 0x3F48CC, 5, 5)
                WEnd

sleep(100)
WEnd

Func _exit()
    Exit
EndFunc
02/02/2012 22:06 TimeTooChill#2
you can run more then one function without stopping the script with [Only registered and activated users can see links. Click Here To Register...] and to close the funktion: [Only registered and activated users can see links. Click Here To Register...]
03/22/2012 21:51 Taruxas#3
I'm not sure If this does what you want it to do, or if it will work for what you're trying to make, but it works in the example gif you've provided.

Code:
HotKeySet('{ESC}','_exit')


While 1
	Global $mouse = MouseGetPos()

	$Coord = PixelSearch( $mouse[0]-300, $mouse[1]-60, $mouse[0]+300, $mouse[1]+60, 0x3F48CC, 5, 5)
		If not @error then
			MouseMove($coord[0]+45, $coord[1]+50, 0)
			MouseClick("LEFT")
		EndIf
WEnd


Func _exit()
	Exit
EndFunc