Jump to content

Inconsistent PixelSearch Results


Recommended Posts

I'm getting inconsistent results from PixelSearch (PixelCoordMode left at default value of 1) where it would randomly fail to find pixels even though it's on screen. Any idea what could I have been doing wrong? (It's for a game bot, where the game is running in a windowed mode.)

Code: (Console is a wrapper for ConsoleWrite)

$pos = PixelSearch(0, 0, 1040, 640, 0xDD0000)

If (Not @error) Then

Console("Critical: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 0, 1040, 640, 0xFF3311)

If (Not @error) Then

Console("Damage: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 0, 1040, 640, 0x00FF00)

If (Not @error) Then

Console("Green: " & $pos[0] & ", " & $pos[1])

EndIf

Console("240START")

$pos = PixelSearch(0, 240, 1040, 640, 0xDD0000)

If (Not @error) Then

Console("Critical240: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 240, 1040, 640, 0xFF3311)

If (Not @error) Then

Console("Damage240: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 240, 1040, 640, 0x00FF00)

If (Not @error) Then

Console("Green240: " & $pos[0] & ", " & $pos[1])

EndIf

Console("240END")

$pos = PixelSearch(0, 1, 1040, 640, 0xDD0000)

If (Not @error) Then

Console("Critical1: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 1, 1040, 640, 0xFF3311)

If (Not @error) Then

Console("Damage1: " & $pos[0] & ", " & $pos[1])

EndIf

$pos = PixelSearch(0, 1, 1040, 640, 0x00FF00)

If (Not @error) Then

Console("Green1: " & $pos[0] & ", " & $pos[1])

EndIf

Output:

[10:58:57] Critical: 406, 402

[10:58:57] 240START

[10:58:57] 240END

[10:58:57] Critical1: 413, 398

Link to comment
Share on other sites

I've read the rules, but what I'm asking here is whether there's any possible causes that could result in inconsistent return values from PixelSearch. I mentioned that it was used for a game bot solely to provide more context to anyone reading this thread, since this technical issue could have occurred in many other situations as well (think: screen-scraping an ancient enterprise desktop application).

Link to comment
Share on other sites

excerpt from the Rules 'Do not discuss automating games here'

I don't write the rules...but if you do a quick search on the word game....you will see how every single post ended...mostly banned users.

I am offering a peaceful suggestion, not to further this post since you already mention your automating a game.

Its up to you what you do, but anyone that mentions game, or helps someone that mentioned game here, generally finds themselves on the short end of the stick fast!

I'm not trying to be rude, or obnoxious to you, just trying to give you a heads up, before you find yourself suspended or banned from the forums.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

I understand where you're coming from, but I must once again emphasize that the technical issue I'm facing is not limited to automation of games - it's the inconsistent values PixelSearch() return that is giving me a big headache here. I'm hoping that someone who has encountered and dealt with a similar issue while using PixelSearch to offer some advice here. I have no method of telling whether the issue is caused by:

1. A faulty implementation of PixelSearch

2. My code is logically screwed (I went through the code a dozen times and see nothing wrong; need another pair of eyes to look at it)

3. PixelSearch doesn't work well on DirectX applications

One thing to add: I have tried looping through the pixels using PixelGetColor but it's really, really slow.

Edited by lxsg
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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