SRL Archive - SRL Archives

FindRock


n3ss3s

2008-10-26 14:50:28

Just wanted to try out again, tried a few times with Tin and seems to work fine, around 15-50ms… No guarantee of anything…

Function FindRocks(Color, Tol: Integer; tol_H, tol_S: Extended): TPointArray;


Var
TPA: TPointArray;
L, C, I: Integer;
B: TBox;
TPAA: T2DPointArray;
Begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(tol_H, tol_S);
FindColorsTolerance(TPA, Color, MSX1, MSY1, MSX2, MSY2, tol);
SetColorSpeed2Modifiers(0.2, 0.2);
TPAA := TPAToATPAEx(TPA, 30, 30);
L := High(TPAA);
SetArrayLength(Result, L + 1);
For I := 0 To L Do
If Length(TPAA[i]) < 65 Then
If Length(TPAA[i]) > 10 Then
Begin
B := GetTPABounds(TPAA[i]);
Try
If (Length(TPAA[i]) + 0.001) / ((B.x2 - B.x1) * (B.y2 - B.y1)) < 0.5 Then
Begin
Result[c] := Point((B.x2 + B.x1) shr 1, (B.y2 + B.y1) shr 1);
C := C + 1;
End;
Except End;
End;
SetArrayLength(Result, C);
ColorToleranceSpeed(1);
End;

Shuttleu

2008-10-26 15:31:39

time to find out what SetColorSpeed2Modifiers does

~shut

Narcle

2008-10-26 16:33:50

Wow u put the color modifiers in as a option (forgot technical name).

TViYH

2008-10-26 21:13:42

How do I find the H_tol, etc…?

I'm a noob when it comes to RGB/HSL/XYZ color searching.

Nava2

2008-10-27 08:25:18

I don't understand how this function even works. Sorry.

Isn't it more of a pain to get the HSL Tols anyways? Why not use a color record..?

n3ss3s

2008-10-28 02:22:10

The laziness factor, IS, NOT, AMUSED.


with arRockRecords[lumbridge_Coal] do
begin
Name := 'Coal';
UpText := 'Mine';
MaxDist := 13;
MinCount := 5;
Color := 2372661;
HueMod := 0.15;
SatMod := 0.09;
LumTol := 7;
MinR := 31; MaxR := 74;
MinG := 31; MaxG := 74;
MinB := 21; MaxB := 51;
MinX := 1.24; MaxX := 5.73;
MinY := 1.38; MaxY := 6.43;
MinZ := 0.94; MaxZ := 3.97;
end;

From Mining.scar, your script is fucked if you did that much effort for it :p

This I likes,


program New;

Var
H, S, L: Extended;
begin
ColorToHSL(0, H, S, L);
Writeln(FloatToStr(H));
Writeln(FloatToStr(S));
Writeln(FloatToStr(L));
ColorToHSL(255, H, S, L);
Writeln(FloatToStr(H));
Writeln(FloatToStr(S));
Writeln(FloatToStr(L));
end.


I forgot I have the other thread, I'll move this there…

Sumilion

2008-10-28 12:14:52

From: n3ss3s
The laziness factor, IS, NOT, AMUSED.


with arRockRecords[lumbridge_Coal] do
begin
Name := 'Coal';
UpText := 'Mine';
MaxDist := 13;
MinCount := 5;
Color := 2372661;
HueMod := 0.15;
SatMod := 0.09;
LumTol := 7;
MinR := 31; MaxR := 74;
MinG := 31; MaxG := 74;
MinB := 21; MaxB := 51;
MinX := 1.24; MaxX := 5.73;
MinY := 1.38; MaxY := 6.43;
MinZ := 0.94; MaxZ := 3.97;
end;

From Mining.scar, your script is fucked if you did that much effort for it :p

This I likes,


program New;

Var
H, S, L: Extended;
begin
ColorToHSL(0, H, S, L);
Writeln(FloatToStr(H));
Writeln(FloatToStr(S));
Writeln(FloatToStr(L));
ColorToHSL(255, H, S, L);
Writeln(FloatToStr(H));
Writeln(FloatToStr(S));
Writeln(FloatToStr(L));
end.


I forgot I have the other thread, I'll move this there…


You might not like it but it works great for me :p

Naum

2008-10-28 14:31:40

And me, except it stops after every 3 loads :)

Sumilion

2008-10-28 15:22:02

I doubt it is the rock finder if it stops after 3 loads exactly everytime ;)

Naum

2008-10-30 07:23:33

;). I dunno that try - except thingy does my head in trying to figure out why my script stops