Author Topic: [Autoit] Need help with pixel finding  (Read 1169 times)

0 Members and 2 Guests are viewing this topic.

Offline wjdwndud

  • NULL
  • Posts: 3
  • Cookies: -2
    • View Profile
[Autoit] Need help with pixel finding
« on: June 07, 2014, 08:29:54 am »
I'm to make a bot for Extaliams (Maplestory Private Server) I'm trying to use PixelGetColor to get the color and coordinate of a pixel using this program i wrote

Code: [Select]
  MsgBox(0, "Pixel Search", "F1 Pixel Read; F2 Exit", 1)

HotKeySet("{F1}", "PIXELREAD")
HotKeySet("{F2}", "QUIT")

WinActivate("ExtaliaMS")
WinWaitActive("ExtaliaMS")
Opt("WinWaitDelay",100)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",2)
WinMove("ExtaliaMS", "", 0, 0)
Opt("PixelCoordMode",2)

dim $pos[2]
dim $color
Global $searchfor

While 1
   Sleep(100)
WEnd

Func PIXELREAD()
   $pos = MouseGetPos()
   $color = PixelGetColor($pos[0], $pos[1])
   ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0)
EndFunc

Func QUIT()
   Exit 0
EndFunc
It work on every other window except for the game window. I'm wondering if the game has some kind of defense against getting pixel colors. The results i get are what is BEHIND the game window such as my background color. Anyone can help me get around this problem?

Offline craterlord

  • /dev/null
  • *
  • Posts: 7
  • Cookies: 5
    • View Profile
Re: [Autoit] Need help with pixel finding
« Reply #1 on: June 07, 2014, 03:21:44 pm »
http://www.autoitscript.com/autoit3/docs/functions/PixelGetColor.htm

The next time you have a problem, you should really consider reading the documentation.

Offline Architect

  • Sir
  • ***
  • Posts: 428
  • Cookies: 56
  • STFU
    • View Profile
    • Rootd IRC
Re: [Autoit] Need help with pixel finding
« Reply #2 on: June 07, 2014, 04:57:39 pm »
This isn't a tech support hotline, it's a forum. I'm sick of getting calls from people that need to know how to open their email; it disrupts calls I could be taking from people with real problems. Next time try a search engine, I'm sure the above example would be one of the first things to come up in the results.

tl;dr RTFM



Offline wjdwndud

  • NULL
  • Posts: 3
  • Cookies: -2
    • View Profile
Re: [Autoit] Need help with pixel finding
« Reply #3 on: June 07, 2014, 07:26:48 pm »
I don't know what in the world you two are talking about? I know how PixelGetColor works and its function. Thats why I wrote the program for it. This isn't as simple as opening my email. If it's an easy fix why don't you give me the solution then telling me to "google" it. Don't you think I've searched all over the internet for my solution before coming to this unwelcoming forum?

Let me restate this.
The problem is that ALL pixelgetcolor functions evade the game window and finds the color of the background BEHIND the game window. It is as if the game window is invisible. Its NOT "how do I use PixelGetColor function"

Offline Zesh

  • Royal Highness
  • ****
  • Posts: 699
  • Cookies: 42
    • View Profile
Re: [Autoit] Need help with pixel finding
« Reply #4 on: June 07, 2014, 08:50:26 pm »
I don't know what in the world you two are talking about? I know how PixelGetColor works and its function. Thats why I wrote the program for it. This isn't as simple as opening my email. If it's an easy fix why don't you give me the solution then telling me to "google" it. Don't you think I've searched all over the internet for my solution before coming to this unwelcoming forum?

Let me restate this.
The problem is that ALL pixelgetcolor functions evade the game window and finds the color of the background BEHIND the game window. It is as if the game window is invisible. Its NOT "how do I use PixelGetColor function"

It is an easy fix. You say you know the function but do you know PixelGetColor takes 3 parameters with the third one being optional. This third parameter is the window handle and its default value is the handle for the desktop. In your code you have not supplied this parameter.

Simple.

Offline wjdwndud

  • NULL
  • Posts: 3
  • Cookies: -2
    • View Profile
Re: [Autoit] Need help with pixel finding
« Reply #5 on: June 08, 2014, 02:10:02 am »
I have also tried adding the third option, with no success. I have set the handle to the game window and the program reacts the same way without setting the handle. So no, it is not that simple.

Offline Zesh

  • Royal Highness
  • ****
  • Posts: 699
  • Cookies: 42
    • View Profile
Re: [Autoit] Need help with pixel finding
« Reply #6 on: June 08, 2014, 08:10:53 pm »
I have also tried adding the third option, with no success. I have set the handle to the game window and the program reacts the same way without setting the handle. So no, it is not that simple.

Doing a simple search shows that Maplestory uses DirectX and if you google "pixelgetcolor directx" you'll find many similar questions.