Originally Posted by
Hmmmk
Why would I need to steal code to create something that scans for pixels then clicks..
Code:
if _IsPressed($body) = 1 Then
$pos = MouseGetPos()
$coord = PixelSearch(($pos[0] - $radius) , ($pos[1] - $radius) , ($pos[0] + $radius) , ($pos[1] + $radius), $searchcolora, 80)
If IsArray($coord) = 1 Then
MouseClick('left')
EndIf
EndIf
LMAO swear to god u have your color variation set to 80? and you only expect it to click only on yellow? that'll mess you up right there. You dont want it to be any higher than 10, but 10 is still probably too much variation.
and also you need to give more details to the MouseClick command.. i dont know why but without defining where to click the mouse, the MouseClick command will move the mouse before clicking so change MouseClick to look like this:
MouseClick("primary", MouseGetPos(0), MouseGetPos(1))
and yes the correct way with MouseGetPos is with () and not []. which would also be better to do instead of declaring the variable $pos
The Proper Way To Set Up Your Code:
Code:
If _IsPressed($body) = 1 Then
While 1
$coord = PixelSearch(MouseGetPos(0) - $radius, MouseGetPos(1) - $radius, MouseGetPos(0) + $radius, $MouseGetPos(1) + $radius, $searchcolora, 10)
If _IsArray($coord) = 1 Then
MouseClick("primary", MouseGetPos(0), MouseGetPos(1))
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay, 0)
EndIf
WEnd
EndIF
see doing a loop like that would set it to start when $body is pressed, that way you can add an exitloop call when $body is pressed again.. like this:
Code:
If _IsPressed($body) = 1 Then
While 1
If _IsPressed($body) = 1 Then ExitLoop
$coord = PixelSearch(MouseGetPos(0) - $radius, MouseGetPos(1) - $radius, MouseGetPos(0) + $radius, $MouseGetPos(1) + $radius, $searchcolora, 10)
If _IsArray($coord) = 1 Then
MouseClick("primary", MouseGetPos(0), MouseGetPos(1))
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay, 0)
EndIf
WEnd
EndIF
But then you gotta remember that there needs to be an adjustable sleep time for each person, since every computer is different.. so do
While 1
Sleep(100).