SRL Archive - Outdated Tutorials

Brief FindColorSpiral/FindObj Lesson


WhiteShadow

2006-04-03 18:07:09

FindColorSpiral/FindObj by WhiteShadow

Parameters of FindColorSpiral


function FindColorSpiral(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean;

its a function since it returns a true/false statement. True=Found Color False=Did Not

x, y =Coords
Color= Can be a Const or a Color you just plugged in

xs-ys-------------------
| |
| |
| |
|-------------------xe-ye


Xs, Ys are the coords of the top left corner of the box which will be formed around the color. Xe, Ye are the Bottom right corner's coords. They Form a box. A total of 2 Color pick releases for this. NOT 4.

Example

FindColorSpiral's are used in if()then statements.
So

  if(FindColorSpiral(x, y, BankSym, 4, 5, 512, 334))then 
begin
Writeln('Pmg, Color Found');

BankSym would be declared as a Const Like

Const 
BankSym =3243243423;//Color of Bank Symbol

Common Uses
FindColorSpiral is commonly used for Mapwalking. Like Icons and Such.

Another Cool Thing About FindColorSpiral- Thx Pwnd. I forgot about this

if you did something like this

x:67
y:78

It will then spiral outwards from that coord. Which means it can find the closet thing at a even more specified area.

Example

procedure PwndSaidIt; 
begin
X:= 45//Starts Spiral at (45, 67);
Y:= 67
if(FindColorSpiral(x, y, Color, 4, 5, 512, 340))then
begin
Mouse(x, y, 1, 1, true);
end;
end;



Parameters of FindObj

function FindObj(var cx, cy: Integer; objtext: string; objcolor,tol: Integer): Boolean; 

x, y= Coords
ObjText= A string. E.g 'Take', 'Mine', 'Chop', 'Attack'
ObjColor= A Const Or a Picked Out Color
Tol= The Color's Tolerance

Example

procedure Test;
begin
if(FindObj(x, y, 'Take', TreeCol, 5))then
begin
Writeln('Found Object');
end;
end;

TreeCol would be a Const

Uses
FindObj are used for things inside the Main Screen of Rs. Since it can detect the top left hand corners text to match the color, it is better then FindColorSpiral.


Whole Procedures(Test them around, Kids)

A Icon Clicker ,FindColorSpiral



program IconClicker;//Program Name
{.include SRL/SRL.Scar}//Included SRL

Const
BankSym =0;//Searches for this color

procedure WalkBank;//Starts Procedure off
begin
if(FindColorSpiral(x, y, BankSym, 587, 22, 723, 150))then//the if()then statement
begin
Writeln('<----Found Bank Symbol---->');//If Found it writes in the debug this
Wait(200+random(200));
Mouse(x, y, 1, 1, true);//Clicks Bank SYmbol
Flag;//Waits Till red Flag is gone
end else//if it doesn't find color
begin
Writeln(' Did not Find Bank SymBol');
TerminateScript;
end;
end;

begin//MainLoop
WalkBank;
end.

^Fill in Const then that should work

Findobj E.g

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

Const
Rock1= 0;//

procedure MineOre;
begin
repeat
if(FindObj(x, y, 'Mine', Rock1, 5))then//This finds a Rock With 'Mine' text
begin
Mouse(x, y, 1, 1, true);
Wait(500+random(1000));
end else
begin
Writeln('Hmm, Not FOund, Lets see if itll respawn');
end;
until(InvFull)
end;

begin
MineOre
end.

Hopefully you guys got something out of this. Any further questions, plz ask.

K, thx

~WhiteShad0w

Pwnd

2006-04-03 18:27:54

Another cool thing about FindColorSpiral is that you can put coords in for x and y and it will spiral from that coord. This helps if you want to find the closest thing to a certain location.


x:= 125;
y:= 159;
if(FindColorSpiral(x, y, Color, 5, 5, 515, 340))then

Kernel Klink

2006-04-03 18:56:12

Awesome job WhiteShadow!

WhiteShadow

2006-04-03 20:10:55

From: Pwnd
Another cool thing about FindColorSpiral is that you can put coords in for x and y and it will spiral from that coord. This helps if you want to find the closest thing to a certain location.


x:= 125;
y:= 159;
if(FindColorSpiral(x, y, Color, 5, 5, 515, 340))then


Oh, yea I forgot about that. Yojoho taught me that like 3 times. :p I'll add that in.
thx Pwnd

From: Kernel Klink
Awesome job WhiteShadow!

Thanks for the comment. :)

Pyro

2006-04-04 15:51:27

Huh i never knew about that x and y thing. I feel so dumb. Ahh well learn soemthign new everyday. I usally wizz past basic stuff without readign how to properly use it

Dub

2006-04-15 11:35:43

Nice, I'll use it in my future scripts :D

puj

2006-04-15 14:51:52

Very nice, ill try this out.

ub3r |<1||3r*1337*

2006-04-15 15:13:35

good tutorial! thats all i can really say

XxKanexX

2006-04-15 23:05:16

Good tutorial, uses a good example with the rock mining ;)

WhiteShadow

2006-04-15 23:27:32

@Dub, Puj, and ub3r|<1||3r - ;) Music to my ears. Or I guess eyes? Lol

@xxKanexx- :p, Thanks You.

JAD

2007-02-23 17:40:18

good tut. only thing I'd suggest is for the examples part, if you'd put in the main loop:

SetupSRL;
cause then newer people reading this tutorial would be able to use the scripts because the SRL procedures would then work. good tut though, none the less.

wogboy12

2007-05-23 05:30:59

ncie guide thx alot

Inf456

2007-06-01 16:24:29

Awesome job, this really helped me with my first script!

sheetomg

2007-07-01 10:29:58

cool