SCAR Code:
{------------------------------------------------------------------------------]
[ function AutoColorCookeryFloor: Integer; ]
[ by: Itschris917 ]
[ Description: Returns current color of cookery floor. ]
{------------------------------------------------------------------------------}
function AutoColorCookeryFloor: Integer;
var
R,G,B : Integer;
H,S,L : Extended;
X,Y,Z : Extended;
MyColor, TestColor : Integer;
TPA : TPointArray;
C1 : TIntegerArray;
i, C2 : Integer;
begin
MyColor := 3098460;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
C1 := GetColors(TPA);
C2 := Length(C1) -1;
for i := 0 to C2 do
begin
if RS_OnMinimap(TPA[i].X, TPA[i].Y) then
begin
TestColor := GetColor(TPA[i].X, TPA[i].Y);
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
ColorToXYZ(TestColor, X, Y, Z);
if InRange(R - G, 1, 41) then
if InRange(R - B, 25, 65) then
if InRange(G - B, 4, 44) then
if InRange(Round(S) - Round(H), 8, 38) then
if InRange(Round(L) - Round(H), 3, 33) then
if InRange(Round(S) - Round(L), -10, 20) then
if InRange(Round(X) - Round(Y), -7, 7) then
if InRange(Round(Y) - Round(Z), -4, 10) then
if GetColor(TPA[i].X + 2, TPA[i].Y + 2) = TestColor then
if GetColor(TPA[i].X + 1, TPA[i].Y + 1) = TestColor then
begin
Writeln('MyColor = '+Inttostr(TestColor));
Result := TestColor;
Exit;
end;
end;
end;
end;
Writeln('Couldnt find My Color!');
Result := 0;
end;
{------------------------------------------------------------------------------]
[ function CheckIfWeLeft: Boolean; ]
[ by: Itschris917 ]
[ Description: Checks if the player left the cooking house. ]
{------------------------------------------------------------------------------}
function CheckIfWeLeft:Boolean;
begin
x := MMCX;
y := MMCY - 4;
Result := GetColor(x, y) = AutoColorCookeryFloor;
if Result then
begin
Writeln('We have not left. Open the door.');
//open door.
end else
Writeln('We have left. Door was open.');
end;
{------------------------------------------------------------------------------]
[ procedure ToBank; ]
[ by: Itschris917 ]
[ Description: Walks player back to bank. ]
{------------------------------------------------------------------------------}
procedure ToBank;
var
rx, ry: Integer;
angle: Extended;
begin
if not LoggedIn then Exit;
if FindSymbol(rx, ry, 'bank') then
begin
MFNF(rx, ry, 4, 4);
while FlagPresent do
Randoms;
CheckIfWeLeft;
Players[CurrentPlayer].Loc:= 'Bank';
MakeCompass('N');
end
else
if FindDTMRotated(VEB,x,y,MMX1,MMY1,MMX2,MMY2,-1.0,2.0,0.5,angle) then
begin
MFNF(x + 3, y - 5, 2, 2);
while FlagPresent do
Randoms;
CheckIfWeLeft;
Players[CurrentPlayer].Loc:= 'Bank';
MakeCompass('N');
end;
end;