how does image search works

Ask gaming related questions (AHK v1.1 and older)
Fabian_2
Posts: 1
Joined: 12 Apr 2021, 12:35

how does image search works

12 Apr 2021, 12:43

hey I'm pretty new to ahk and I'm trying to make a script where it recognizes a certain image and then presses a certain key when it finds the image. its for a game named graal era with a fishing job I'm trying to bot, when I'm fishing i press D to cast the line and when it the fish bites, it changes the baits image then ill have to press D again to catch it . so I'm trying to figure out how to make a script to recognize that image change and then press D to catch it . thanks in advance!
User avatar
mikeyww
Posts: 26879
Joined: 09 Sep 2014, 18:38

Re: how does image search works

12 Apr 2021, 14:03

Save an exact screenshot of the image that you want, in PNG format. Crop to the part that you want to find. You can then issue an ImageSearch command to find the image whenever needed. If you're lucky, your game will not block cheaters.
graal
Posts: 5
Joined: 09 Jan 2022, 08:29

Re: how does image search works

09 Jan 2022, 08:42

mikeyww wrote:
12 Apr 2021, 14:03
Save an exact screenshot of the image that you want, in PNG format. Crop to the part that you want to find. You can then issue an ImageSearch command to find the image whenever needed. If you're lucky, your game will not block cheaters.
hello, im trying to do the same thing as this person, ive got a whole script written out but imagesearch always triggers a false positive, I will explain.

in order to successfully fish, a hook image must overlap a bobber image, the hook is going from left to right on a loop, and the bobber image appears after a couple seconds in a random spot, it always triggers the imagesearch positive when the bobber appears, I am using an image of the hook and bobber overlapped but like I said it always triggers a positive search when the bobber appears not when they overlap like I want it to. is there anything more i could do to strengthen my parameters?

might there be a better solution to what ive written already?

heres my code:

Code: Select all

f1::    ; fish skill
loop   ; start:

send {j}

{
ImageSearch, OutputVarX, OutputVarY, 937, 512, 300, 300, 0, 0x055150 *w11 *h18 C:\Users\btcvi\Desktop\fish2.png
if (ErrorLevel = 0)
Send, {j down} sleep 2500 {j up}
Sleep 1300
}

f2::Pause    ; pauser
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 26879
Joined: 09 Sep 2014, 18:38

Re: how does image search works

09 Jan 2022, 08:55

If your Loop applies to a block, then enclose the block in braces immediately below your Loop command.
The loop command is usually followed by a block, which is a collection of statements that form the body of the loop. However, a loop with only a single statement does not require a block (an "if" and its "else" count as a single statement for this purpose).
Put your Sleep command on its own line. Separate commands are generally on separate lines.
User avatar
boiler
Posts: 16919
Joined: 21 Dec 2014, 02:44

Re: how does image search works

09 Jan 2022, 09:51

@graal - It would be better if you didn’t try to get the same advice in two different threads.

viewtopic.php?f=18&t=98648

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 36 guests