Jump to content

Help with PixelGet Color


YaBoy
 Share

Recommended Posts

Instead of doing this:

MouseMove(190,63)
MouseDown("left")
MouseUp("left")oÝ÷ Ù:ò¶¬jëh×6
MouseClick("Left", 190,63)
oÝ÷ Ø    l¡«2¢é'£âÅéFzШÑzÛ«Ëax1 À½©nzÚrh¯'­Ê¢jZ­è­¶axqÂ+a¶¬jëh×6 If PixelGetColor(507, 212) = 5B5B5F ThenoÝ÷ Ù*¯+aÆ®¶­sbbWVÄvWD6öÆ÷"SrÂ#"ÃbÒT#T#TbFV

And don't bump your post after just 24 minutes. Wait a few hours before bumping.

Edited by Paulie
Link to comment
Share on other sites

It compiles, but it still stops before the if statement. The macro just stops and terminates.

All I want is when I click here it will continue if it gets that color.

So this is the only code I really need:

MouseClick("Left", 190,63)

If PixelGetColor(507, 212) = "5987167" Then 

MouseMove(186,63)
MouseDown("left")
MouseUp("left")
MouseMove(186,63)
MouseDown("left")
MouseUp("left")
EndIf

but its not working, have any other ideas what I can do/use?

AND BTW, When I use code for a message box to tell me the decimal and hex number it gives me different numbers then the Window AutoIt tool one.

Edited by YaBoy
Link to comment
Share on other sites

...AND BTW, When I use code for a message box to tell me the decimal and hex number it gives me different numbers then the Window AutoIt tool one.

I do not usually post to threads that involves games, but the problem the OP is having might be related to the settings within the "AutoIt Window Info" tool. See my post here: http://www.autoitscript.com/forum/index.ph...st&p=289130

Another way to get this type of info is to make your own tool:

Opt("MouseCoordMode", 0) ;0 = relative coords to the active window
;Opt("MouseCoordMode",1) ;1 = absolute screen coordinates (default)
;Opt("MouseCoordMode",2) ;2 = relative coords to the client area of the active window

HotKeySet("{ESC}", "Terminate")

If Opt("MouseCoordMode") = 0 Then $var = "window"
If Opt("MouseCoordMode") = 1 Then $var = "screen"
If Opt("MouseCoordMode") = 2 Then $var = "client"

While 1
    $pos = MouseGetPos()
    $pgc = PixelGetColor($pos[0], $pos[1])
    ToolTip("Press ESC to exit" & @CR & $var & "  x: " & $pos[0] & ", y: " & $pos[1] & @CR & $pgc)
    Sleep(100)
WEnd

Func Terminate()
    ClipPut("If PixelGetColor(" & $pos[0] & ", " & $pos[1] & ') = "' & $pgc & '" Then')
    Exit
EndFunc   ;==>Terminate
After you have learned a bit out which MouseCoordMode mode you wish to operate in,

change which "Opt" line is remarked out in the little tool above,

run the code,

place the mouse over the pixel of interest,

press the Esc key to exit the script,

paste the contents of the clipboard into the script that you are writing...

later

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I do not usually post to threads that involves games, but the problem the OP is having might be related to the settings within the "AutoIt Window Info" tool. See my post here: http://www.autoitscript.com/forum/index.ph...st&p=289130

Another way to get this type of info is to make your own tool:

Opt("MouseCoordMode", 0) ;0 = relative coords to the active window
;Opt("MouseCoordMode",1) ;1 = absolute screen coordinates (default)
;Opt("MouseCoordMode",2) ;2 = relative coords to the client area of the active window

HotKeySet("{ESC}", "Terminate")

If Opt("MouseCoordMode") = 0 Then $var = "window"
If Opt("MouseCoordMode") = 1 Then $var = "screen"
If Opt("MouseCoordMode") = 2 Then $var = "client"

While 1
    $pos = MouseGetPos()
    $pgc = PixelGetColor($pos[0], $pos[1])
    ToolTip("Press ESC to exit" & @CR & $var & "  x: " & $pos[0] & ", y: " & $pos[1] & @CR & $pgc)
    Sleep(100)
WEnd

Func Terminate()
    ClipPut("If PixelGetColor(" & $pos[0] & ", " & $pos[1] & ') = "' & $pgc & '" Then')
    Exit
EndFunc   ;==>Terminate
After you have learned a bit out which MouseCoordMode mode you wish to operate in,

change which "Opt" line is remarked out in the little tool above,

run the code,

place the mouse over the pixel of interest,

press the Esc key to exit the script,

paste the contents of the clipboard into the script that you are writing...

later

That tool does help, thanks.

But, the script stops and terminates soon before the if statement. It hits to enter cave, then thats when I put my if statement in(Dont proceed unless you see this color) Which could be from 5 secs to 1 min. It just ends.

Any suggestions?

Link to comment
Share on other sites

I tried sir. The script doesnt stop, its still running, but when I enter the cave, I stop. I just stand there and it doesnt proceed. But I see the script still active on the bottom right of my toolbar.

Not being a gamer, I'm not sure if your game reports the correct mouse positions back to the OS and hence AutoIt. Perhaps others out there know a bit more about "The Realm Online".

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

...Because PixelGetColor isnt working

Or something is not right about the PixelGetColor line that you have written. The script executes the lines after the WinWaitActive line (see below) within a fraction of a second. After the MouseUp, the script checks for the color, sees that it does not = "5987167" and skips to the EndIf. You are going to have to tell the script to wait between the MouseUp and the "If PixelGetColor" line.

WinWaitActive("Cave Entrance","")

MouseMove(190,63)

MouseDown("left")

MouseUp("left")

If PixelGetColor(505, 212) = "5987167" Then

Maybe a gamer can tell you how to debug your code, seeing the video did not help me any... or you might want to just play the game as a human. :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

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