SRL Archive - OSR Help

How to use ---> If FindColor then


skautas

2013-05-16 07:22:10

So basically I want to ask how to use that stuff that finds color and later do something if it find right color.

Example:


procedure blablabla
var //should be something here I believe lol
begin
If FindColor (Color number) Then <—— here i get errors
Begin
Wait(RandomRange(100, 200));
Clicktocontinue;
End;
End;





Cheers :)

Ian

2013-05-16 07:28:20

From: skautas
So basically I want to ask how to use that stuff that finds color and later do something if it find right color.

Example:


procedure blablabla
var //should be something here I believe lol
begin
If FindColor (Color number) Then <—— here i get errors
Begin
Wait(RandomRange(100, 200));
Clicktocontinue;
End;
End;

Cheers :)


Everything should work except could you post your actual FindColor line? there are more parameters that you need to fill in than just the color.

skautas

2013-05-16 08:14:15

Color, but it is named by word in the script.

MineColor :=[465132651, 4651326623];

So it look like :

If FindColor(MineColor) Then
Begin

Ian

2013-05-16 08:25:13

From: skautas
Color, but it is named by word in the script.

MineColor :=[465132651, 4651326623];

So it look like :

If FindColor(MineColor) Then
Begin


Yeah, FindColor has more parameters than just the color. For example

FindColor(x, y, 1022701, MMX1, MMY1, MMX2, MMY2)

You need to have the x and y because that's where it stores the coordinates of the color it finds. The MMX1 ect is the area where it looks for your color, if you want to look on the mainscreen use

MMX1, MMY1, MMX2, MMY2

If you don't need the coordinates of a color and just want to see if it exists I recommend using CountColor, like this:

if (CountColorTolerance(4512575, MSX1, MSY1, MSX2, MSY2, 5) > 0) then

4512575 is the color you are looking for
MSX1, MSY1, MSX2, MSY2 are the bounds for the mainscreen
5 is the tolerance
1 is the least number of pixels you must have for it to be true

skautas

2013-05-17 08:47:43

Thx I will try this out :)