Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_iPixelSearch()


  • Please log in to reply
9 replies to this topic

#1 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 02 May 2005 - 05:05 PM

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

Attached Files


Edited by w0uter, 31 May 2006 - 02:34 PM.

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







#2 BillLuvsU

BillLuvsU

    Useless Member

  • Active Members
  • PipPipPipPipPipPip
  • 1,561 posts

Posted 02 May 2005 - 08:51 PM

Oh thank you alot! This is perfect for my collision detection.

Posted Image

Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

#3 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 03 May 2005 - 03:49 AM

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.

#4 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 03 May 2005 - 05:49 PM

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

#5 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 04 May 2005 - 12:02 AM

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.

#6 Hooch

Hooch

    Polymath

  • Active Members
  • PipPipPipPip
  • 233 posts

Posted 04 May 2005 - 06:13 PM

I'm overly dense today, I'm not getting the purpose of this baby...

#7 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 04 May 2005 - 08:43 PM

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.

#8 Hooch

Hooch

    Polymath

  • Active Members
  • PipPipPipPip
  • 233 posts

Posted 09 May 2005 - 05:14 PM

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.

#9 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 09 May 2005 - 08:04 PM

Some games make it tough to nail down a pixel color that is always the same.

<{POST_SNAPBACK}>

what do you think the shade parameter is for ;P
My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#10 MuffettsMan

MuffettsMan

    Adventurer

  • Active Members
  • PipPip
  • 133 posts

Posted 25 May 2005 - 09:58 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users