Novice (need help) trying to make a skill check with pixelsearch

Ask gaming related questions (AHK v1.1 and older)
tensaiexe
Posts: 1
Joined: 01 Feb 2024, 14:11

Novice (need help) trying to make a skill check with pixelsearch

01 Feb 2024, 14:43

Code: Select all

Loop
{
    CoordMode, Pixel, Window
    PixelSearch, FoundX, FoundY, 553, 519, 1375, 563, 0xF9FD02, 10, Fast RGB
    Sleep, 1
}
Until ErrorLevel = 0
If (ErrorLevel = 0)
{
    Loop
    {
        CoordMode, Pixel, Window
        PixelSearch, FoundX, FoundY, %FoundX%, %FoundY%, %FoundX%, %FoundY%, 0xFDFD04, 10, Fast RGB
        Sleep, 1
    }
    Until ErrorLevel
    If (ErrorLevel = 0)
    {
        MsgBox, 0, , woo
    }
}

Trying to make it loop till it finds a certain pixel and then move to a if statement which leads to another loop that activates when the original pixel that was found is then not visible/ a different pixel but the code just doesnt seem to work?

[Moderators note: Moved to Gaming subsection, added code boxes]
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: Novice (need help) trying to make a skill check with pixelsearch

01 Feb 2024, 22:04

There are several things that don’t really make sense here. The first loop goes until it finds that color. OK so far. Then you have an unnecessary If statement. You exited the loop above when ErrorLevel is 0, so of course it is still 0. That makes the If statement meaningless. That’s not a problem in execution, but you should get rid of the meaningless lines. Unless they’re meant to check something else, but then what would that be?

Then your description and the code are not clear about what’s supposed to happen in the next loop. What do you mean that loop “activates when the original pixel that was found is then not visible/ a different pixel”? That loop happens no matter what but it exits the loop when the pixel where the original color was found is not a certain color. The strange thing is, it’s a slightly different color whose allowable range largely overlaps with the allowable range of the original color. You need to be more clear about what it’s supposed to do.

Then at the end, you have an If statement that can never be true because you exit the loop before it when ErrorLevel is not 0, and the If condition is true only when it is 0. So you have a MsgBox that could never appear.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 29 guests