SRL Archive - SRL Archives

getfallyroadcolor, using L*A*B Color


SKy Scripter

2007-06-23 00:45:37

Check Out these L*A*B Functions….

L*A*B Auto Color is very cool…
dont yell at me lol it might not work……


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

procedure XYZtoLab(X, Y, Z : Extended; var L, A, B : Extended);
begin
try
L := 10 * Sqrt( Y );
A := 17.5 * ((( 1.02 * x) - y) / Sqrt( Y ));
B := 7 * ((Y - (0.847 * Z)) / Sqrt( Y ));
except
Writeln('ERROR: Math ERROR');
end;
end;

procedure LabToXYZ(L, A, B : Extended; var X, Y, Z : Extended);
begin
try
Y := Pow(L / 10, 2);
X := ((A / 17.5 * L / 10) + Y) / 1.02;
Z := -((B / 7 * L / 10) - Y) / 0.847;
except
Writeln('ERROR: Math ERROR');
end;
end;

procedure ColorToLab(Color : Integer; var L, A, B : Extended);
var
X, Y, Z : Extended;
begin
ColortoXYZ(Color, X, Y, Z);
XYZtoLab(X, Y, Z, L, A, B);
end;

function LabToColor(L, A, B : Extended) : Integer;
var
X, Y, Z : Extended;
begin
LabToXYZ(L, A, B, X, Y, Z);
Result := XYZtoColor(X, Y, Z);
end;





function GetFallyRoadColor : Integer;
var
P : TPointArray;
i, Color, Sx, Sy : integer;
L, A, B : Extended;
begin
sx := MMCX;
sy := MMCY;
If (FindColorSpiralTolerance(sx, sy, 6518140, MMX1, MMY1, MMX2, MMY2, 70)) then
If (rs_OnMinimap(sx, sy)) then
begin
FindColorsSpiralTolerance(sx, sy, P, 6518140, MMX1, MMY1, MMX2, MMY2, 70);
for i := 0 to GetArrayLength(P)-1 do
begin
If (rs_OnMinimap(P[i].x, P[i].y)) then
begin
Color := GetColor(P[i].x, P[i].y);
if (Color < 1) then Color := 1;
ColortoLab(Color, L, A, B);
If (B < 0.0) and (B > -8.0) and (A < 25)then
begin
Result := Color;
Writeln('Found Fally Road Color = ' + IntToStr(Result));
Exit;
end;
end;
end;
end;
end;


begin
SetupSRL;
FindRS;
ActivateClient;
Wait(1000);
GetFallyRoadColor;
//Writeln(inttostr(GetBankColor));
end.

Santa_Clause

2007-06-23 02:07:38

Autocolour…:p

Sweet, not sure if it'll work though because I ain't 1337 enough to…;)

P.S - Catching up on post count!

nielsie95

2007-06-23 03:15:35

Nice, works good when the road is visible..
But when it isn't visible it results the wrong color for me.

SKy Scripter

2007-06-23 03:30:22

P.S - Catching up on post count!


agh… i sorta got over the post count thing awhile back…


Nice, works good when the road is visible..
But when it isn't visible it results the wrong color for me.


thanks, it could be fixed by getting the range of the lum.. but its ok… XD

Bobarkinator

2007-06-24 14:05:57

I thought the color had to be on the screen anyways lol?

Edit: Oops that was 1k posts, I need to make a thread.

Abyssal

2007-06-24 21:58:55

[OFFTOPIC]

From: bobarkinator
I thought the color had to be on the screen anyways lol?

Edit: Oops that was 1k posts, I need to make a thread.


*finds thread*

[/OFFTOPIC]

Nice work, btw. What's LAB?

Bobarkinator

2007-06-24 23:01:22

Lol no thread yet, probably tonight.

SKy Scripter

2007-06-25 00:07:04

Nice work, btw. What's LAB?


L*A*B

Enjoy….

the scar noob

2007-06-26 14:54:30

From: SKy Scripter
L*A*B

Enjoy….


i don't understand that :D