Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Find pixel of specific color-Move mouse cursor to that pixel-Left Click


Best Answer SnowFlake_FlowSnake , 11 June 2015 - 07:27 PM

Go to the full post »


  • Please log in to reply
12 replies to this topic
Dongoch
  • Members
  • 5 posts
  • Last active: Jul 26 2017 08:35 PM
  • Joined: 27 May 2015

Hello,

 

I searched too many forums and topics but couldnt find any working script with AHK V1.1. And I tried to manage this by myself but couldnt write a working script. So I am here for help. If someone can help me I will be really grateful.

 

game1.JPG

 

In a game there is items of same kind always droping to backpack random places. And those are colorful items, if they have 10 pixels every 1 pixel has different color.

 

I want to write a script that can find a specific color pixel on screen and move the mouse cursor to that pixel and left click it 1 time.

 

(When it left clicks a pixel of specific color, that item in the game will be dissapear.)

 

And if its possible I want auto hotkey to search for pixel color only inside backpack not whole screen.

GAME2.jpg

 

In window spy it says the pixel color I want to left click is 4242FF.

 

GAME4.jpg

GAME3.jpg

 

 

Thank you!

 



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

use this tool:
http://www.autohotke...ocation-storer/


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

Dongoch
  • Members
  • 5 posts
  • Last active: Jul 26 2017 08:35 PM
  • Joined: 27 May 2015

 

Thanks SnowFlake, this is realy useful tool but its not enough for me.

 

As I mentioned before I need a script that can find a specific color pixel on screen and move the mouse cursor to that pixel and left click it 1 time.

 

Can anyone help me with this please?



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

It works for me:

screenshot_213.png

Z::
PixelGetcolor,Pix,584,772
IfEqual,Pix,0xC9B904,{
click,584,772
}

  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

Dongoch
  • Members
  • 5 posts
  • Last active: Jul 26 2017 08:35 PM
  • Joined: 27 May 2015

 

It works for me:

Z::
PixelGetcolor,Pix,584,772
IfEqual,Pix,0xC9B904,{
click,584,772
}

 

Yes but the items which has the color drops the backpack (the area) randomly.  So the AHK needs to search inside the backpack first, like continuously scans inside of the backpack and when it finds the color, click it automaticly.
 
But your script only clicks 584,772


vallr
  • Members
  • 14 posts
  • Last active: Jul 26 2015 01:52 PM
  • Joined: 09 Jun 2015

I've recently been working on finding colours, this is what worked best for me -

F8:: {
CoordMode, Pixel, Screen
PixelSearch, colourx, coloury, 632, 646, 812, 841, 0x4242ff, 0, Fast RGB 
					
	If ErrorLevel = 1 	; If not Found	
        {
		sleep, 1000
		continue
	}
						
	else {
		If ErrorLevel = 0					
		Click, %colourx%, %coloury% Left, 1 	; Click on it.						
		sleep, 1000
	}
}

Edit -

I've already added everything you need, coordinates and colour.



Dongoch
  • Members
  • 5 posts
  • Last active: Jul 26 2017 08:35 PM
  • Joined: 27 May 2015

I've recently been working on finding colours, this is what worked best for me -

F8:: {
CoordMode, Pixel, Screen
PixelSearch, colourx, coloury, 632, 646, 812, 841, 0x4242ff, 0, Fast RGB 
					
	If ErrorLevel = 1 	; If not Found	
        {
		sleep, 1000
		continue
	}
						
	else {
		If ErrorLevel = 0					
		Click, %colourx%, %coloury% Left, 1 	; Click on it.						
		sleep, 1000
	}
}

Edit -

I've already added everything you need, coordinates and colour.

 Hello vallr,

 

Thank you for helping me. But when I use your script it says

errror.JPG



vallr
  • Members
  • 14 posts
  • Last active: Jul 26 2015 01:52 PM
  • Joined: 09 Jun 2015

Sorry i was guessing that this was to be looped so that it's always searching for the colour, just remove the continue and it should work fine



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012
✓  Best Answer

use this:

IF NOT A_IsAdmin ; Runs script as Admin.
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#MaxThreadsPerHotkey, 2
CoordMode, Pixel, Screen
#singleInstance, Force
toggle = 0


F8::  ; press F8 to toggle the loop on/off.
SoundBeep
Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.
PixelSearch, colourx, coloury, 632, 646, 812, 841, 0x4242ff, 0, Fast RGB 

IF ErrorLevel = 1 	; IF NOTFound.	
{
sleep, 1000
}

IF ErrorLevel = 0 	; IF Found.	
{
Click, %colourx%, %coloury% Left, 1 	; Click on it.						
sleep, 1000
}

} ;-- End of Loop.
return


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

Dongoch
  • Members
  • 5 posts
  • Last active: Jul 26 2017 08:35 PM
  • Joined: 27 May 2015

 

use this:

IF NOT A_IsAdmin ; Runs script as Admin.
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#MaxThreadsPerHotkey, 2
CoordMode, Pixel, Screen
#singleInstance, Force
toggle = 0


F8::  ; press F8 to toggle the loop on/off.
SoundBeep
Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.
PixelSearch, colourx, coloury, 632, 646, 812, 841, 0x4242ff, 0, Fast RGB 

IF ErrorLevel = 1 	; IF NOTFound.	
{
sleep, 1000
}

IF ErrorLevel = 0 	; IF Found.	
{
Click, %colourx%, %coloury% Left, 1 	; Click on it.						
sleep, 1000
}

} ;-- End of Loop.
return

 

 

Thank you very much vallr and SnowFlake!

 

You guys are awsome...

 

It works perfect. /cheers



Naxxa
  • Members
  • 2 posts
  • Last active: Jun 17 2015 10:37 PM
  • Joined: 14 Jun 2015

Yes... so to highjack this thread, how would I apply this to a borderless game window and essentially use it as an aimbot?

 

Can AHK recognize a certain pixel group/pattern or is it limited to colour?

 

Thought process would be to

 

- On LMB press

- Search whole screen for colour

- Move cursor to/towards colour

 

Any way to do this?

 

Game btw is Planetside 2. :D



SOTE
  • Members
  • 53 posts
  • Last active: Jul 06 2015 12:35 PM
  • Joined: 04 Jun 2015

Can AHK recognize a certain pixel group/pattern or is it limited to colour?

......

Any way to do this?

 

Game btw is Planetside 2. :D

 

Similar to Naxxa, was wondering about more than 1 color too.  I have it working fine with 1 color and something simple, but some objects have complex color patterns.

 

Can you have a group or pattern of pixels (like 3 or 4) and have AHK recognize all of them together as the location of the object?



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012
It's better if you make a new topic instead of hijacking
  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."