Sinisterly
PixelGetColor() Help! - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: PixelGetColor() Help! (/Thread-PixelGetColor-Help)



PixelGetColor() Help! - Hakum - 06-07-2014

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:
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


RE: PixelGetColor() Help! - Inori - 06-07-2014

I'm not entirely sure but if Maple Story is an in-browser client, it should work fine. If it's a desktop client, IDFK. Have you tried using a 'MouseClicked' type variable (I'm pretty rusty with Auto) or would that just defeat the purpose?


RE: PixelGetColor() Help! - Hakum - 06-07-2014

(06-07-2014, 03:37 PM)Jinxed Wrote: I'm not entirely sure but if Maple Story is an in-browser client, it should work fine. If it's a desktop client, IDFK. Have you tried using a 'MouseClicked' type variable (I'm pretty rusty with Auto) or would that just defeat the purpose?

Maplestory is a desktop client, often played in full screen, but i like to play it windowed. I'm not too sure of what you mean by 'MouseClicked' variable? Sorry I'm new to Autoit please excuse my ignorence


RE: PixelGetColor() Help! - Inori - 06-07-2014

(06-07-2014, 06:34 PM)Hakum Wrote:
(06-07-2014, 03:37 PM)Jinxed Wrote: I'm not entirely sure but if Maple Story is an in-browser client, it should work fine. If it's a desktop client, IDFK. Have you tried using a 'MouseClicked' type variable (I'm pretty rusty with Auto) or would that just defeat the purpose?

Maplestory is a desktop client, often played in full screen, but i like to play it windowed. I'm not too sure of what you mean by 'MouseClicked' variable? Sorry I'm new to Autoit please excuse my ignorence

I coded JS for a bit so I only kind of understand the code.
I was thinking instead of
Code:
Func PIXELREAD() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) EndFunc
you could do something like
Code:
Func PIXELREAD() if MouseIsPressed() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) EndFunc
or
Code:
Func PIXELREAD() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) "PIXELREAD" EndFunc
Note: Not sure this one would work. The last line would (I guess) go back to the function.


RE: PixelGetColor() Help! - Hakum - 06-08-2014

(06-07-2014, 09:08 PM)Jinxed Wrote:
(06-07-2014, 06:34 PM)Hakum Wrote:
(06-07-2014, 03:37 PM)Jinxed Wrote: I'm not entirely sure but if Maple Story is an in-browser client, it should work fine. If it's a desktop client, IDFK. Have you tried using a 'MouseClicked' type variable (I'm pretty rusty with Auto) or would that just defeat the purpose?

Maplestory is a desktop client, often played in full screen, but i like to play it windowed. I'm not too sure of what you mean by 'MouseClicked' variable? Sorry I'm new to Autoit please excuse my ignorence

I coded JS for a bit so I only kind of understand the code.
I was thinking instead of
Code:
Func PIXELREAD() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) EndFunc
you could do something like
Code:
Func PIXELREAD() if MouseIsPressed() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) EndFunc
or
Code:
Func PIXELREAD() $pos = MouseGetPos() $color = PixelGetColor($pos[0], $pos[1]) ToolTip("Color: "&$color& " X: "&$pos[0]&" Y: "&$pos[1], 1740, 0) "PIXELREAD" EndFunc
Note: Not sure this one would work. The last line would (I guess) go back to the function.

That wouldn't change anything other than changing the hotkey to a click than pressing F1...