SCAR Code:
program New;
{.include srl/srl.scar}
procedure Confirm;
begin
Wait(RandomRange(700, 1200));
MouseBox(384, 237, 503, 278, 1);
end;
function FindChest: boolean;
var
x, y, i, j: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, 4348001, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := SplitTPA(TPA, 15);
for i := 0 to High(ATPA) do
begin
for j := 0 to 3 do
begin
if MiddleTPAEX(ATPA[i], x, y) then
MMouse(x, y, 3, 3);
if IsUpText('hest') then
begin
GetMousePos(x, y);
ClickMouse(x, y, False);
Wait(RandomRange(1000, 1500));
if ChooseOption('pen') then Result := True;
if Result then Exit;
end;
end;
end;
end;
function FindPortal: boolean;
var
x, y, i, j: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, 6663573, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := SplitTPA(TPA, 15);
for i := 0 to High(ATPA) do
begin
for j := 0 to 3 do
begin
if MiddleTPAEX(ATPA[i], x, y) then
MMouse(x, y, 3, 3);
if IsUpText('ortal') then
begin
GetMousePos(x, y);
ClickMouse(x, y, False);
Wait(RandomRange(1000, 1500));
if ChooseOption('ortal') then Result := True;
if Result then Exit;
end;
end;
end;
end;
procedure ClickArrow(Times, Col: integer; How: Boolean); //How: True = up, False = down
var
x1, x2, y1, y2, i: integer;
begin
case Col of
1: if How then
begin
x1 := 106; y1 := 11; x2 := 147; y2 := 39;
end else
begin
x1 := 106; y1 := 302; x2 := 147; y2 := 320;
end;
2: if How then
begin
x1 := 193; y1 := 11; x2 := 236; y2 := 39;
end else
begin
x1 := 193; y1 := 302; x2 := 236; y2 := 320;
end;
3: if How then
begin
x1 := 283; y1 := 11; x2 := 327; y2 := 39;
end else
begin
x1 := 283; y1 := 302; x2 := 327; y2 := 320;
end;
end;
for i := 0 to Times - 1 do
begin
Wait(RandomRange(100, 200));
MouseBox(x1, y1, x2, y2, 1);
end;
end;
function MachineBox(i :Integer): TBox;
{
_____ _____ _____
| 1 | 4 | 7 |
|_____|_____|_____|
| 2 | 5 | 8 |
|_____|_____|_____|
| 3 | 6 | 9 |
|_____|_____|_____|
}
var
x1, x2, y1, y2: integer;
begin
case i of
1: begin x1 := 90; x2 := 175; y1 := 45; y2 := 125; end;
2: begin x1 := 90; x2 := 175; y1 := 125; y2 := 210; end;
3: begin x1 := 90; x2 := 175; y1 := 210; y2 := 290; end;
4: begin x1 := 175; x2 := 260; y1 := 45; y2 := 125; end;
5: begin x1 := 175; x2 := 260; y1 := 125; y2 := 210; end;
6: begin x1 := 175; x2 := 260; y1 := 210; y2 := 290; end;
7: begin x1 := 260; x2 := 345; y1 := 45; y2 := 125; end;
8: begin x1 := 260; x2 := 345; y1 := 125; y2 := 210; end;
9: begin x1 := 260; x2 := 345; y1 := 210; y2 := 290; end;
end;
Result.x1 := x1;
Result.x2 := x2;
Result.y1 := y1;
Result.y2 := y2;
end;
procedure Chest_Analyze(Col: integer);
{
______
| |
| | coins
|______|
| |
| | bowl
|______|
| |
| | bar
|______|
ring
This function is serching for bar, combination is always the same.
}
var
Time, i, j, x, y, Slot: integer;
B: TBox;
BBreak: boolean;
begin
case Col of
1: i := 1;
2: i := 4;
3: i := 7;
end;
MarkTime(Time);
repeat
for j := i to i + 2 do
begin
B := MachineBox(j);
if FindColoredAreaTolerance(x, y, 1074825, B.x1, B.y1, B.x2, B.y2, 100, 10) then
begin
Slot := j;
BBreak := True;
// WriteLn(inttostr(j));
end;
end;
until (TimeFromMark(Time) > 5000) or BBreak;
if InRange(i, 4, 6) then Slot := Slot - 3;
if InRange(i, 7, 9) then Slot := Slot - 6;
case slot of
1: ClickArrow(1, Col, True);
2: case Random(1) of
0: ClickArrow(2, Col, True);
1: ClickArrow(2, Col, False);
end;
3: ClickArrow(1, Col, False);
end;
end;
procedure SolveChestRandom;
var
i, x, y: integer;
begin
SetAngle(False);
// FindChest;
FindObj(x, y, 'hest', 7510440, 10);
Mouse(x, y, 0, 0, True);
Wait(RandomRAnge(1200, 1700));
SetAngle(True);
ClickToContinue;
Wait(RandomRAnge(700, 1200));
FindNPCChatText('try', ClickLeft);
Wait(RandomRAnge(700, 1200));
ClickToContinue;
for i := 1 to 3 do
begin
Wait(RandomRAnge(700, 1200));
Chest_Analyze(i);
end;
Confirm;
for i := 0 to 2 do ClickToContinue;
FindPortal;
end;
begin
setupsrl;
activateclient;
SolveChestRandom;
end.