What's new

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to: pixelsearch

Anavar

Anavar

Supporter
Member
Joined
Dec 21, 2020
Messages
24
Saw a few users having issues to I thought I'd give some assistance.


Code:
PixelSearch, X100, Y100, X1, Y1, X2, Y2, COLOR, VARIATION, Fast

pixelsearchexample.png

Inside of the pixel search the
Code:
X100, Y100
section is the vars, this is used if you wish to click the color rather than a specific location if it is found.

checkinventoryisopen:

PixelSearch, X100, Y100, XStart+1632, YStart+377, XStart+1393, YStart+509, 0x1E2674, 10, Fast
; checking if backpack is open - finds the red color indicating that the TAB is open
if Errorlevel = 1 ; 1 = If the color is NOT found it will then go to open the backpack
{
Controlclick, x1376 y245, BlueStacks,,,, NA
; opens the backpack : Use mouseclick for runelite etc...
sleep, 500 ; sleeps for 500ms < not necassary however I like to give it a chance to do its thing.
goto, checkinventoryisopen ; it then double checks the backpack is open by going to the goto label above this pixel search : You can also use a loop
}
else
; if the backpack is already open it will then continue to the next task

Example NEXT TASK:
CLICK ITEM INSIDE OF INVENTORY

This is the open backpack color I was speaking of: openbag.PNG its searching for the maroon/red color which indicates the inventory/tab is open.

Please note: This code will not work as the coordinates are just EXAMPLES only, you will need to find the coordinates yourself.

also keep in mind although pixel searching is defined one way, there is at least 5 different ways of setting it to do different things.

I hope this helps you :)
 
B

botting.rs

Member
Joined
Apr 22, 2020
Messages
6
Thanks Sammich, just wondering, is it possible to use the 1 PixelSearch function to search in two locations or would you just use a else { search for other location } for instance if someone is using the classic interface vs the compacted interface (where the icons are all in a row at the bottom)
 
Anavar

Anavar

Supporter
Member
Joined
Dec 21, 2020
Messages
24
Thanks Sammich, just wondering, is it possible to use the 1 PixelSearch function to search in two locations or would you just use a else { search for other location } for instance if someone is using the classic interface vs the compacted interface (where the icons are all in a row at the bottom)

PixelSearch, X100, Y100, XStart+1632, YStart+377, XStart+1393, YStart+509, 0x1E2674, 10, Fast ; checking if color green
if Errorlevel = 1 ; 1 = If green color isnt found do something else
PixelSearch, X100, Y100, XStart+1632, YStart+377, XStart+1393, YStart+509, 0x1E2674, 10, Fast ; checking if color blue
if Errorlevel = 1 ; 1 = If blue color isnt found do something else
{
HERE I AM DOING SOMETHING BECAUSE THE COLOR WASNT FOUND
}
else ; if the color was found continue to next task

Example NEXT TASK: CLICK ITEM INSIDE OF INVENTORY
 
rockrockrock

rockrockrock

Member
Joined
Jan 21, 2021
Messages
4
Hey, dude i have a few questions for you @Sammich , mind if I PM you ?
 
U

unknownrandy

Member
Joined
Jul 8, 2020
Messages
20
Saw a few users having issues to I thought I'd give some assistance.


Code:
PixelSearch, X100, Y100, X1, Y1, X2, Y2, COLOR, VARIATION, Fast

View attachment 604

Inside of the pixel search the
Code:
X100, Y100
section is the vars, this is used if you wish to click the color rather than a specific location if it is found.

checkinventoryisopen:

PixelSearch, X100, Y100, XStart+1632, YStart+377, XStart+1393, YStart+509, 0x1E2674, 10, Fast
; checking if backpack is open - finds the red color indicating that the TAB is open
if Errorlevel = 1 ; 1 = If the color is NOT found it will then go to open the backpack
{
Controlclick, x1376 y245, BlueStacks,,,, NA
; opens the backpack : Use mouseclick for runelite etc...
sleep, 500 ; sleeps for 500ms < not necassary however I like to give it a chance to do its thing.
goto, checkinventoryisopen ; it then double checks the backpack is open by going to the goto label above this pixel search : You can also use a loop
}
else
; if the backpack is already open it will then continue to the next task

Example NEXT TASK:
CLICK ITEM INSIDE OF INVENTORY

This is the open backpack color I was speaking of: View attachment 605 its searching for the maroon/red color which indicates the inventory/tab is open.

Please note: This code will not work as the coordinates are just EXAMPLES only, you will need to find the coordinates yourself.

also keep in mind although pixel searching is defined one way, there is at least 5 different ways of setting it to do different things.

I hope this helps you :)
why use controlclick? if you want to click on the specific window i would just go winactivate,*winname* then just do a simple click like click,x,y,10 or click,x,y,10,R
 
Anavar

Anavar

Supporter
Member
Joined
Dec 21, 2020
Messages
24
why use controlclick? if you want to click on the specific window i would just go winactivate,*winname* then just do a simple click like click,x,y,10 or click,x,y,10,R

Controlclick is used for BlueStacks (OSRS Mobile). It can click in the background without having to use winactiv and take control of the mouse....
Post automatically merged:

Hey, dude i have a few questions for you @Sammich , mind if I PM you ?
Sure.
 
U

unknownrandy

Member
Joined
Jul 8, 2020
Messages
20
Controlclick is used for BlueStacks (OSRS Mobile). It can click in the background without having to use winactiv and take control of the mouse....
Post automatically merged:


Sure.
i tried to use it before but never had any luck clicking behind something i did in my testing with mspaint but osrs it would mess up everytime
 
Anavar

Anavar

Supporter
Member
Joined
Dec 21, 2020
Messages
24
i tried to use it before but never had any luck clicking behind something i did in my testing with mspaint but osrs it would mess up everytime
PM your code to me and I'll have a look.
 
U

unknownrandy

Member
Joined
Jul 8, 2020
Messages
20
becareful with pixel search cuz its very specific on what it well find in the given area it can see and it may only like that one pixel to make a match with so you click in one spot
Post automatically merged:

and like a tree has like 20 + different colors
 
Asentrix

Asentrix

Administrator
Owner
Leaker
VIP
Developer
Member
Joined
Oct 2, 2019
Messages
642
becareful with pixel search cuz its very specific on what it well find in the given area it can see and it may only like that one pixel to make a match with so you click in one spot
Post automatically merged:

and like a tree has like 20 + different colors
That's why I like winautomation, you can control the tolerance
 
Anavar

Anavar

Supporter
Member
Joined
Dec 21, 2020
Messages
24
becareful with pixel search cuz its very specific on what it well find in the given area it can see and it may only like that one pixel to make a match with so you click in one spot
Post automatically merged:

and like a tree has like 20 + different colors
I do have methods to control tolerances like other languages, however its honestly not a huge issue, I've created some pretty insane bots with this method.
 
Memumo

Memumo

Member
Joined
Mar 3, 2021
Messages
9
Btw is there anyway u can like create virtual mouse with ahk or something like that? Too new for ahk to know this yet, :/
 
Top