PixelSearch is behaving unexpectedly Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 17:17

Code: Select all

e::
    PixelSearch,,, 1075, 495, 1076, 496, 0x9d6346, Fast RGB
        If ErrorLevel {
            Send, {e}
        } Else {
            Send, {f}
        }
Return
If I press "e" in BioShock Infinite, it can bring up a little loot menu if I have a lootable object highlighted.

If the loot menu is not visible, I want to send "e" (Use). If it is visible, I want to send "Enter" (Take All Loot).

Everything else is working okay, except when the loot menu is visible, pressing "e" sends "x" (Switch Weapon) instead!

Anybody ever seen something like this happen?

User avatar
mikeyww
Posts: 27303
Joined: 09 Sep 2014, 18:38

Re: PixelSearch is behaving unexpectedly

Post by mikeyww » 22 Jun 2023, 17:21

You may want to use the dollar prefix.

User avatar
boiler
Posts: 17328
Joined: 21 Dec 2014, 02:44

Re: PixelSearch is behaving unexpectedly

Post by boiler » 22 Jun 2023, 17:24

Moved to the v1 section. @astute65_aardvark20, please note that the main section of the forum is now for AHK v2 and there is now a separate section for v1.

astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

Re: PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 18:01

mikeyww wrote:
22 Jun 2023, 17:21
You may want to use the dollar prefix.

Code: Select all

$e::
    PixelSearch,,, 1075, 495, 1076, 496, 0x9d6346, Fast RGB
        If ErrorLevel {
            Send, {e}
        } Else {
            Send, {f}
        }
Return
I haven't used dollar sign in so long I forgot how it works, but I assume it is supposed to look like the above code?

boiler wrote:
22 Jun 2023, 17:24
Moved to the v1 section. @astute65_aardvark20, please note that the main section of the forum is now for AHK v2 and there is now a separate section for v1.
Sorry!

User avatar
mikeyww
Posts: 27303
Joined: 09 Sep 2014, 18:38

Re: PixelSearch is behaving unexpectedly

Post by mikeyww » 22 Jun 2023, 18:03

Worth a shot. You can always try it, right? Do a test.

Code: Select all

#Requires AutoHotkey v1.1.33

$e::
If True
     Send e
Else Send f
Return

astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

Re: PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 18:13

Unfortunately it is still sending "x". I really don't know how it is doing this since there are no functions with that key in the script.

astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

Re: PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 18:17

What's really strange is that I can put any random hex code in the ColorID and the game will still detect "x" being pressed when the loot menu is open...

astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

Re: PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 18:37

Okay this is a weird one. I will have to add additional info.

I am using a macro mouse (Corsair Scimitar) and in the software (iCUE) I have set Side Button 6 to mimic the keyboard key "e". It should, for all intents and purposes, act exactly like the keyboard key.

Using the modified code, if the loot menu is not open, Side Button 6 sends "e", as intended. If the loot menu is open, the Side Button 6 triggers weapon switching by sending "x".

However, when the loot menu is open and I press the "e" key on my keyboard, "Enter" is sent and I gather the loot, as intended.

So I guess that AHK is interpreting Side Button 6 as something else when the ColorID is detected...

astute65_aardvark20
Posts: 43
Joined: 23 Dec 2022, 18:59

Re: PixelSearch is behaving unexpectedly

Post by astute65_aardvark20 » 22 Jun 2023, 18:50

Okay, this is not AHK that is doing this.

I got rid of the AHK code, and went into iCUE and set Side Button 6 (SB6) to send "Enter", wait 100ms, and then send "e".

So the first time I highlight a lootable object, I press SB6, it sends "Enter", which does nothing, then "e" which opens the loot menu.

Once in the loot menu, I press SB6 again, and it does the same thing except this time the "Enter" takes the loot and the menu closes, and then it send "e", which does nothing.

Except that pressing SB6 in the loot menu takes the loot and then causes the weapon to switch!

I opened Notepad to tested the hotkey out and it is not sending "x" in there. So I'm betting it's the game engine that's to blame.

User avatar
mikeyww
Posts: 27303
Joined: 09 Sep 2014, 18:38

Re: PixelSearch is behaving unexpectedly  Topic is solved

Post by mikeyww » 22 Jun 2023, 19:02

Yep, it's likely to be your mouse software or your game. It's not AHK.

Post Reply

Return to “Ask for Help (v1)”