Multiple PixelSearch LMB Script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Beck

Multiple PixelSearch LMB Script  Topic is solved

23 Sep 2018, 08:05

Greetings,

I am looking for assistance with a script I've been trying to revamp. The objective: Search a specific area within a set x,y coordinate and look for 6 different colors within this area. Once found, click on any area within the block, doesn't have to be directly over the pixel.

Example:

http://i68.tinypic.com/n1c4zd.png

--
In this picture, there is a line bar that scrolls from left to right and once it appears over a object a color appears in a circle above the line bar and within that circle are unique color pixels that do not appear on the screen otherwise.


Script Example: Note: I am a beginner at this and would love to know what I did incorrectly. All the color codes within this script are the ones I'm looking for. The coordinates are similar to where I would like the mouse to always click.

F NOT A_IsAdmin ; Runs script as Admin.
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}

#MaxThreadsPerHotkey, 2
CoordMode, Pixel, Screen
#singleInstance, Force
toggle = 0


F8:: ; press F8 to toggle the loop on/off.
SoundBeep
Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0x1A1A95, 0, Fast RGB

IF ErrorLevel = 1 ; IF NOTFound.
{
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0xA32322, 0, Fast RGB
}

IF ErrorLevel = 1 ; IF NOTFound.
{
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0xC12BB2, 0, Fast RGB
}

IF ErrorLevel = 1 ; IF NOTFound.
{
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0x189646, 0, Fast RGB
}

IF ErrorLevel = 1 ; IF NOTFound.
{
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0x4E4EA8, 0, Fast RGB
}

IF ErrorLevel = 1 ; IF NOTFound.
{
PixelSearch, colourx, coloury, 806, 725, 778, 780, 0x14929B, 0, Fast RGB
}

IF ErrorLevel = 0 ; IF Found.
{
Click, %colourx%, %coloury% Left, 1 ; Click on it.
sleep, 1000
}

} ;-- End of Loop.
return

Regards,
Beck
felipe93
Posts: 29
Joined: 03 May 2019, 08:20

Re: Multiple PixelSearch LMB Script

19 Aug 2020, 02:01

I have tried something like this, but now is not even reading the first pixel

THIS IS HOW I EDITED THE CODE

Code: Select all

RShift:: ;borrados ara test de delay y otro de clicks etc
ControlClick, x%sdX% y%sdY%, Old-Ultra Client,, Right, 1
Return

Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.

RShift up::
PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xDF3F3F, 5, Fast RGB

IF ErrorLevel = 1 ; IF NOTFound.
{

PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xD83326, 5, Fast RGB

}

TargetX += 55
TargetY += 61 ;56 mio o pero no funco
ControlClick, x%TargetX% y%TargetY%, Old-Ultra Client,, Left, 1
Return

} ;-- End of Loop.
return
This is how it looks clean, it already begissn with a loop

Code: Select all

Loop
{
PixelSearch, sdX, sdY, BPTopX, BPTopY, BPBotX, BPBotY, 0xDDD2C7, 0, Fast RGB     
PixelSearch, uhX, uhY, 1282, 462, 1313, 491, 0x2E598B, 0, Fast RGB     //BYT FÄRG TILL UH
}

RShift:: ;borrados ara test de delay y otro de clicks etc
ControlClick, x%sdX% y%sdY%, Old-Ultra Client,, Right, 1
Return

RShift up::
PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xDF3F3F, 5, Fast RGB
TargetX += 55
TargetY += 61 ;56 mio o pero no funco
ControlClick, x%TargetX% y%TargetY%, Old-Ultra Client,, Left, 1
Return
ideas please?
felipe93
Posts: 29
Joined: 03 May 2019, 08:20

Re: Multiple PixelSearch LMB Script

19 Aug 2020, 02:32

NOW im getting this A "return " must be enountered prior to this

i tried add it where i thought it supposed to be. but ahk isn't telling me in which line it goes
PS: it working if the first pixel is found but if the first isn't found i get the error

Code: Select all

RShift:: ;borrados ara test de delay y otro de clicks etc
ControlClick, x%sdX% y%sdY%, Old-Ultra Client,, Right, 1
Return

Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.

RShift up::
PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xDF3F3F, 5, Fast RGB

IF ErrorLevel = 1 ; IF NOTFound.
{

PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xD83326, 5, Fast RGB

}

IF ErrorLevel = 0 ; IF Found.
{

TargetX += 55
TargetY += 61 ;56 mio o pero no funco
ControlClick, x%TargetX% y%TargetY%, Old-Ultra Client,, Left, 1
Return
}

} ;-- End of Loop.
Return
felipe93
Posts: 29
Joined: 03 May 2019, 08:20

Re: Multiple PixelSearch LMB Script

19 Aug 2020, 02:59

RShift:: ;borrados ara test de delay y otro de clicks etc
ControlClick, x%sdX% y%sdY%, Old-Ultra Client,, Right, 1
Return



RShift up::
PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xDF3F3F, 5, Fast RGB

IF ErrorLevel = 1 ; IF NOTFound.
{

PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xB43333, 5, Fast RGB

}

IF ErrorLevel = 1 ; IF NOTFound.
{

PixelSearch, TargetX, TargetY, TopX, TopY, BotX, BotY, 0xC83939, 5, Fast RGB

}


IF ErrorLevel = 0 ; IF Found.
{

TargetX += 55
TargetY += 61 ;56 mio o pero no funco
ControlClick, x%TargetX% y%TargetY%, Old-Ultra Client,, Left, 1
Return
}
Return


no errors now but only works with the first pixel the others are never found, ideas?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], hiahkforum, phalanxdarken and 118 guests