SCAR Code:
program CraftingGuildClayMiner;
{.include SRL/SRL/misc/SMART.scar}
{.include SRL/SRL.scar}
var
x, y, sx, sy, GasWaits:integer;
YTreeDTM:Integer;
TreeMP: TDTMPointDef;
TreeSP: array[0..3] of TDTMPointDef;
TreeDTMSkel: TDTM;
const
RunDirection = 'N';//N = North, E = East, S = South, W = West
//this is the direction to run, if your in a fight
SmartWorld = 119;//What world to load smart in
Signed = True; //False = unsigned, slower and for multiplayer
//True = signed, faster and for 1 player only
MiningWait = 5000; // Max time to mine on 1 rock
// In MILIseconds (1000 miliseconds = 1 second)
procedure LoadTreeDDTM;
Begin
TreeMP.x:=744;
TreeMP.y:=234;
TreeMP.areasize:=0;
TreeMP.areashape:=0;
TreeMP.color:=2383683;
TreeMP.tolerance:=255;
TreeSP[0].x:=753;
TreeSP[0].y:=237;
TreeSP[0].areasize:=0;
TreeSP[0].areashape:=0;
TreeSP[0].color:=2122292;
TreeSP[0].tolerance:=255;
TreeSP[1].x:=735;
TreeSP[1].y:=244;
TreeSP[1].areasize:=0;
TreeSP[1].areashape:=0;
TreeSP[1].color:=2122292;
TreeSP[1].tolerance:=255;
TreeSP[2].x:=749;
TreeSP[2].y:=224;
TreeSP[2].areasize:=0;
TreeSP[2].areashape:=0;
TreeSP[2].color:=2122292;
TreeSP[2].tolerance:=255;
TreeSP[3].x:=740;
TreeSP[3].y:=233;
TreeSP[3].areasize:=0;
TreeSP[3].areashape:=0;
TreeSP[3].color:=1725476;
TreeSP[3].tolerance:=255;
TreeDTMSkel.MainPoint:=TreeMP;
TreeDTMSkel.SubPoints:=TreeSP;
YTreeDTM:=AddDTM(TreeDTMSkel);
End;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //username
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3-4 letters from your username
Players[0].Active := true;
end;
Procedure FindFightEx;
Begin
If(FindFight) then
Begin
Status('Fight found!');
Writeln('Our player is being attacked!')
Writeln('Lets run away!')
Begin
Status('Running away!');
WriteLn('Running....')
RunAway(RunDirection,False,1,8000+Random(3000))
WriteLn('Successfully ran away from fight!')
end;
end;
end;
procedure Antirandoms;
var
i : Integer;
Begin
Status('Doing AntiRandoms');
for i := 0 to 3 do
begin
FindNormalRandoms;
FindFightEx;
FindNonInventoryRandoms;
wait(1)
end;
end;
// BY Starblaster
function FindObjCustom2(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tolerance: Integer): Boolean;
var
a, b, c, i, x1, y1, x2, y2: Integer;
Start: Boolean;
begin
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], MSX1, MSY1, MSX2, MSY2, Tolerance)) then
begin
Start := True;
Break;
end;
end;
if(Start)then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if not(LoggedIn)then break;
a := a + 1;
if (a = 1) then
c := c + 1
else if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], x1, y1, x2, y2, tolerance)) then
begin
MMouse(cx, cy, 3, 3);
Wait(5+Random(10));
if (IsUpTextMultiCustom(Text)) then
begin
Result := True;
Exit;
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;
procedure WalkFirstClick;
begin
if radialWalk(findFallyRoadColor,172,200,60,2,2) then
begin
writeln('We walked');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('We could not walk :S, switching players');
nextplayer(false);
end;
end;
procedure WalkSecondClick;
begin
if radialWalk(findFallyRoadColor,170,230,60,2,2) then
begin
writeln('We walked');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
WalkFirstClick;
Antirandoms;
WalkSecondClick;
end;
end;
procedure WalkThirthClick;
begin
if radialWalk(findRoadColor,155,220,60,2,2) then
begin
writeln('we walked near the yews:)');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findFallyRoadColor,160,230,60,2,2);
Antirandoms;
WalkThirthClick;
end;
end;
procedure WalkFourthClick;
begin
if radialWalk(findRoadColor,175,230,60,2,2) then
begin
writeln('We walked');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,170,240,60,2,2);
Antirandoms;
WalkFourthClick;
end;
end;
procedure WalkFifthClick;
begin
if radialWalk(findRoadColor,175,230,60,2,2) then
begin
writeln('Coming near crossroads');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,170,240,60,2,2);
Antirandoms;
WalkFifthClick;
end;
end;
procedure WalkSixthClick;
begin
if radialWalk(findRoadColor,235,275,60,2,2) then
begin
writeln('Turning left');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,175,240,60,2,2);
Antirandoms;
WalkSixthClick;
end;
end;
procedure WalkSeventhClick;
begin
if radialWalk(findRoadColor,265,285,60,2,2) then
begin
writeln('Walking to second crossroads');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,250,285,60,2,2);
Antirandoms;
WalkSeventhClick;
end;
end;
procedure WalkEightClick;
begin
if radialWalk(findRoadColor,280,320,60,2,2) then
begin
writeln('Walking up');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,250,290,60,2,2);
Antirandoms;
WalkEightClick;
end;
end;
procedure Walk9thClick;
begin
if radialWalk(findRoadColor,280,320,60,2,2) then
begin
writeln('Still walking up');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,275,330,60,2,2);
Antirandoms;
Walk9thClick;
end;
end;
procedure Walk10thClick;
begin
if radialWalk(findRoadColor,285,345,60,2,2) then
begin
writeln('Look! We can see the crafting guild!');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,270,330,60,2,2);
Antirandoms;
Walk10thClick;
end;
end;
procedure Walk11thClick;
begin
if radialWalk(findRoadColor,245,290,60,2,2) then
begin
writeln('Walking down to Crafting guild!');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,280,350,60,2,2);
Antirandoms;
Walk11thClick;
end;
end;
procedure Walk12thClick;
begin
if radialWalk(findRoadColor,165,230,60,2,2) then
begin
writeln('YAY, we walked succesfully to the crafting guild!');
Antirandoms;
fflag(0);
Antirandoms;
wait(1000+random(300));
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,240,300,60,2,2);
Antirandoms;
Walk12thClick;
end;
end;
procedure WalkToCraftingGuild;
begin
setrun(true);
WalkFirstClick;
WalkSecondClick;
WalkThirthClick;
WalkFourthClick;
WalkFifthClick;
WalkSixthClick;
WalkSeventhClick;
WalkEightClick;
Walk9thClick;
Walk10thClick;
Walk11thClick;
Walk12thClick;
end;
procedure OpenTheDoor;
begin
if FindObjCustom2(x, y, ['oor'], [2122625, 4548473, 5862274],10) then
begin
mouse(x,y,2,2,true);
writeln('We succesfully opened the door!');
Antirandoms;
fflag(0);
Antirandoms;
wait(500+random(300));
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could NOT find the door.. switching players:(');
nextplayer(false);
end;
end;
Procedure WalkToOres;
begin
SymbolAccuracy := 0.5;
if FindSymbol(sx, sy, 'mining spot') then
begin
mouse(sx,sy,4,4,true);
Antirandoms;
FFlag(0);
Antirandoms;
writeln('We are near the ores now!');
end else
begin
writeln('WTF...we cant find the mining symbol:S switching players');
nextplayer(false);
end;
end;
Procedure ThereIsGas;
begin
If Not LoggedIn then exit;
WriteLn('There is gass! We are avoiding it!');
mouse(744, 292, 7,7,true);
begin
case random (100) of
0: TypeSend('i hate gasses');
1: TypeSend('hmm..a gass');
2: TypeSend('Iew..a gass!');
3: TypeSend('Let that gass blow up!');
4: TypeSend('Ill wait till that stupid gass is away');
5: TypeSend('Nooooo a gass!');
end;
end;
Fflag(0);
GasWaits:= GasWaits-GasWaits;
repeat
Antirandoms;
wait(1000);
GasWaits:= GasWaits+1;
until(GasWaits >= 30)
WriteLn('yay, we avoided the gas! Lets move on mining!');
Antirandoms;
WalkToOres;
end;
procedure FindTheGas;
begin
If Not LoggedIn then exit;
if (FindColorTolerance (x, y, 10596274, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 7373704, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 5794930, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 8886171, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 9807017, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 7636620, 0, 0, 500, 500, 1))
or (FindColorTolerance (x, y, 7900302, 0, 0, 500, 500, 1)) then ThereIsGas;
end;
procedure MiningAntiRandoms;
var
i : Integer;
Begin
Status('Doing MiningAntiRandoms');
for i := 0 to 4 do
begin
FindNormalRandoms;
FindFightEx;
FindNonInventoryRandoms;
FindTheGas;
wait(1)
end;
end;
procedure MineTheOres;
var
MiningTime: Integer;
begin
setrun(false);
repeat
if FindObjCustom2(x, y, ['ocks'], [7647183, 7317189, 7449289, 7317189],10) then
begin
mouse(x,y,2,2,true);
MarkTime(MiningTime);
MiningAntiRandoms;
wait(1000+random(800));
repeat
MiningAntiRandoms;
until (FindBlackChatMessage('nagage')) or (FindBlackChatMessage('vailable'))
or (timefrommark(MiningTime) > (MiningWait + Random(800))) or InvFull
end else
begin
writeln('WTF... we could NOT find the ores... switching players:(');
nextplayer(false);
exit;
end;
Until(invFull)
writeln('We got a full inventory:D');
end;
procedure WalkToDoor;
begin
SymbolAccuracy := 0.5;
if FindSymbol(sx, sy, 'pottery') then
begin
mouse(sx,sy,4,4,true);
Antirandoms;
FFlag(0);
Antirandoms;
writeln('We are near the door now!');
end else
begin
writeln('We could NOT find the pottery symbol, switching players');
nextplayer(False);
end;
end;
procedure Click1Back;
begin
LoadTreeDDTM;
wait(600+random(200));
if (FindDTM(YTreeDTM,x, y,MMX1,MMY1,MMX2,MMY2)) Then
begin
writeln('Walking first click back to fallador');
Antirandoms;
mouse(x,y,3,3,true);
Antirandoms;
fflag(0);
Antirandoms;
freedtm(YTreeDTM);
exit;
end else
begin
writeln('Hmm could NOT find the trees.. switching players!');
nextplayer(false);
end;
end;
procedure Click2Back;
begin
if radialWalk(findRoadColor,70,110,60,2,2) then
begin
writeln('Walking second click back!');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
Click1Back;
Antirandoms;
Click2Back;
end;
end;
Procedure Click3Back;
begin
if radialWalk(findRoadColor,130,170,60,2,2) then
begin
writeln('Walking down');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,65,100,60,2,2);
Antirandoms;
Click3Back;
end;
end;
procedure Click4Back;
begin
if radialWalk(findRoadColor,100,130,60,2,2) then
begin
writeln('Still walking down');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,125,175,60,2,2);
Antirandoms;
Click4Back;
end;
end;
procedure Click5Back;
begin
if radialWalk(findRoadColor,90,125,40,2,2) then
begin
writeln('Coming to second crossroads');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,195,175,60,2,2);
Antirandoms;
Click5Back;
end;
end;
procedure Click6Back;
begin
if radialWalk(findRoadColor,70,110,30,2,2) then
begin
writeln('Walking right');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,85,130,60,2,2);
Antirandoms;
Click6Back;
end;
end;
procedure Click7Back;
begin
if radialWalk(findRoadColor,70,110,40,2,2) then
begin
writeln('Walking right');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,85,130,30,2,2);
Antirandoms;
Click7Back;
end;
end;
procedure Click8Back;
begin
if radialWalk(findRoadColor,350,360,60,2,2) then
begin
writeln('Walking up');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,75,110,60,2,2);
Antirandoms;
Click8Back;
end;
end;
procedure Click9Back;
begin
if radialWalk(findRoadColor,350,360,60,2,2) then
begin
writeln('Walking near yews!');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,345,20,60,2,2);
Antirandoms;
Click9Back;
end;
end;
procedure Click10Back;
begin
if radialWalk(findRoadColor,350,360,60,2,2) then
begin
writeln('walking up!');
Antirandoms;
fflag(0);
Antirandoms;
exit;
end else
begin
writeln('Hmm.. we could not walk.. using failsafe');
Antirandoms;
radialWalk(findRoadColor,345,20,60,2,2);
Antirandoms;
Click9Back;
end;
end;
procedure WalkToFallyBank;
begin
Click1Back;
Click2Back;
Click3Back;
Click4Back;
Click5Back;
Click6Back;
Click7Back;
Click8Back;
Click9Back;
end;
procedure SetUpSmart;
begin
Status('Setting up SMART!');
Disguise('Setting up SMART!');
smartSetupex(SmartWorld, False, Signed);
While Not (SmartReady) Do
Wait(100);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(386, 249) = 65535) Do
Wait(100);
end;
begin
DeclarePlayers;
SetUpSmart;
SetupSRL;
loginplayer;
SetAngle(true);
MakeCompass('N');
WalkToCraftingGuild;
OpenTheDoor;
WalkToOres;
MineTheOres;
WalkToDoor;
OpenTheDoor;
WalkToFallyBank;
end.