Is this possible?

Ask gaming related questions (AHK v1.1 and older)
CrazyCrack
Posts: 1
Joined: 21 Jan 2018, 04:43

Is this possible?

21 Jan 2018, 04:59

I need help to see if this is possible or not. Basically I wanna make something that would work like this (Everytime a a certain color appears on a part of my screen it would activate a task) So basically if this part of the screen is this color it would activate then deactivate if its not the color of choice.
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Is this possible?

21 Jan 2018, 07:32

Yes this is possible with PixelSearch
Here's some basic code that may help

Code: Select all

coordmode,pixel,screen ;coords for pixelsearch are relative to screen

if CheckColor(0,0,0x000000) { ;example usage
	msgbox The color BLACK (0x000000) was found at position 0,0
	;perform action
}
if CheckColor(50,50,0xFF0000) {
	msgbox The color RED (0xFF0000) was found at position 50,50
	;perform action
}

return


CheckColor(x,y,color,variation=10) {
	PixelSearch, foundX, foundY, x, y, x, y, color, variation, fast RGB
	if (errorlevel = 0)
		return true
	return false
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 83 guests