PixelGetColor Issues..

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Pitabuilt
Posts: 3
Joined: 26 Jan 2019, 19:52

PixelGetColor Issues..

19 Mar 2019, 22:11

I apologize in advance if this is in the wrong section.

I'm just starting to attempt to write AHK scripts for the fun of it. I have an issue with this one.

Whenever I run this script, it works for the most part, as in I don't get any message boxes mentioning any errors. But, it doesn't execute quite like what i was expecting.

It will run, get the pixel color, and execute the first "if" script that is on the line below the "if color=0xFDE7E6," but, if the key (7) is again pressed and the "PixelGetColor" is the alternate color "if color=0x191717" it will still attempt to execute the first "if" script. Once the key (7) is pressed again, it will correct itself and run the script below the "if color=0x191717."

Once the key (7) is again pressed the "if color=0xFDE7E6" is again found, it will execute the script that is below the "if color=0x191717," and yet again, once the key (7) is pressed another time (after the first fail) it will execute the proper script.

I have tried using no "mode" in the PixelGetColor and changing the sleep time before the PixelGetColor to no avail.

I don't have that great of an understanding of AHK quite yet, so, if anyone out there knows where i went wrong and how, I would greatly appreciate any and all help!

Also, is there anything you all would change about this format, the commands used, or anything about the script whatsoever? Is there any easier way to accomplish this task?

Note: I have the actual game window title name in my actual script i am executing.

"7::
if WinActive{"WindowTitleHere"}
SetDefaultMouseSpeed, 0
MouseGetPos, CurX, CurY
send {Esc}
sleep, 30
PixelGetColor, color, 874, 635, ALT
if color=0xFDE7E6
{
sleep, 10
click, 874, 635
Sleep, 10
send {F2}
}
else if color=0x191717
{
sleep, 10
click, 938, 554
Sleep, 10
send {F2}
}
Mousemove, CurX, CurY
} else {
Send {Esc}
}
return"

Thanks,

Pita

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, just me, Rohwedder and 127 guests