Page 1 of 1

Click pixelsearch help

Posted: 10 Oct 2021, 19:54
by Ragnar4293
Hello, im wondering if any you guys can help me, im looking for help on pixelsearch im wanting to set search area where it would click any colour that pops up that isnt 0x21242E & 0x4EE6EB , i cant give the colours that i want it to click as its random every time i load, thanks if you can help.

Re: Click pixelsearch help

Posted: 10 Oct 2021, 20:26
by mikeyww

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y

Re: Click pixelsearch help

Posted: 11 Oct 2021, 06:40
by Ragnar4293
mikeyww wrote:
10 Oct 2021, 20:26

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y
Thank you, i think its clicking those colours tho not sure if its because im doing the search area wrong, y := x := 776,244,885,914 , for x1,y1,x2,y2, will this script run until a colour is found once found it will stop until i start again, sorry im still trying to learn, thanks for help again.

Re: Click pixelsearch help

Posted: 11 Oct 2021, 07:21
by mikeyww
Try:

Code: Select all

x1 := 776, y1 := 244, x2 := 885, y2 := 914

F3:: ; Pressing F3 triggers the subroutine
Loop, % x2 - x1 + 1 {
 x := x1 + A_Index - 1
 Loop, % y2 - y1 + 1 {
  y := y1 + A_Index - 1
  PixelGetColor, color, x, y, RGB
  ToolTip, (%x%`,%y%) = %color%
  If color not in 0x21242E,0x4EE6EB
  { MouseClick,, x, y
    SoundBeep, 1000
    Return
  }
 }
}
Return

Re: Click pixelsearch help

Posted: 11 Oct 2021, 08:23
by Ragnar4293
mikeyww wrote:
11 Oct 2021, 07:21
Try:

Code: Select all

x1 := 776, y1 := 244, x2 := 885, y2 := 914

F3:: ; Pressing F3 triggers the subroutine
Loop, % x2 - x1 + 1 {
 x := x1 + A_Index - 1
 Loop, % y2 - y1 + 1 {
  y := y1 + A_Index - 1
  PixelGetColor, color, x, y, RGB
  ToolTip, (%x%`,%y%) = %color%
  If color not in 0x21242E,0x4EE6EB
  { MouseClick,, x, y
    SoundBeep, 1000
    Return
  }
 }
}
Return
Thank you so much this worked, sorry to be a pain, is it possible to make it scan and detect instantly in the box i create with the x and y, reason i would like to make it instant if colour on screen the colour might be gone by time the recent one you made finds it, again thank you so much for taking time to help me :)

Re: Click pixelsearch help

Posted: 11 Oct 2021, 08:32
by mikeyww
I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.

If you are searching for a specific color or a specific range of hues, you can use PixelSearch.

Re: Click pixelsearch help

Posted: 11 Oct 2021, 08:38
by Ragnar4293
mikeyww wrote:
11 Oct 2021, 08:32
I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.
Thank you again mikey for helping me alot, thanks for the info!

Re: Click pixelsearch help

Posted: 11 Oct 2021, 08:56
by Ragnar4293
mikeyww wrote:
11 Oct 2021, 08:32
I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.

If you are searching for a specific color or a specific range of hues, you can use PixelSearch.
Im just going to use the same x1 and x2 but different y1 and y2 so its in a straight line, just looking to speed up lets say when it start scanning 100-500 i would like it to be instant if possible, i will have a look at the stuff you recommended

Re: Click pixelsearch help

Posted: 11 Oct 2021, 10:07
by Ragnar4293
Having no luck here improving speed :lol:

Re: Click pixelsearch help

Posted: 19 Oct 2021, 16:52
by Ragnar4293
mikeyww wrote:
10 Oct 2021, 20:26

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y
Hello again mikey, sorry for being a best,how would i add multiple y co ords as im going to use the same x, i dont want to use the other method x1 y1 x2 y2, thanks again if you can help me and sorry for being a pest again.

Re: Click pixelsearch help

Posted: 19 Oct 2021, 20:00
by mikeyww

Code: Select all

x = 100
For each, y in [100, 200, 300] {
 PixelGetColor, color, x, y, RGB
 If color not in 0x21242E,0x4EE6EB
  MouseClick,, x, y
}

Re: Click pixelsearch help

Posted: 20 Oct 2021, 07:03
by Ragnar4293
mikeyww wrote:
19 Oct 2021, 20:00

Code: Select all

x = 100
For each, y in [100, 200, 300] {
 PixelGetColor, color, x, y, RGB
 If color not in 0x21242E,0x4EE6EB
  MouseClick,, x, y
}
Hello again, it seems to be only searching the the last input number, for example , if there is a color in 100 and 200 but not 300 it wont click 100 or 200

Re: Click pixelsearch help

Posted: 20 Oct 2021, 07:28
by mikeyww
There is no need to guess. Inside the loop, you can add lines that display the color values as well as the results of the conditional statement. That will help you to pinpoint the issue.