SCAR Code:
program TutRunner;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/users.scar}
{.include SRL/SRL/skill/Smithing.scar}
{.include SRL/SRL/skill/Fighting.scar}
const
Arrow = 3585227;
ArrowMap = 2357498;
DoneBar = 10118512;
Tree = 2634566;
XpTab = 2910245;
RoadScreen = 6649727;
Fire = 7720182;
Range = 1319581;
FenceMap = 15396332;
Furnace = 2242984;
Rat = 7963523;
var
x, y, i, n, b: integer; // Misc
RoadColour: integer;
function W(Waiter:integer): Boolean;
begin
Wait(Waiter + Random(1000));
end;
function Chooser(UpText, ChooseText: string): Boolean;
begin
n := 0;
repeat
if (FindColorTolerance(x, y, Arrow, 2, 2, 500, 400, 5)) then
begin
MMouse(x, y + 20 + Random(10), 5, 5);
if (IsUpText(UpText)) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, False);
W(500);
if (ChooseOption(ChooseText)) then Break;
W(2000);
end;
end;
Wait(150);
n := n + 1;
until(n = 5);
W(1000);
end;
function DropMany(maxc:integer):Boolean;
begin
repeat
maxc := maxc + 1;
if (ExistsItem(maxc)) then
begin
DropItem(maxc);
W(500);
end;
until(maxc = 28);
end;
function OpenGate(name, D: string): Boolean;
begin
i := 0;
MakeCompass('N');
repeat
if (not (LoggedIn)) then Break;
if (FindColorTolerance(x, y, Arrow, 2, 2, 500, 400, 5)) then
begin
MMouse(x - 5, y + 30, 5, 5);
W(500);
if (IsUpText(name)) then
begin
Mouse(x - 5, y + 30, 5, 5, true);
W(3500);
Break;
end else
begin
MakeCompass(D);
W(1000);
end;
end;
Wait(100 + Random(100));
i := i + 1;
until(i = 20);
MakeCompass('N');
W(1000);
end;
function WalkToMap(A1, A2, A3, A4, A5:integer):Boolean;
var
a:integer;
begin
i := 0;
repeat
if (not (LoggedIn)) then Break;
if (not (RadialWalk(ArrowMap, A1, A2, A3, A4, A5))) then
begin
Wait(100+Random(100));
end else Break;
i := i + 1;
W(500);
until(i > 5);
W(1000);
end;
function FindIns:Boolean;
begin
i := 0;
Writeln('Looking for instructor to talk with...');
repeat
if (not (LoggedIn)) then Break;
if (ClickContinue(true, true)) then Break;
if (FindColorTolerance(x, y, Arrow, 2, 2, 500, 400, 5)) then
begin
MMouse(x, y+20+Random(10), 5, 5);
if (IsUpText('Talk')) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, true);
end;
W(1500);
end;
Wait(50+Random(50));
i := i + 1;
until(i = 5);
Writeln('Found instructor and engaged conversation!');
W(1000);
end;
function FinishTalk:Boolean;
begin
Writeln('Talking with instructor...');
i := 0;
repeat
if (not (LoggedIn)) then Exit;
if (not (ClickContinue(true, true))) then Break;
i := i + 1;
W(1000);
until(i = 15);
Writeln('Finished talking with instructor!');
W(1000);
end;
// Introducer
procedure StepOne;
begin
if (not (LoggedIn)) then Exit;
FinishTalk;
FindIns;
FinishTalk;
// Click the Option Tab
W(1000);
Mouse(674, 483, 5, 5, true);
W(2000);
FindIns;
FinishTalk;
// Walk out of door
OpenGate('Door', 'E');
Writeln('Step one complete!');
Writeln(' ');
end;
// Woodcutting/Fishing
procedure StepTwo;
begin
// Walk To next instructor
WalkToMap(90, 270, 70, 1, -1);
i := 0;
repeat
FindIns;
FinishTalk;
// Backpack
Writeln('Wieving backpack...');
Mouse(642, 185, 5, 5, true);
W(1000);
i := i + 1;
if (InvCount = 2) then Break;
until(i = 5);
// Chop Tree
Writeln('Chopping trees...');
i := 0;
repeat
if (not (LoggedIn)) then Break;
if (i = 30) then Break;
x := 240;
y := 180;
if (FindColorSpiralTolerance(x, y, Tree, 2, 2, 500, 400, 5)) then
begin
MMouse(x+5, y-30, 5, 5);
if (IsUpText('Tree')) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, true);
end;
W(5000);
end;
Wait(100+Random(100));
i := i + 1;
until(InvCount = 4);
W(1000);
DropMany(4);
i := 0;
// Check if leveled up.
repeat
if (not (LoggedIn)) then Break;
ClickContinue(true, true);
i := i + 1;
if (not (ClickContinue(true, true))) then Break;
until(i = 6);
W(500);
i := 0;
// Walk to empty spot and light a fire
Writeln('Lightning a fire...');
repeat
if (not (LoggedIn)) then Break;
x := 240+20;
y := 180+20;
if (FindColorSpiraltolerance(x, y, RoadScreen, 2, 2, 500, 400, 5)) then
begin
Mouse(x, y, 5, 5, true);
W(2000);
end;
MouseItem(2, true);
W(500);
MouseItem(3, true);
W(500);
i := i + 1;
if (InvCount = 3) then Break;
until(i = 30);
W(10000);
Mouse(245+Random(20), 435, 3, 3, true);
// Open XpTab
Writeln('Opening XpTab...');
Mouse(576, 187, 5, 5, true);
W(1000);
FindIns;
FinishTalk;
// Walk to fishing spot
Writeln('Walking to fishing spot...');
WalkToMap(90, 270, 60, 1, -1);
// Start fishing
writeln('Beginning to fish...');
repeat
if (not (LoggedIn)) then Break;
if (Invcount = 6) then Break;
if FindObjCustom(x, y, ['Net', 'et F', 't Fi'], [12828090, 11182231], 3) then
begin
Mouse(x, y, 5, 5, true);
i := 0;
W(8000);
i := i + 1;
end;
until(i = 20);
DropMany(6);
// Walk to empty spot and light a fire
x := 240+20;
y := 180+20;
Writeln('Lightning fire...');
repeat
if (not (LoggedIn)) then Break;
if (FindColorSpiraltolerance(x, y, RoadScreen, 2, 2, 500, 400, 5)) then
begin
Mouse(x, y, 5, 5, true);
W(2000);
end;
MouseItem(2, true);
W(500);
MouseItem(4, true);
W(500);
i := i + 1;
if (InvCount = 5) then Break;
until(i = 30);
W(10000);
Mouse(245+Random(20), 435, 3, 3, true);
W(500);
// Cook fish
i := 0;
n := 5;
Writeln('Cooking shrimps...');
repeat
if (not (LoggedIn)) then Break;
if (FindColorTolerance(x, y, ArrowMap, 530, 4, 700, 160, 5)) then Break;
if (not (ExistsItem(n))) then n := n + 1;
x := 240;
y := 180;
if (FindColorSpiralTolerance(x, y, Fire, 2, 2, 500, 400, 5)) then
begin
MouseItem(n, true);
W(1000);
Mouse(x, y, 3, 3, true);
W(2000);
end;
Wait(200+Random(100));
i := i + 1;
until(i = 10);
Mouse(245+Random(20), 435, 3, 3, true);
// Walk to gate
Writeln('Walking to gate...');
WalkToMap(180, 360, 65, 1, 1);
// Open Gate
OpenGate('ate', 'E');
Writeln('Step Two Completed!');
Writeln(' ');
W(1000);
end;
// Cook
procedure StepThree;
begin
WalkToMap(0, 360, 70, 1, 1);
OpenGate('oor', 'E');
repeat
if (InvCount = 7) then Break;
FindIns;
FinishTalk;
i := i + 1;
W(500);
until(i = 5);
i := 0;
repeat
if (InvCount = 8) then Break;
MouseItem(6, true);
W(1000);
MouseItem(7, true);
W(1000);
until(i = 5);
WalkToMap(90, 270, 50, 0, -1);
i := 0;
repeat
MouseItem(8, true);
W(1000);
MakeCompass('S');
if (FindColorTolerance(x, y, Range, 2, 2, 500, 400, 5)) then
begin
Mouse(x, y, 3, 3, true);
W(8000);
MouseItem(8, false);
W(500);
ChooseOption('rop');
W(500);
end;
i := i + 1;
if (InvCount = 7) then Break;
until(i = 6);
MakeCompass('N');
Mouse(252+Random(20), 433, 5, 5, true);
W(1000);
Mouse(742, 483, 5, 5, true);
W(1000);
WalkToMap(360, 90, 50, 1, 1);
OpenGate('oor', 'E');
Mouse(710, 483, 5, 5, true);
W(500);
Mouse(566+Random(130), 218+Random(200), 5, 5, true);
W(1000);
SetRun(true);
end;
// Quest-instructor
procedure StepFour;
begin
RoadColour := FindWaterColor;
RadialWalk(RoadColour, 270, 360, 80, 1, 1);
W(2000);
RadialWalk(RoadColour, 0, 10, 70, 1, 0);
W(2000);
RadialWalk(RoadColour, 90, 0, 70, 1, 0);
W(2000);
WalkToMap(0, 180, 70, -1, -1);
W(500);
OpenGate('oor', 'S');
WalkToMap(90, 270, 70, 1, 1);
FindIns;
FinishTalk;
Mouse(610, 186, 5, 5, true);
W(1500);
FindIns;
FinishTalk;
OpenGate('adder', 'S');
end;
// The Mine
procedure StepFive;
begin
RunAway('n', True, 3, 2000+Random(200));
WalkToMap(0, 360, 65, 1, 1);
// Talk to instructor
FindIns;
FinishTalk;
// Prospect tin
WalkToMap(0, 360, 65, 1, 1);
Chooser('Mine', 'Prospect');
W(1500);
// Prospect copper
WalkToMap(0, 360, 65, 1, 1);
Chooser('Mine', 'Prospect');
W(1500);
// Talk to instructor
repeat
if (InvCount = 8) then Break;
WalkToMap(0, 360, 60, 1, 1);
FindIns;
FinishTalk;
until(i = 5);
// Mine tin
i := 0;
repeat
if (InvCount = 9) then Break;
WalkToMap(0, 360, 60, 1, 1);
Chooser('Mine', 'Mine');
W(1500);
until(i = 5);
// Mine copper
i := 0;
repeat
if (InvCount = 10) then Break;
WalkToMap(0, 360, 60, 1, 1);
Chooser('Mine', 'Mine');
W(1500);
until(i = 5);
// Smelt Bronze bar
i := 0;
repeat
if (InvCount = 9) then Break;
WalkToMap(0, 360, 60, -1, -1);
MouseItem(9, true);
W(1000);
Chooser('urnace', 'se');
W(1500);
Mouse(233+Random(25), 432, 2, 2, true);
W(500);
i := i + 1;
until(i = 5);
i := 0;
// Talk to instructor to get hammer
repeat
if (InvCount = 10) then Break;
WalkToMap(0, 360, 65, 1, 1);
FindIns;
FinishTalk;
i := i + 1;
until(i = 5);
// Make dagger
i := 0;
repeat
WalkToMap(0, 360, 60, -1, -1);
W(500);
MouseItem(9, true);
W(500);
Chooser('Use', 'Use');
SmithItem('Dagger', '1');
W(1000);
Mouse(233+Random(25), 432, 2, 2, true);
MMouseItem(9);
i := i + 1;
if (IsUpText('ield')) then Break;
until(i = 5);
// Walk out of area
WalkToMap(0, 360, 65, -1, 0);
OpenGate('ate', 'E');
end;
// Combat
procedure StepSix;
begin
// Talk to instructor
WalkToMap(0, 360, 60, 1, 1);
FindIns;
FinishTalk;
// Gametab 6
Mouse(672, 187, 5, 5, true);
W(1000);
Mouse(611, 428, 5, 5, true);
W(1000);
// Equip Dagger
MouseItem(9, true);
W(500);
Mouse(491, 45, 3, 3, true);
// Talk to instructor
FindIns;
FinishTalk;
GameTab(4);
W(750);
// Equip Sword and shield
MouseItem(9, true);
W(500);
MouseItem(11, true);
W(1000);
// Gametab 1
Mouse(541, 183, 5, 5, true);
W(750);
// Go kill rat
b := 0;
repeat
// Enter cage
WalkToMap(0, 360, 60, 1, 1);
OpenGate('ate', 'E');
WalkToMap(0, 360, 60, 1, 1);
// Look for rat to attack
RunAway('E', True, 3, 2000+Random(200));
i := 0;
repeat
x := 240;
y := 180;
// Look and see if it's fighting
if (FindColorSpiralTolerance(x, y, Rat, 2, 2, 500, 400, 5)) AND not (IsFightAt(x, y)) then
begin
// Attack
MMouse(x, y, 3, 3);
if (IsUpText('ttack')) then Mouse(x, y, 3, 3, true);
n := 0;
if (InFight) then Break;
end;
W(250);
until(i = 10);
repeat
W(500);
if (not (InFight)) then Break;
until(n = 20);
RunAway('W', True, 3, 2000+Random(200));
MakeCompass('E');
SetAngle(False);
repeat
MMouse(Random(500), Random(400), 3, 3);
GetMousePos(x, y);
if (IsUpText('Gate')) then
begin
Mouse(x, y, 3, 3, true);
W(1000);
Break;
end;
until(false);
SetAngle(True);
MakeCompass('N');
WalkToMap(0, 360, 60, 1, 1);
FindIns;
FinishTalk;
if (InvCount = 14) then Break;
b := b + 1;
until(b = 20);
MouseItem(13, true);
W(500);
MouseItem(14, true);
W(500);
// Shoot rat
RunAway('S', True, 3, 2000+Random(200));
i := 0;
repeat
x := 240;
y := 180;
// Look and see if it's fighting
if (FindColorSpiralTolerance(x, y, Rat, 2, 2, 500, 400, 5)) AND not (IsFightAt(x, y)) then
begin
// Attack
MMouse(x, y, 3, 3);
if (IsUpText('ttack')) then Mouse(x, y, 3, 3, true);
end;
W(250);
until(i = 10);
end;
begin
ActivateClient;
ClearDebug;
SetupSRL;
SetAngle(True);
// Introducer
if (not (TabExists(11))) then StepOne;
// Woodcutting/Fishing
if (not (TabExists(2 ))) then StepTwo;
// Cook
if (not (TabExists(12))) then StepThree;
// Quest
if (not (TabExists(3 ))) then StepFour;
// Mining/Smithing
StepFive;
// Combat
StepSix;
end.