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)
Example usage.
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.