From: SKy Scripter
Glad to see many will join?
You dont need anti-random all im looking for is a tree finder..
and sense wizzyplugin is from SRL you may use it. ;)
So, you'll let people use a plugin that was written by someone else, but you say that I can't use the plugin that I'm working on… :duh: If anything, fast array sorting would be the one thing that would seperate the men from the boys in Scar in my opinion. After all, that IS the bulk of object finding, comparing the points ;)
Like I've said before, if everyone had exactly the same advantages and disadvantages in a competition, they would all tie. Part of the learning process involves moving out of Scar for speed sensitive operations, and then into a faster language after you tire of delphi ;) Take my rock finder for instance, it uses my plugin only for the parts that are really generic and need to be fast:
{*******************************************************************************
procedure FindRocks(var Points: TPointArray; RockType: Integer);
by: BenLand100
Description: Finds rocks in Varrock using HSL
Returns midpoints of rocks found in the Points array
Use the following values for RockType:
0 - Copper
1 - Tin
2 - Iron
3 - Silver
4 - Clay
*******************************************************************************}
procedure FindRocks(var Points: TPointArray; RockType: Integer);
var
Temp: TPointArray;
Len, Count, i, e: Integer;
begin
SetLength(Points,169830);
case RockType of
{Copper} 0: Len:= FindColorsHSLFast(GetClientCanvas.handle,5,5,515,338,Points,169830,28,50,50,5,20,30);
{Tin} 1: Len:= FindColorsHSLFast(GetClientCanvas.handle,5,5,515,338,Points,169830,2,10,50,7,20,30);
{Iron} 2: Len:= FindColorsHSLFast(GetClientCanvas.handle,5,5,515,338,Points,169830,17,50,30,2,20,20);
{Silver} 3: Len:= FindColorsHSLFast(GetClientCanvas.handle,5,5,515,338,Points,169830,43,18,60,5,10,40);
{Clay} 4: Len:= FindColorsHSLFast(GetClientCanvas.handle,5,5,515,338,Points,169830,40,55,70,2,20,20);
end;
Len:= GroupCentersMin(Points,Len,30,10);
SetLength(Temp,1600);
i:= 0;
e:= Len - 1;
{The FindColorsHSLFast in the following section identifies the rock color
that is the lightest color on the rock for Varrock rocks. It could be
adjusted to work for other new rocks by putting in the HSL values for the
rocks of the new area.}
//Simplified Excluding Quicksort Algorithm
while i < Len do
begin
repeat
Count:= FindColorsHSLFast(GetClientCanvas.handle,Points[e].X-15,Points[e].Y-15,Points[e].X+15,Points[e].Y+15,Temp,1600,45,75,40,12,20,20);
e:= e - 1;
Len:= Len - 1;
until ((Count >= 150) and (Count <= 700)) or (e < 0);
Len:= Len + 1;
e:= e + 1;
repeat
Count:= FindColorsHSLFast(GetClientCanvas.handle,Points[i].X-15,Points[i].Y-15,Points[i].X+15,Points[i].Y+15,Temp,1600,45,75,40,12,20,20);
i:= i + 1;
until ((Count < 150) or (Count > 700)) or (i - 1 > e);
i:= i - 1;
if i >= e then break;
Points[i]:= Points[e];
Len:= Len - 1;
end;
SetLength(Temp,0);
SetLength(Points,Len);
end;
Really, GroupCentersMin is like using Wizzup's plugin, just faster, and FindColorsHSLFast is just a faster and more controlable version of FindColorsTolerance with ColorToleranceSpeed(2).