Finding a clicking colors on a 3D application
Finding a clicking colors on a 3D application
I'm new to coding and I was trying to figure out how to script a code that clicks on a certain color on the screen of a 3D application with a loop function in a certain amount of time. The color I need to click it #b21fb8 but I just can't seem to get it correctly because when I run any of my scripts my cursor looks straight at the sky.
Last edited by BoBo on 25 Jan 2021, 01:34, edited 1 time in total.
Reason: Moved to Gaming section.
Reason: Moved to Gaming section.
Re: Finding a clicking colors on a 3D application
This searches the active window, row by row, starting at the top. It will find the first match.
Code: Select all
color := 0xB81FB2 ; Blue, green, red
WinGetPos,,, width, height, A
SetTimer, Check, 300
Check:
PixelSearch, x, y, 0, 0, %width%, %height%, %color%,, Fast
If !ErrorLevel {
SoundBeep, 1500, 30
MouseClick,, x, y
} Else SoundBeep, 1000, 30
Return
F4::
SoundBeep, 1000, 30
ExitApp
Re: Finding a clicking colors on a 3D application
I tried to use your script however the problem still occurred Here is a video of what is happening. https://imgur.com/a/byQNFAcmikeyww wrote: ↑24 Jan 2021, 22:31This searches the active window, row by row, starting at the top. It will find the first match.
Code: Select all
color := 0xB81FB2 ; Blue, green, red WinGetPos,,, width, height, A SetTimer, Check, 300 Check: PixelSearch, x, y, 0, 0, %width%, %height%, %color%,, Fast If !ErrorLevel { SoundBeep, 1500, 30 MouseClick,, x, y } Else SoundBeep, 1000, 30 Return F4:: SoundBeep, 1000, 30 ExitApp
Re: Finding a clicking colors on a 3D application
You probably need to decrease the timer interval quite a bit.
To test the approach, try a static image, and see if the routine can find the right color in it. You can also add a temporary MsgBox to confirm that the color was found.
To test the approach, try a static image, and see if the routine can find the right color in it. You can also add a temporary MsgBox to confirm that the color was found.
Re: Finding a clicking colors on a 3D application
I've only been coding for a couple days so i'm not really sure on how to do all of that stuff. At the moment i'm trying to learn how to basics of cursor tracking works and having to do with fundamentals.
Re: Finding a clicking colors on a 3D application
You can run the following script.
Next, show your static image on the screen (e.g., a screenshot). Activate the window that is showing that image. Press F3. See if the color was found.
Code: Select all
color := 0xB81FB2 ; Blue, green, red
F3::
WinGetPos,,, width, height, A
PixelSearch, x, y, 0, 0, %width%, %height%, %color%,, Fast
WinGetActiveTitle, this
MsgBox, 64, Result, Window: %this%`n`nx=%x%`ny=%y%
Return