SRL Archive - RS3 Outdated / Broken Scripts

function FindColorArea


JAD

2007-04-28 18:50:51

Edit: Fixed it so that the 9 boxes are now on the main screen. I accidentally made all the coords before with the inventory and the chat…etc. and the whole other RS screen. Now its divided up 9 boxes over the main screen, and this should give it more of a reason to be used. Enjoy! :D


Well, this is a very long function, but it is very useful :) I just tested it for clicking a willow tree, and it worked GREAT! here was the problem I was having before using this function, which inspired me to make this.

Now, heres a problem I have seen in chicken killers and other things. The script finds the color of the wall or something and its looking for the chicken. It moves the mouse to the wall, and it doesn't find the text up ttack and hicken…etc. But the thing is, it keeps looking for the color from the same point because it checks top left corner or spirals out from same point…etc., making it repeatedly move the mouse onto that color not finding the text, and not looking at a new part of the runescape screen for the chicken. Now this was a problem, but not anymore! (hopefully :P)

In this function, I have divided up the runescape screen into 9/9 equally, and the script checks your specified box(s), and if it doesn't find the text once it moves the mouse to the color in the first box, it moves it on to the second box, then third…etc. until it finds it (and if you made it look in those other boxes..etc.) This may sound confusing, but heres in short what it does.

Looks for color in specified boxes going down the list in order (b1 b2..etc)

If it finds the color, it moves the mouse to it and looks for the text you specified, and if its there, it results true, clicks if told to and exits.
if the color is not up where it found the color, it goes on to looking in the next box.

Goes through the list of boxes, and if it doesn't find the color/text in any of them it Exits.. Because most likely the color isn't on the screen.

Here it is, the ultimate function! :D

note: The reason this isn't in my script yet is because I haven't had time today to put it in, and I just started making this function 3 hours ago, and finished now :)

//0, 338 top to bottom
//113 = 1/3 the distance top to bottom
//0,516 all the way left to all the way right.
//167 = 1/3 the distance left to right

program New;
{.include SRL/SRL.scar}

{***************************************************************************************************
function FindColorArea(Color, b1, b2, b3, b4, b5, b6, b7, b8, b9: Integer; Text: String; Click: Boolean;): Boolean;

Descriprion: Finds color in specified boxes on MS. there are 9 boxes on the WHOLE runescape screen. each being 1/9 of the screen.
Searches boxes in order, until it finds the text + color in the box, then exits and stops searching.
Text is the text you are looking for if we find the color in a box,
it will move the mouse to the color and then look for the text, and result true if found. if not found,
it moves on to looking in next box. Also clicks if text is up if told too.

Boxes names are 1, 2, 3, 4, 5, 6, 7, 8, 9. Heres where they are in order:
top left, top middle, top right, middle left, middle middle, middle right, bottom left, bottom middle
bottom right, 0 to not check a box.
***************************************************************************************************}

function FindColorArea(Color, Tol, b1, b2, b3, b4, b5, b6, b7, b8, b9: Integer; Text: String; Click: Boolean): Boolean;
var
JADX1, JADY1, JADX2, JADY2: Integer;

begin

case b1 of

1: if(b1 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b1 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b1 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b1 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b1 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b1 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b1 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b1 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b1 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b1=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b2 of

1: if(b2 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b2 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b2 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b2 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b2 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b2 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b2 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b2 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b2 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b2=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b3 of

1: if(b3 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b3 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b3 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b3 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b3 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b3 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b3 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b3 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b3 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b3=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b4 of

1: if(b4 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b4 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b4 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b4 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b4 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b4 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b4 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b4 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b4 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b4=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b5 of

1: if(b5 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b5 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b5 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b5 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b5 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b5 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b5 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b5 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b5 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b5=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b6 of

1: if(b6 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b6 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b6 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b6 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b6 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b6 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b6 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b6 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b6 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b6=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b7 of

1: if(b7 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b7 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b7 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b7 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b7 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b7 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b7 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b7 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b7 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b7=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b8 of

1: if(b8 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b8 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b8 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b8 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b8 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b8 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b8 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b8 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b8 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;


end;

if(not(b8=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;

case b9 of

1: if(b9 = 1)then
begin
JADX1:=0;
JADY1:=0;
JADX2:=167;
JADY2:=113;
end;

2: if(b9 = 2)then
begin
JADX1:=167;
JADY1:=0;
JADX2:=334;
JADY2:=113;
end;

3: if(b9 = 3)then
begin
JADX1:=334;
JADY1:=0;
JADX2:=501;
JADY2:=113;
end;

4: if(b9 = 4)then
begin
JADX1:=0;
JADY1:=113;
JADX2:=167;
JADY2:=226;
end;

5: if(b9 = 5)then
begin
JADX1:=167;
JADY1:=113;
JADX2:=334;
JADY2:=226;
end;

6: if(b9 = 6)then
begin
JADX1:=334;
JADY1:=113;
JADX2:=501;
JADY2:=226;
end;

7: if(b9 = 7)then
begin
JADX1:=0;
JADY1:=226;
JADX2:=167;
JADY2:=339;
end;

8: if(b9 = 8)then
begin
JADX1:=167;
JADY1:=226;
JADX2:=334;
JADY2:=339;
end;

9: if(b9 = 9)then
begin
JADX1:=334;
JADY1:=226;
JADX2:=501;
JADY2:=339;
end;
end;

if(not(b9=0))then
begin
if(FindColorTolerance(x,y, Color, JADX1, JADY1, JADX2, JADY2, Tol))then
begin
MMouse(x,y,2,2);
if(IsUpText(Text))then
begin
Result:=True;
if(Click=true)then
begin
Mouse(x,y,2,2,true);
end;
Exit;
end;
end;
end;
if(not(Result))then
Writeln('Did not find color in any of specified boxes :(');
end;


begin
end.

inSane

2007-04-29 17:28:53

Yeah, works great! Good job man!

JAD

2007-04-29 19:49:34

Thanks a lot insane! It could be useful for a lot of things, like if your fishing at a spot with a lot of fishing spots, and you want to net fish for instance, and theres other things there.. FindObj and things like that would move the mouse to the place it found it, and if the correct text wasn't up, you'd try doing it again, and since it would search the same place.. You would go into a very long loop of not doing anything :p

Fearlesssss

2007-05-04 08:48:56

OMG that function owns!:D You can rlly script man :p I will use this in my script(Credits to you ofcourse;))

inSane

2007-05-04 16:11:49

It might be used in one of my and my friends script but i dunno yet if we need it ;) but it is good!

JAD

2007-05-04 20:14:40

Thanks a lot guys :D Would love to see some people include it in there scripts.