SRL Archive - OSR Help

function FindColor


Jacob

2012-03-21 23:24:34

How do I use FindColor?

if FindColor(var x,y,: Integer; color, xs, ys, xe, ye: Integer):

lilcmp1

2012-03-21 23:35:30

So your variables x,y is the coordinates of the color you're trying to find. Color is the color it's looking for and xs, ys, xe, ye are the coordinates it's looking for the color within. Using the color dropped tool in simba you can click on it, then click on rs and it'll give you the color and coordinates of it. Here is an example
 Findcolor(X,Y, 1234556, MSX1, MSY1, MSX2, MSY2) 
This looks for the color 1234556 in the main screen. The MSX1, MSY1 is the coordinate in the top left of the screen and MSX2, MSY2 is the coordinate in the bottom right of the main screen. This creates a box to look for the color in. It returns the spot the color was found as x,y

You will have to declare your variables at the beginning of the script though. For exmaple;
 Procedure FindSomeColor;
Var
x, y: integer;

Begin
FindColor(x,y, 1234556, 1, 1, 100, 100)
Mouse(x, y, 5 , 5, True);
End;

Would left click the color. You might look at YoHoJo's video tutorials although I think some procedures might need slight altering.

Jacob

2012-03-21 23:41:23

also, what is wrong with this?

if GetColor(-412, -4,: True): 251;

lilcmp1

2012-03-21 23:50:38

From: Jacob
also, what is wrong with this?

if GetColor(-412, -4,: True): 251;


Get color is a function that results in a color. So if you're using it say

Getcolor(50,150)

It would search the screen at the coordinate 50,150 and the result would be the color that is there.

So you could use it
 
If (GetColor(50,150) = 123456) Then
blah... blah;
So if the color at 50,150 equals your color (123456) then you could do something. Idk what else you'd want to do with it. Not sure where you're going with it. You also can't use negative numbers. If your getting negative numbers you need to press the target icon then drag it to the rs window to set the correct window.

Jacob

2012-03-22 07:46:05

I like you, thanks, I'm making my first script, all it involves is clicking colors, but if that color is a certain color it refreshes the page. If the color is the correct color it waits 2 minutes then refreshes the page. I'm using SCAR.