Jump to content

_iPixelSearch()


w0uter
 Share

Recommended Posts

i almost know for sure that there is something like this.

but i needed this. and i thought id share it.

syntax is the same as PixelSearch

return[0] = the found pixel color

return[1] = x coord

return[2] = y coord

Func _iPixelSearch($i_left, $i_top, $i_right, $i_bottom, $i_color, $i_shade = 0, $i_step = 1)
    Local $av_ret[3]
    Local $ai_coords = PixelSearch($i_left, $i_top, $i_right, $i_bottom, $i_color, $i_shade, $i_step)
    If @error Then
        Return 0
    EndIf
    $av_ret[0] = PixelGetColor($ai_coords[0], $ai_coords[1])
    $av_ret[1] = $ai_coords[0]
    $av_ret[2] = $ai_coords[1]
    Return $av_ret
EndFunc;==>_iPixelSearch

_iPixelSearch.au3

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

I don't understand the use of this function?

Do you have an example?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

useless example :(

$v_color = 0xFF0000

$ai_ex = _iPixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $v_color, 100)
$s_ex = 'The difference between the searched color(' & $v_color & ') and the found color(' & $ai_ex[0] & ') is ' & ($v_color - $ai_ex[0])
MsgBox(0, '', $s_ex)

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Ah I see :(

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

If you search for a color WITH variation, then it returns the color found. This could be used to find a nice average to base your color variation on. I.E. Find the highest variation found, and lowest variation found. Then use that range to make it as efficient as possible.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Ahhh.. gotcha, ok cool. I could see myself making use of that. Although frowned upon I do alot with whatever game I'm currently playing. Some games make it tough to nail down a pixel color that is always the same.

Combine this with a local calibration and allow for +- range on the find and you should be pretty solid.

Link to comment
Share on other sites

  • 3 weeks later...

what do you think the shade parameter is for ;P

<{POST_SNAPBACK}>

have you guys thought of setting the pixel color each time the script is run? - IE: i am currently writing a script that will wait till i give it the mousecoord for the range to search in then the current colors to search for before running the actual loop... thus the shade variance can be much stricter thus hopefully more accurate... then as the colors begin to fail the search just kick off the script again... else more ideal (though beyond my noob abilities) keep an array of the color found to what was origionally matched... thus if the average return is consistantly darker... reset the orig search color accordingly ((figured this would help in cases of slight variation over time, specifically in a game when the pixel color changes from day to night - but don't know how badly that would affect performance.

Anyway don't have anything good enough for yall to at least laugh at, though will post asap... :(

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...