Making a script that clicks when any pixels move

Ask gaming related questions (AHK v1.1 and older)
nightreaper2000
Posts: 2
Joined: 07 Jun 2018, 07:15

Making a script that clicks when any pixels move

07 Jun 2018, 07:21

I want to make a script that clicks when any pixels move on the screen. I understand that AHK has its limitations but I figured id ask anyway. Im somewhat new to AHK and trying to learn something new.
This is what I have so far:

Code: Select all

g::
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
; If pixel color no longer equals %MouseX%, %MouseY%, click
return
Im just not sure how to express the last line of code properly.
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Making a script that clicks when any pixels move

07 Jun 2018, 10:41

Hallo,
perhaps:

Code: Select all

g::
	MouseGetPos, MouseX, MouseY
	PixelGetColor, ColorOld, MouseX, MouseY
	SetTimer, ColorOld, 100
return
ColorOld:
	PixelGetColor, ColorNew, MouseX, MouseY
	If (ColorNew <> ColorOld)
	{ ;If pixel color no longer equals %MouseX%, %MouseY%, click
		Click
		SetTimer, ColorOld, Off
	}
Return
brutus_skywalker
Posts: 175
Joined: 24 Dec 2016, 13:16
Location: Antarctica

Re: Making a script that clicks when any pixels move

07 Jun 2018, 10:56

Ah, my solution didn't relate to ur question.....my bad [BadPost]
Last edited by brutus_skywalker on 07 Jun 2018, 13:51, edited 1 time in total.
Outsourcing Clicks & Presses Since 2004.
nightreaper2000
Posts: 2
Joined: 07 Jun 2018, 07:15

Re: Making a script that clicks when any pixels move

07 Jun 2018, 11:20

Rohwedder wrote:Hallo,
perhaps:

Code: Select all

g::
	MouseGetPos, MouseX, MouseY
	PixelGetColor, ColorOld, MouseX, MouseY
	SetTimer, ColorOld, 100
return
ColorOld:
	PixelGetColor, ColorNew, MouseX, MouseY
	If (ColorNew <> ColorOld)
	{ ;If pixel color no longer equals %MouseX%, %MouseY%, click
		Click
		SetTimer, ColorOld, Off
	}
Return
Thank you so much... spent the last few hours tryna get that. When i use the script, it only clicks when i move my mouse after pressing g regaurdless of what is happening ingame.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 78 guests