SRL Archive - Help and Support

Speeding up this proc


BobboHobbo

2009-06-24 11:18:50

Well im making a reflection mining script and to find my ores i use this:

function ClickOre(UID: integer): Boolean;
var
Tile1, Tile2, OREMS: TPoint;
x, y, d, e: integer;
begin
MarkTime(D);
if not FindObject(Tile1, UID) then Exit;
OreMS := TileToMS(Tile1, Random(5));
case Random(2) of
0: Mouse(OreMS.x, OreMS.y, 0, 0, R_IsUpText('ine R'));
1:
begin
Mouse(OreMS.x, OreMS.y, 0, 0, R_IsUpText('ine R'));
wait(200 + random(500));
R_ChooseOption('ine R');
end;
end;
Result := True;
E := GetSystemTime - D;
Writeln(IntToStr(E));
end;

But it takes 9438MS to find the ore, bit to much yea?

Well what can i do to speed it up?

Frt

2009-06-24 12:01:11

FindObject searches on all of the loaded tiles.
Use FindObjectEx instead. :)

BobboHobbo

2009-06-24 12:32:35

From: Frt
FindObject searches on all of the loaded tiles.
Use FindObjectEx instead. :)


Ah yeah i realized that! thanks. But should Max Length be 1 on for FindObjectEx?

Frt

2009-06-24 13:05:54

From: BobboHobbo
Ah yeah i realized that! thanks. But should Max Length be 1 on for FindObjectEx?


1 Will be right next to the player. I normally go with a length between 10 and 15, that does the trick.

Da 0wner

2009-06-24 14:44:57

You should use a length of the amount of tiles you can see :p.

BobboHobbo

2009-06-24 15:10:30

Oh i get it now. thanks ;).

marpis

2009-06-24 16:49:18

2 or 3 is quite enough to keep it fast :)