Need help with ImgSearch.

Ask gaming related questions (AHK v1.1 and older)
American1944
Posts: 1
Joined: 30 Jan 2024, 01:02

Need help with ImgSearch.

30 Jan 2024, 01:10

I am attempting to detect a very specific image in a game that relies on timing in order to win. The minigame is essentially a bar that has to hit the jackpot to win. The problem is that ImageSearch doesn't seem to detect the image no matter what I do. What am I doing wrong?

Code: Select all

XButton1::
Send, {e down}
Loop{
	ImageSearch, OutputVarX, OutputVarY, -1000, 383, 1500, 475, "*255", shooter.png
} Until (OutputVarX > 0)
MsgBox, % OutputVarX
Send, {e up}
Return
Image im trying to detect.
https://imgur.com/a/wxwRhIq
Gameplay Footage of the game:
[youtube]https://youtu.be/tb3l989JSFM[/youtube]

Also let me know if this should be in the V1 section.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Need help with ImgSearch.

30 Jan 2024, 05:13

American1944 wrote: Also let me know if this should be in the V1 section.
Yes, questions regarding v1 code should be in the v1 section, and questions about gaming should go in the gaming sub-section. This thread was moved there. Please post in the appropriate sub-forum in the future.
User avatar
mikeyww
Posts: 28869
Joined: 09 Sep 2014, 18:38

Re: Need help with ImgSearch.

17 Feb 2024, 07:24

The ImageSearch command has seven parameters, but your statement has eight. The documentation explains it and also shows you an example of how to use the ImageSearch options.
Options: Zero or more of the following options may be also be present immediately before the name of the file. Separate each option from the next with a single space or tab. For example: *2 *w100 *h-1 C:\Main Logo.bmp.
Instead of testing your search in a loop, test with a single static image with no loop. After you verify that the search works, expand by adding your loop. I recommend a sleep command inside the loop.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 30 guests