Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 17:21

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



I need help with pixel search and mouse click.

Discussion on I need help with pixel search and mouse click. within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2007
Posts: 27
Received Thanks: 4
I need help with pixel search and mouse click.

Code:
#region HotKeySet
HotKeySet("{F4}","PIXELREAD")
HotKeySet("{F2}","PIXELFIND")
HotKeySet("{f3}","ExitProg")
#ENDREGION

#region variables
dim $pos[2]
dim $color
Global $counter=0
Global $searchfor = 12059395
Global $on=0
#ENDREGION

Func ExitProg()
   Exit
EndFunc
   
#region Functions
Func PIXELREAD()
   $pos = MouseGetPos()
   $color = PixelGetColor($pos[0],$pos[1])
   MsgBox(0,"Color",$color&@CRLF&$pos[0]&","&$pos[1])
EndFunc

Func PIXELFIND()
   $on=1
   While $on=1
	  $pos = PixelSearch(133,231,1155,936,$searchfor)
	  if not @error Then
		 MouseMove($pos[0],$pos[1],0)
		 Sleep(500)
		 MouseClick("left")
	  EndIf
	  If @error Then
		 $counter=$counter+1
	  EndIf
	  if $counter>5 Then
		 $on=0
	  EndIf
   WEnd
   MouseUp("left")
   MsgBox(0,"It's Colored","We colored it.")
EndFunc

#ENDREGION

While 1
   Sleep(100)
WEnd
when i press F2 it search for pixel color and left click on it. Works fine.

I want to search pixels in a small area in the center of the screen (200 x 200 px)
If no pixel find then make area larger and larger until pixel is find and left click on it,
then sleep 4 sec and make area small again instant (200 x 200 px)

thank you

how to make to search from center of the screen?
alex05ok is offline  
Old 06/07/2013, 16:01   #2
 
Croco™'s Avatar
 
elite*gold: 235
Join Date: Jan 2012
Posts: 920
Received Thanks: 377
Code:
$Area = 200								
$X		=	@DesktopWidth/2-$Area/2	
$Y		=	@DesktopHeight/2-$Area/2
$ToX	        =	@DesktopWidth/2+$Area/2
$ToY	        =	@DesktopHeight/2+$Area/2
With this code you get the 4 cords you need for PixelSearch.
Now you can increase or decrease $Area each loop.
Croco™ is offline  
Old 06/07/2013, 16:25   #3
 
elite*gold: 0
Join Date: Aug 2007
Posts: 27
Received Thanks: 4
Quote:
Originally Posted by Croco™ View Post
Code:
$Area = 200								
$X		=	@DesktopWidth/2-$Area/2	
$Y		=	@DesktopHeight/2-$Area/2
$ToX	        =	@DesktopWidth/2+$Area/2
$ToY	        =	@DesktopHeight/2+$Area/2
With this code you get the 4 cords you need for PixelSearch.
Now you can increase or decrease $Area each loop.
pls tell me were do i put this in my code.
alex05ok is offline  
Old 06/07/2013, 16:54   #4
 
omer36's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 2,317
Received Thanks: 1,254
Quote:
Originally Posted by alex05ok View Post
pls tell me were do i put this in my code.
...-.-

PHP Code:

Func PIXELFIND
()
    
$on 1
    $Area 
200

    
While $on 1
        $X 
= @DesktopWidth $Area 2
        $Y 
= @DesktopHeight $Area 2
        $ToX 
= @DesktopWidth $Area 2
        $ToY 
= @DesktopHeight $Area 2

        $pos 
PixelSearch($X$Y$ToX$ToY$searchfor)
        If 
Not @error Then
            MouseMove
($pos[0], $pos[1], 0)
            
Sleep(500)
            
MouseClick("left")
            
Sleep(4000)
            
$Area 200
        
EndIf
        If @
error Then
            $counter 
$counter 1
            $Area 
= +200
        
EndIf
        If 
$counter 5 Then
            $on 
0
        
EndIf
    
WEnd
    MouseUp
("left")
    
MsgBox(0"It's Colored""We colored it.")
EndFunc 
omer36 is offline  
Thanks
1 User
Old 06/07/2013, 17:26   #5
 
elite*gold: 0
Join Date: Aug 2007
Posts: 27
Received Thanks: 4
$Area = +200
should be
$Area += 200 ?
alex05ok is offline  
Old 06/07/2013, 17:31   #6
 
elite*gold: 0
Join Date: Jan 2010
Posts: 507
Received Thanks: 203
if its not work then
$Area = $Area + 200
Shishidump is offline  
Reply


Similar Threads Similar Threads
Mouse Click Move
01/26/2012 - Metin2 - 0 Replies
Hello I Have a Question for all the people who have experience in Metin2 Hacking, what function gets called when Mouse Walking I been moving my bot using the fuction that gets called be pressing the keys for movement and teleporting in small steps, the way that I am doing this gives me alot of problems I think the correct way would be calling the fuction that gets executed when left mouse click, I havent had any luck could anyone point me into the correct direction on solving this. I hope some...
AutoIt Pixel Search & Click Frage.
11/23/2010 - AutoIt - 12 Replies
Hey e*pvpers. Bin grade angefangen, mich bisschen in AutoIt reinzuarbeiten. Wollte dazu nen kleinen, recht simplen Bot erstellen, der eine bestimmte Pixelfarbe sucht - Wenn er das gefunden hat, sollte er eig draufklicken. Bin allerdings nur so weit gekommen, dass der Pixel gefunden wird, und ein Klick auch gemacht wird. Allerdings klickt die Maus da wo der Cursor grade steht, und movt nicht zu dem jeweiligen Pixel. Und da ich wie gesagt grad erst anfange, weiss ich den Befehl...
Pixel Search Click
04/11/2010 - AutoIt - 4 Replies
Hi, I am trying to open up Internet Explorer using Pixel Search, But i keep getting Error. Here is my script : It finds the color then double clicks on it,but it cannot find the color,i hope some one can help me, +k for any one who can
[TUT] Teleport Using Mouse Click
12/15/2009 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 5 Replies
Note: Tested on Dekaron Sea 1st. Must Have CE 5.4 or 5.5 2nd. target Dekaron.exe 3rd. Click add address manually paste this 5E2C78 as Byte 4th. default value is 139 change it to 0 then freeze now you can use your mouse as a teleport tools. Screen Shot: step 1
Mouse to Pixel Frage!
01/19/2009 - GW Bots - 5 Replies
Also meine frage ist ob es eine möglichkeit gibt, das wenn ich if pixelsearch(...) then mache und er den pixel findet das er einen mouseclick zu dem pixel macht? also bsp if pixelsearch(...) then mouseclicktopixel



All times are GMT +2. The time now is 17:21.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.