SCAR Code:
program New;
{.include SRL/SRL.scar}
var
GemColor, GemTolerance: Integer;
function LoadGemDDTM: Integer;
var
GemDDTM: TDTM;
GemMain: TDTMPointDef;
GemSubs: Array of TDTMPointDef;
begin
SetLength(GemSubs, 5);
GemMain.x := 331;
GemMain.y := 77;
GemMain.AreaSize := 1;
GemMain.AreaShape := 0;
GemMain.Color := GemColor;
GemMain.Tolerance := GemTolerance;
GemSubs[0].x := 329;
GemSubs[0].y := 68;
GemSubs[0].AreaSize := 1;
GemSubs[0].AreaShape := 0;
GemSubs[0].Color := 65536;
GemSubs[0].Tolerance := 0;
GemSubs[1].x := 338;
GemSubs[1].y := 76;
GemSubs[1].AreaSize := 1;
GemSubs[1].AreaShape := 0;
GemSubs[1].Color := 65536;
GemSubs[1].Tolerance := 0;
GemSubs[2].x := 335;
GemSubs[2].y := 89;
GemSubs[2].AreaSize := 1;
GemSubs[2].AreaShape := 0;
GemSubs[2].Color := 65536;
GemSubs[2].Tolerance := 0;
GemSubs[3].x := 323;
GemSubs[3].y := 88;
GemSubs[3].AreaSize := 1;
GemSubs[3].AreaShape := 0;
GemSubs[3].Color := 65536;
GemSubs[3].Tolerance := 0;
GemSubs[4].x := 319;
GemSubs[4].y := 78;
GemSubs[4].AreaSize := 1;
GemSubs[4].AreaShape := 0;
GemSubs[4].Color := 65536;
GemSubs[4].Tolerance := 0;
GemDDTM.MainPoint := GemMain;
GemDDTM.SubPoints := GemSubs;
Result := AddDTM(GemDDTM);
end;
function CutGem(Amount, GemType: String; MaxTime: Integer): Boolean;
var
GemDTM, GemDTM2, i, x, y, Cx, Cy, Waiting, Waiting2, Chisel: Integer;
Forced, Typing: Boolean;
GemText: Array of String;
GemCol: Array of Integer;
begin
GemTolerance := 50;
Forced := False;
Typing := False;
case LowerCase(GemType) of
'any', 'all': begin
GemColor := 0;
GemTolerance := 255;
end;
's', 'sapphire': GemColor := 7212812;
'e', 'emerald': GemColor := 944396;
'r', 'ruby': GemColor := 726649;
'd', 'diamond': GemColor := 11316660;
end;
GemDTM := LoadGemDDTM;
Chisel := DTMFromString('78DA63CC66626078CE8002ACD419184480342' +
'310FF0702C642A09A1B0C6880118904D2C54035F708A8C902AAF9' +
'40404D0A50CD7B026AD2806A5EE357030003840C79');
While FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2) do
begin
if not LoggedIn then Break;
if Typing then Break;
if not FindDTM(Chisel, Cx, Cy, MIX1, MIY1, MIX2, MIY2) then
Break;
MMouse(Cx, Cy, 5, 5);
Wait(200 + Random(100));
GetMousePos(Cx, Cy);
if IsUpText('hisel') then
Mouse(Cx, Cy, 0, 0, True)
else Writeln('no uptext');
Wait(250 + Random(250));
if not FindColorSpiral(Cx, Cy, 16777215, Cx - 30, Cy - 30, Cx + 30, Cy + 30) then
Break; //Just a check that we clicked it succesfully.
Mouse(x, y, 5, 5, True)
GemTolerance := 20;
GemText := ['app', 'mer', 'uby', 'iam'];
GemCol := [8065038, 944396, 726649, 11316660]
for i := 0 to 3 do
if IsUpText(GemText[i]) then
begin
GemColor := GemCol[i];
Break;
end;
if Forced then
FreeDTM(GemDTM2);
GemDTM2 := LoadGemDDTM;
Forced := True;
Wait(500 + Random(500));
if GetColor(36, 373) = 9343516 then //Do we have more than 1 gem.
begin
Mouse(256, 411, 10, 10, False) //Co-ords of middle of invent screen
Wait(500 + Random(500));
case LowerCase(Amount) of
'all': begin
ChooseOption('All');
Typing := False;
end;
else
begin
Typing := True;
ChooseOption('X');
Wait(500 + Random(500));
TypeSend(Amount);
end;
end;
MarkTime(Waiting);
MarkTime(Waiting2);
while TimeFromMark(Waiting2) < MaxTime do
begin
Wait(250 + Random(250));
if not FindDTM(GemDTM2, x, y, MIX1, MIY1, MIX2, MIY2) then
Break;
if TimeFromMark(Waiting) > 10000 + Random(5000) then
begin
MMouse(RandomRange(0, 700), RandomRange(0, 500), 25, 25);
MarkTime(Waiting);
end;
ClickContinue(True, True);
end;
Wait(250 + Random(250));
end else
Wait(750 + Random(500));
end;
if not Typing then
Result := not FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2)
else
Result := True;
if Forced then
FreeDTM(GemDTM2);
FreeDTM(GemDTM);
FreeDTM(Chisel);
end;
begin
SetupSRL;
CutGem('1', 'sapphire', 15000);
CutGem('all', 'all', 15000);
end.