Jump to content
Sign in to follow this  
Guest TeraNox

Pixel Seach Question

Recommended Posts

Guest TeraNox


Im kinda newbish, ive only had the prgram for about 6 hours

well, im trying to create a script that will automatically find a hotspot in a program,

well its a game, im doing this for, and what happebns, is a chest dropps, and you have to click on it to open it, no other way i know of doing it.

and then a little bock will appear with 6 slots and some items in it, and you click on the items to grab them

What ive been trying to do is, ahve it automatically grab all this stuff, becasue its would be ausome to automatically grab an item, and not acidently miss it, becasue the box disapears before you get to click on it.

MY idea so far was, scan for a certain color, and when it found that color, scan for another color in smaller region around the pixel that was found (becasue the terrain has many of teh same colors as the chest and it continually will clikc on the teraain, and mess my movement up) and then if it finds the second pixel, right click on that pixel.

once that happens, i want to increase the pixel scaning area, and search for another color, (then search for antoher in a small area areound the first, like before) so it can pick up the item, and once it finds the pixel, left click.

and repeat

Ive been having trouble getting it to work, isd there a better way that searching for colors?, i know there is diferent pixel scans, but ive tried them ,adn so far teh color works the best for me.

------------Here is my script so far------------

$coord = Pixelsearch(120, 450, 900, 700, 0x100c00, 10, 3)

Dim $x1 = "$coord[0]" + "50"

Dim $x2 = "$coord[0]" - "50"

Dim $y1 = "$coord[1]" + "50"

Dim $y2 = "$coord[1]" - "50"

if not @error then

Dim $coord2 = pixelsearch($x1, $y1, $x2, $y2, 0x6b6163, 3, 5)


  if not @error then

  Mouseclick("right", $coord2[0], $coord2[1])


Dim $xxx1 = "$coord2[0]" + "300"

Dim $xxx2 = "$coord2[0]" - "300"

Dim $yyy1 = "$coord2[1]" + "300"

Dim $yyy2 = "$coord2[1]" - "300"

if not @error then

dim $coord3 = PixelSearch($xxx1, $yyy1, $xxx2, $yyy2, 0xffffef, 0)


Dim $xxxx1 = "$coord3[0]" + "50"

Dim $xxxx2 = "$coord3[0]" - "50"

Dim $yyyy1 = "$coord3[1]" + "50"

Dim $yyyy2 = "$coord3[1]" - "50"

  if not @error then

dim $coord4 = pixelsearch($xxxx1, $yyyy1, $xxxx2, $yyyy2, 0x000000, 0



If not @error then

mouseclick("left",$coord4[0], $coord4[1], 1, 0)


  if not @error then



I had a loop too, but that started messign up, cant figure out why, it woul say, WEnd sisnt have valid While

My whiel looked liek this

$i = 1

while $i <=15



thanks in advance.

Share this post

Link to post
Share on other sites

wut kinda game?

it might be hard to search for one color cuz in games like cs, almost every pixel has a different color. and the color of a pixel also changes.

Share this post

Link to post
Share on other sites

its called knight online, its similar to diablo 2


One thing I'm seeing is all the @error checks. DIM doesn't return an @error...so why are you checking for it, besides the pixelsearch failure?

I'd think that you'd be better off checking to see if your $coord# variable is returned as an array with IsArray()

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.