|
You last visited: Today at 14:41
Advertisement
Help me with some pixelsearch and coordonates functins
Discussion on Help me with some pixelsearch and coordonates functins within the AutoIt forum part of the Coders Den category.
12/01/2013, 15:52
|
#1
|
elite*gold: 0
Join Date: Apr 2012
Posts: 379
Received Thanks: 163
|
Help me with some pixelsearch and coordonates functins
so i have this image.
PHP Code:
$x=PixelSearch(8,164,660,480,0x000000) //to find that black line $y=PixelSearch(8,164,660,480,0x01A0E6) // to find the light-blue ball ( from the top)
But, i want to put the mouse in the back of the Dark-Blue ball , in line with the 2 balls. Something like at a game of ''8-ball pool", so it will send the Dark-Blue ball in the Light Blue Ball.
and then, there is another problem. how to get the center of the light-blue one?
If the ball is perfect round, i found how to find its center:
PHP Code:
$x=PixelSearch(8,164,660,480,0x00A2E8) $y=PixelSearch(660,480,8,164,0x00A2E8) MouseMove(($x[0]+$y[0])/2 , ($x[1]+$y[1])/2)
But i still dont get it how to make that line to the first ball and put the mouse near the ball, so they will hit.
|
|
|
12/01/2013, 21:38
|
#2
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
|
I think you want something like this? or... correct me if i am wrong
Code:
#include <WindowsConstants.au3>
#include <WinAPI.au3>
HotKeySet("{a}","Main")
Func DrawAim($start_x,$start_y,$end_x,$end_y,$color,$width,$handle)
Local $hDC, $hPen, $obj_orig
$hDC = _WinAPI_GetWindowDC(0)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
_WinAPI_DrawLine($hDC, $start_x, $start_y, $end_x, $end_y)
_WinAPI_RedrawWindow($handle, 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc
Func Main()
$coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x3F48CC) ; we get xy coordinates of the dark blue ball
if not @error then $pos=SearchBlackCenter($coord[0],$coord[1])
SearchLightCenter($pos);Search light blue ball center
EndFunc
Func SearchBlackCenter($objectx,$objecty)
Local $coord = PixelSearch($objectx,$objecty,$objectx*2,$objecty*2,0x000000) ; we get xy coordinates of blackcenter of dark blue ball
if not @error then
MouseMove(($objectx+$coord[0])/2,($objecty+$coord[1])/2) ;we set the mouse in the center
Local $pos[2] = [(($objectx+$coord[0])/2),(($objecty+$coord[1])/2)]
Return $pos
EndIf
EndFunc
Func SearchLightCenter($xy)
Local $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x00A2E8) ; Light blue ball coordinates
if not @error Then
DrawAim($xy[0],$xy[1],$coord[0],$coord[1],5,5,0);MouseMove($coord[0],$coord[1])
EndIf
EndFunc
while 1
WEnd
|
|
|
12/08/2013, 17:35
|
#3
|
elite*gold: 0
Join Date: Apr 2012
Posts: 379
Received Thanks: 163
|
yes, thx
|
|
|
|
Similar Threads
|
PixelSearch
05/19/2012 - AutoIt - 5 Replies
Hallo, Ich brauche hilfe bei einen PixelSearch AutoIt Bot.
nun meine Frage:
also ich habe bisher diesen code gebaut:
HotKeySet( "{F6}","_Exit")
While 1
$Variable = PixelSearch(187,116,1157,622,0x2A2014)
If IsArray($Variable) = True Then
MouseMove($Variable , $Variable , 1)
MouseClick($Variable)
|
Pixelsearch Bot
07/08/2011 - AutoIt - 6 Replies
Hallo,
ich wollte fragen ob es möglich ist z.B. für Crossfire einen Pixelsearch Bot zu machen
und
Wie macht man mit Autoit so einen Youtube Account Creator
und
wie umgeht man die Captchaabfrage?
|
Pixelsearch
06/26/2010 - General Coding - 5 Replies
Hallo, ich habe ein Problem, ich habe versucht ein kleines Programm mit Pixelsearch zu erstellen, da ich daran kläglich gescheitert bin wollt ich mal fragen ob das jemand von euch für mich übernehmen kann? Ich möchte das das Program gedrückt hält und dann einen Pixel in der Farbe sucht (sind mehrere vorhanden und es ist egal welchen er anklickt), ihn anklickt und dann ein paar sekunden wartet dann Leertaste für kurze Zeit gedrückt hält. Das soll sich dann nach einiger Zeit wiederholen. Die...
|
All times are GMT +2. The time now is 14:41.
|
|