Jump to content

PixelSearch, PixelGetColor, PixelChecksum


Recommended Posts

I am working on a bot for a game and I have some strange experience with PixelSearch and PixelGetColor.

for example:

PixelGetColor(743, 107) = 12000000

but PixelSearch(711, 97, 871, 116, 12000000, 50) = 1 and not (743, 107) Is PixelGetColor a bit bugged?

If I check after that PixelGetColor(743, 107) I get 12000000 again but for some reason PixelSearch doesnt find it.

Any ideas how to fix it? Why it isnt working (not finding it)?

I am also trying to find a way to know where I am in the map (minimap) http://img301.imageshack.us/img301/621/minimapyk0.jpg

My idea was to PixelChecksum an area on the minimap like PixelChecksum(960, 117, 970, 127) (=54000000 for example)

and search for 54000000 after that, works fine (I can find this area again). But if I move with my char some steps (left or right, so the area change a bit the x-y coordinates) I am not able to find my area anymore. Is PixelChecksum not working perfect? Or is it just me?

My code for it

CODE
#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <array.au3>

Sleep(10000)

Global $anfang = PixelChecksum(960, 117, 970, 127) ; area that I want to check

Global $anfangClone = 0 ; area clone to copare with $anfang

Global $minix1 = 836 ; minimap top x

Global $miniy1 = 23 ; minimap top y

Global $minix2 = 1017 ; minimap bottom x

Global $miniy2 = 204 ; minimap bottom y

Global $mini2x1 = 0 ; new coordinates from $anfang (top x)

Global $mini2y1 = 0 ; new coordinates from $anfang (top y)

Global $mini2x2 = 0 ; new coordinates from $anfang (bottom x)

Global $mini2y2 = 0 ; new coordinates from $anfang (bottom y)

sleep(10000)

$h = 0

while $h <= 10 ; check it 10 times to be sure

while $minix1 <= 1017 And $anfang <> $anfangClone

; searching new coordinadinates from my area till found it or untill whole minimap searched

while $miniy1 <= 204 And $anfang <> $anfangClone

; searching new coordinadinates from my area till found it or untill whole minimap searched

$anfangClone = PixelChecksum($minix1, $miniy1, $minix1 + 10, $miniy1 + 10)

;970-960 = 10 127-117 = 10 ($anfang)

if $anfang = $anfangClone Then

$mini2x1 = $minix1

$mini2y1 = $miniy1

$mini2x2 = $minix1 + 10

$mini2y2 = $miniy1 + 10

EndIf

$miniy1 = $miniy1 +1

WEnd

$miniy1 = 23

$minix1 = $minix1 +1

WEnd

sleep(200)

$h = $h +1

WEnd

sleep(1000)

; show the values in the end

MsgBox(0,"The decmial color is", $mini2x1 )

MsgBox(0,"The decmial color is", $mini2y1 )

MsgBox(0,"The decmial color is", $mini2x2 )

MsgBox(0,"The decmial color is", $mini2y2 )

MsgBox(0,"The decmial color is", $minix1 )

MsgBox(0,"The decmial color is", $miniy1 )

MsgBox(0,"The decmial color is", $anfang)

MsgBox(0,"The decmial color is", $anfangClone)

Working since a week on it, but no solution :/

I uploaded the above code "BackTospot.au3", it looks better than in forum :D

BackToSpot.au3

Edited by hendrikhe
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...