cause
2012-01-08 03:56:47
Hello folks, for my second script ever I present:
Requirements:
Can smelt gold and silver
Can access crafting guild (40 crafting)
Brown Apron (worn)
Rune Pick (wielded or not)
BASICALLY you start it in the crafting guild right by the gold rocks and let er rip. It mines gold and silver, using objectDTM's to for locating between the two. After a full inventory is achieved, it then locates itself to the centre of the guild, rests, opens the door (thanks flight for the code), walks to the furnace using SPS, smelts (my favourite function :P), banks, walks, repeats! She ain't flawless and I don't have a report (yet), but seems fairly stable. Anything you see you don't like please leave a comment!
Also, you need the objectDTM include. (props to euphphuhpusiusm)
CraftyMiner
(oooo…..ahhhh)
(oooo…..ahhhh)
Requirements:
Can smelt gold and silver
Can access crafting guild (40 crafting)
Brown Apron (worn)
Rune Pick (wielded or not)
BASICALLY you start it in the crafting guild right by the gold rocks and let er rip. It mines gold and silver, using objectDTM's to for locating between the two. After a full inventory is achieved, it then locates itself to the centre of the guild, rests, opens the door (thanks flight for the code), walks to the furnace using SPS, smelts (my favourite function :P), banks, walks, repeats! She ain't flawless and I don't have a report (yet), but seems fairly stable. Anything you see you don't like please leave a comment!
Also, you need the objectDTM include. (props to euphphuhpusiusm)
program craftyminer;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
{$i sps/sps.simba} // has to be included after SRL
const
GOLDCOLOUR = 5296637;
SILVERCOLOUR = 15593208;
GOLDWAIT = 7000;
SILVERWAIT = 5000;
var
miningcolour, location, waiter, goldoreDTM, silveroreDTM, goldbarDTM, silverbarDTM, loadz: Integer;
PathThere, PathBack: TStringArray;
GuildtoSmelt, SmelttoBank, BanktoGuild: TPointArray;
procedure Antiban; //idea taken from Coh3n's tutorial.
begin
if not (LoggedIn) then
Exit;
begin
case Random(80) of
10: RandomMovement;
20: PickUpMouse;
30: RandomMovement;
40: BoredHuman;
50: RandomMovement;
60: BoredHuman;
69: ExamineInv;
end;
end;
end;
procedure RestUp;
begin
if not (LoggedIn) then
Exit;
begin
SetRest;
while not RunEnergy(95) do
begin
Antiban;
Wait(Random(1000));
end;
end;
end;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '337';
Players[0].Pin := '';
Players[0].Active := true;
end;
Function ChatCheck(s: string): Boolean;
var
i, l : Integer;
b : Boolean;
begin
if (Pos(s, GetBlackChatMessage) > 0)then
begin
Writeln('Checked Black Chat Message');
Result:=True;
end;
end;
Procedure SetupPaths;
begin
SmelttoBank := [ Point(3752, 3161), Point(3791, 3170), Point(3827, 3195),
Point(3863, 3204), Point(3888, 3229)];
GuildtoSmelt := [Point(3569, 3503), Point(3606, 3473), Point(3652, 3481),
Point(3698, 3497), Point(3744, 3518), Point(3782, 3499),
Point(3799, 3458), Point(3829, 3428), Point(3856, 3388),
Point(3861, 3339), Point(3864, 3293), Point(3865, 3244),
Point(3843, 3223), Point(3825, 3192), Point(3790, 3170),
Point(3757, 3162), Point(3734, 3179)];
BanktoGuild := [ Point(3859, 3219), Point(3861, 3262), Point(3866, 3310),
Point(3864, 3352), Point(3852, 3397), Point(3828, 3439),
Point(3795, 3466), Point(3779, 3507), Point(3734, 3520),
Point(3690, 3516), Point(3652, 3496), Point(3614, 3484),
Point(3570, 3497)];
goldoreDTM := DTMFromString('mlwAAAHicY2dgYFjCxsCwFIjXAvE8IJ4DxFOhbA5GBgZmIOYDYjEg5gJiJiD+D9S3a4oUkGTCio0YcANGPBgKAHYPB4I=');
silveroreDTM := DTMFromString('mrAAAAHic42BgYFBiZ2BQBWIdIFYAYiEolgRiDZA4IwODGhBrA7ExEJsCsToQKwGxCRBPmjQDaAoTTmzEgB8wEsAwAAAwKASn');
goldbarDTM := DTMFromString('mlwAAAHicY2dgYBAEYlYGCOAAYjEglgViASgfJM8NxMxQNexALALE11aBVDFhxUYMuAEjHgwFAPSzAo0=');
silverbarDTM := DTMFromString('mlwAAAHicY2dgYHBkZWBwAmJ/IPaDso2A2ByIjzAyMFwA4sNAvA+IdwHxCSA+C8Tz5y8D6mbCio0YcANGPBgKAAi9CYo=');
end;
procedure Terminator;
begin
FreeDTM(goldoreDTM);
FreeDTM(silveroreDTM);
FreeDTM(goldbarDTM);
FreeDTM(silverbarDTM);
TerminateScript;
end;
Function Smelt: boolean;
var
x, y, counter: integer;
begin
counter := 0;
if FindObjCustom(x, y, ['ace'], [3815997], 5) then
begin
wait(100 + random(250));
Mouse(x, y, 1, 1, true);
if FindDTM(goldoreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
wait(4000 + random(2500));
if FindDTM(goldbarDTM, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, 1, 1, true);
while ((counter<50) and not (FindNormalRandoms)) do
begin
if not FindDTM(goldoreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then break;
wait(1000);
counter := counter + 1;
end;
end;
if FindObjCustom(x, y, ['ace'], [3815997], 5) then
begin
wait(100 + random(250));
Mouse(x, y, 1, 1, true);
wait(2000 + random(2500));
if FindDTM(silverbarDTM, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, 1, 1, true);
counter := 0;
while ((counter<50) and not (FindNormalRandoms)) do
begin
if not FindDTM(silveroreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then break;
wait(1000);
counter := counter + 1;
end;
Result := true;
end
end
else
begin
WriteLn('Couldn''t find initial goldoreDTM');
Terminator;
end
end
end
else
begin
WriteLn('Couldn''t find furnace');
Terminator;
end
end;
Function MineOre: boolean;
var
x, y: integer;
begin
if FindObjCustom(x, y, ['ine', 'ocks'], [miningcolour], 5) then
begin
wait(100 + random(250));
Mouse(x, y, 1, 1, true);
wait(waiter + random(4500));
Result := true;
WriteLn('found a rock');
end
else
begin
Result := false;
WriteLn('couldn''t find ore');
end
end;
Procedure LocateSilver;
begin
if ObjDTMWalk('632:42:4:1:7:622:103:1:7:653:86:1:7:645:105:1:7:646:61', 0, 100, 80, True) then
begin
wait(500 + random(250));
MakeCompass('n');
WriteLn('location is now silver')
end
else WriteLn('could not locate silver');
end;
Procedure LocateSelfToDoor;
begin
if ObjDTMWalk('651:94:6:1:7:642:73:1:7:606:73:1:7:594:81:1:7:630:48:1:7:666:69:1:7:598:53', 0, 100, 80, True) then
begin
wait(500 + random(250));
MakeCompass('n');
WriteLn('located self to door')
end
else WriteLn('could not locate to door');
end;
Procedure LocateGold;
begin
if ObjDTMWalk('617:128:4:1:7:641:93:1:7:619:65:1:7:637:111:1:7:607:62', 0, 100, 80, True) then
begin
wait(500 + random(250));
MakeCompass('s');
WriteLn('location is now gold')
end
else WriteLn('could not locate gold');
end;
Procedure ChangeLocation;
begin
if (location=0) then
begin
LocateSilver;
location := 1;
waiter := SILVERWAIT;
miningcolour := SILVERCOLOUR;
wait(500 + random(250));
Exit;
end;
if (location=1) then
begin
LocateGold;
location := 0;
waiter := GOLDWAIT;
miningcolour := GOLDCOLOUR;
wait(500 + random(250));
end
else
WriteLn('location wasn''t valid');
end;
Procedure Mining;
begin
miningcolour := GOLDCOLOUR;
location := 0;
waiter := GOLDWAIT;
repeat
if not MineOre then
begin
ChangeLocation;
wait(500 + random(250));
end;
if MineOre then Continue
else
WriteLn('MineOre returned true');
until(InvFull);
end;
Procedure OpenTheDoor; //newer door opener, thanks Flight
var
x, y, COUNTER: integer;
begin
If FindObj(x,y,'pen', 2117737, 5) then //2581379
Begin
WriteLn('Opening Door...');
ClickMouse2(True);
COUNTER := 0;
if not DidRedClick and (COUNTER<20) then //If we missed, then exit so we can try again
begin
OpenTheDoor;
inc(COUNTER);
end;
While IsMoving do
Wait(100);
//Maybe wait a little longer?
end else if FindObj(x,y,'lose', 2117737, 5) then //The door is already open, so let's exit
Exit;
end;
Procedure RelocateToCenter;
begin
if ObjDTMWalk('585:65:4:1:7:635:76:1:7:643:102:1:7:639:56:1:7:659:90', 0, 100, 80, True) then
begin
wait(500 + random(250));
MakeCompass('n');
WriteLn('location is now guild centre');
RestUntil(RandomRange(90,100));
//RestUp;
end
else
begin
WriteLn('could not relocate to centre');
Terminator;
end;
end;
Procedure WalkToGold;
begin
if ObjDTMWalk('657:124:4:1:7:618:56:1:7:642:52:1:7:655:55:1:7:675:105', 0, 100, 80, True) then
begin
wait(500 + random(250));
MakeCompass('s');
WriteLn('walked to gold from centre')
end
else WriteLn('could not relocate to gold from centre');
end;
procedure Report;//Starts procedure off
begin
Writeln('[]------------------Crafting Guild Miner Smelter-------------------------[]');//Do any style you want
Writeln('Worked For : ' + TimeRunning)//Displays how long it worked for
Writeln('Mined/Dropped '+ IntToStr(loadz) + ' Loads');
Writeln('[]--------------------------------------------[]');
end;
Procedure Bank;
begin
if ObjDTMWalk('631:91:4:1:7:595:89:1:7:595:73:1:7:603:50:1:7:580:77', 0, 100, 80, True)
then
begin
wait(500 + random(250));
WriteLn('made it to bank, banking...');
if OpenBank('feb', false, false)
then
begin
WriteLn('opened bank');
wait(500 + random(550));
if DepositAll then
begin
WriteLn('deposited all');
CloseBank;
inc(loadz);
//RestUntil(RandomRange(90,100));
RestUp;
SetRun(true);
end
end
else
begin
WriteLn('Couldn''t bank');
Terminator; //Instead of TerminateScript, this is another procedure i have which
end //frees my DTM's
end
else WriteLn('didn''t make it to the bank');
end;
begin
smart_server := 1;
smart_members := false;
smart_signed := true;
smart_superDetail := false;
clearDebug();
setupSRL();
DeclarePlayers;
if not LoggedIn then LogInPlayer;
ObjDTM_Setup;
SetAngle(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_SURFACE, ['8_8','9_8','9_7']);
SetupPaths;
repeat
Mining;
Report;
RelocateToCenter;
wait(2500 + random(2500));
OpenTheDoor;
if not SPS_WalkPath(GuildtoSmelt) then //SPS walking
begin
WriteLn('Couldn''t make it to the smelter');
Terminator;
end;
wait(7500 + random(2500));
if not Smelt then
begin
WriteLn('Couldn''t smelt');
end;
//WalkToBank; //objectDTM walking
wait(1500 + random(2500));
if not SPS_WalkPath(SmelttoBank) then //SPS walking
begin
WriteLn('Couldn''t make it to the bank');
Terminator;
end;
wait(1500 + random(2500));
Bank;
if not SPS_WalkPath(BanktoGuild) then //SPS walking
begin
WriteLn('Couldn''t make it to the guild');
Terminator;
end;
//WalkToGuild; //objectDTM walking
wait(3500 + random(2500));
LocateSelfToDoor;
wait(2500 + random(2500));
OpenTheDoor;
wait(2500 + random(2500));
WalkToGold;
Report;
until(Players[CurrentPlayer].Active=false);
end.First Report![]------------------Crafting Guild Miner Smelter-------------------------[]
Worked For : 1 Hours, 43 Minutes and 11 Seconds
Mined/Dropped 8 Loads
[]--------------------------------------------[]