Helping Simple Script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
guiguiiz
Posts: 15
Joined: 22 Feb 2019, 10:56

Helping Simple Script

04 Dec 2019, 22:34

I have a problem and I can not solve, the problem is this, I want the script to move the mouse to a certain place on the screen, press an (Ins) key and after that click where the mouse is.
Having done that, I want the script to look for an image and only continue the script after locating the image. Please, I'm breaking my head and I can't! :(

Code: Select all

CoordMode Pixel
Loop {
MouseMove, 780, 111
Sleep, 1000
Send, {Ins}
Click, Left
If (ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, Burbles.png)
{
Send, {Ins}
Sleep, 2000
}
Return
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Helping Simple Script  Topic is solved

05 Dec 2019, 00:42

Your syntax was a little off try this:

Code: Select all

CoordMode Pixel
Loop
{
    MouseMove, 780, 111
    Sleep, 1000
    Send, {Ins}
    Click, Left
    ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, Burbles.png
    if (ErrorLevel = 0)
    {
        Send, {Ins}
        Sleep, 2000
        break    ; <---- stop looping the image was found
    }
}
Return
Note: you might want to also set CoordMode for the mouse.
HTH
guiguiiz
Posts: 15
Joined: 22 Feb 2019, 10:56

Re: Helping Simple Script

05 Dec 2019, 13:37

It didn't work out very well, because the script keeps trying to replay such an action, and I just want the script to do "ACTION2" after it finds the image, I don't know if the script can find such an image as fast as I want it to. , what do you think?
The image in question is not a still image, it is a kind of "GIF".


https://imgur.com/WvzofMv

Look This ,
I just want Script to do "action2" after it finds those "bubbles" in the water.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Helping Simple Script

05 Dec 2019, 15:09

I would think using PixelSearch for the circles color would be easier.
guiguiiz
Posts: 15
Joined: 22 Feb 2019, 10:56

Re: Helping Simple Script

20 Jan 2020, 17:19

@Xtra
Hello, I have a new problem, for me it can be complicated, but I do not know if for you, it is the following: I need the macro to look for the image, around the mouse you know?,

Code: Select all

o::
MouseGetPos, StartX, StartY
return
i::
MouseMove, StartX-25, StartY-30 ;; Test Position
return
p::
Label1:
MouseMove, %StartX%, %StartY%
    Sleep, 1000
    Send, {Ins}
    Click, Left
Loop
{
    ImageSearch, FoundX, FoundY, %StartX+25%, %StartY+30%, %StartX-25%, %StartY-30%, Burbles8.png
    if (ErrorLevel = 0)
    {
        Send, {Ins}
        Sleep, 500
Break
    }
}
Sleep, 200
gosub Label1
Return
Thank's

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 78 guests