SRL Archive - SRL Suggestions

function AutoBox(x,y); (Object.scar)


ZaSz

2009-10-17 04:14:37

This would mostly be used with findobjcustomex (added ex because its a little modified by me)

If an objects at a stationary location on the screen. You just use findobjcustomex to find it scanning through the whole screen (like regular findobjcustom), then use autobox to make a box from the findobjcustomex point selected, then the next time you call findobjcustomex, if will do a findobjcustomex in the box.

This way there is no coord clicking, and the screen is aloud to rotate (slowly)

Main Code (Would be in object.scar)


//For the hasbeenset variable, make sure the first time you run, it is false. (Has to be a global declared false at beginning of script.)

function FindObjCustomEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; x1,y1,x2,y2, Tol: Integer; hasbeenset : boolean): Boolean;
begin
if(hasbeenset)then
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, x1, y1, x2, y2) else
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, MSX1, MSY1, MSX2, MSY2);
end;

function autobox(x,y:integer):Tbox;
begin
result := pointtobox(point(x-20,y-20),point(x+20,y+20));
end;

Example usage.



program example;
{.include srl/srl.scar}

//Global var area
var
autoset: boolean;
areabox: TBox;

procedure clickcat; // After 1st time found, will look in 20x20 box around original finding point.
var x,y : integer;
begin
if(FindObjCustomEx(x,y,['at'],[3622984,7109757],areabox.x1,areabox.y1,areabox.x2,areabox.y2,8,autoset))then
begin
//Click or whatever you want here. Ex: mouse(x,y,2,2,true);
areabox := autobox(x,y);
autoset := true;
end;
end;

begin
autoset := false;
repeat
clickcat;
wait(5000);
until(false);
end.

ZaSz

2009-10-17 18:38:35

Editted it a little, any feedback???

EvilChicken!

2009-10-17 19:37:10

Take it easy, you just posted this today – give it a few days for people to notice and reply to.

Besides, we're not talking about lots and lots of code here, (no offense) and I don't really see the point of this? I mean, it's not often you're stationed at one spot finding the exact same object which just happens to be static.

And, try to finish and post finished procedures next time, it might look more appealing then.

JAD

2009-10-17 20:10:46

Since you asked for feedback (and I'm bored..)

FindObjCustomEx could just be:


function FindObjCustomEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; x1,y1,x2,y2, Tol: Integer; hasbeenset : boolean): Boolean;
begin
if(hasbeenset)then
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, x1, y1, x2, y2) else
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, MSX1, MSY1, MSX2, MSY2);
end;

Right?

ZaSz

2009-10-17 20:57:53

From: EvilChicken!
Take it easy, you just posted this today – give it a few days for people to notice and reply to.

Besides, we're not talking about lots and lots of code here, (no offense) and I don't really see the point of this? I mean, it's not often you're stationed at one spot finding the exact same object which just happens to be static.

And, try to finish and post finished procedures next time, it might look more appealing then.


Places off the top of my head. Flax, filling buckets (if you have 2-4 buckets, and apply using a script at a fountain/sink), anything that respawns during a collecting script. :) Thanks for your input also.

From: JAD
Since you asked for feedback (and I'm bored..)

FindObjCustomEx could just be:


function FindObjCustomEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; x1,y1,x2,y2, Tol: Integer; hasbeenset : boolean): Boolean;
begin
if(hasbeenset)then
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, x1, y1, x2, y2) else
Result := FindObjEx(cx, cy, Text, Color, Tol, 50, MSX1, MSY1, MSX2, MSY2);
end;

Right?


Yea, that looks nicer, ty.