This script buys the daily bagged plants shop in falador park. After it is done buying it will have to refill again for 24 hours. It is a quick daily profit of 550k. It is a rather slow process and I would like some feedback on this script.
Also it gets hung up at the end of the script because your inventory cant be full, so I dont know how to stop it from doing that, if anyone has any pointers that'd be great thanks!
Requirements:
Members
Empty inventory on Preset 1
1m Starting Cash or more (Stock replenishes some in the time it takes to buy).
Code:
program PlantBuyer;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'username';
password := 'password';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;
procedure Bank(); //Opens bank and selects preset
begin
bankScreen.open(BANK_NPC_GREY);
wait(RandomRange(1000, 1500));
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(RandomRange(200,600))
end;
procedure RunTo();
var
pathToShop: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToShop := [Point(114, 161), Point(148, 137), Point(166, 114)];
if SPS.walkPath(pathToShop) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the shop');
end;
procedure Buy(); //Clicks NPC and buys item.
var
x, y: integer;
Plants: TBox;
begin
if mainscreen.findObject(x, y, 4144414, 11, ['upplie'], MOUSE_RIGHT) then
begin
wait(1200);
chooseOption.select(['Trade']);
wait(RandomRange(1500,1920));
Plants := intToBox(53, 150, 87, 189);
mousebox(Plants, MOUSE_RIGHT);
chooseOption.select(['All']);
tabBackPack.waitForShift(5000);
end;
end;
procedure Return(); //Returns to bank
var
pathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToBank := [Point(129, 130), Point(145, 172), Point(167, 212)];
if SPS.walkPath(pathToBank) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the bank');
end;
procedure compass1(); //Sees Bankers
var
compassBox: TBox;
begin
compassBox := intToBox(590, 25, 602, 42);
wait(randomRange(500, 730));
mouseBox(compassBox, MOUSE_LEFT);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
procedure compass2(); //Sees Shop
var
compassBox: TBox;
begin
compassBox := intToBox(590, 25, 602, 42);
wait(randomRange(500, 730));
mouseBox(compassBox, MOUSE_LEFT);
mainScreen.setAngle(45);
end;
procedure WaitRandom(MsecToWait: Integer); //procedure that makes random wait time
begin
Wait(MsecToWait + Random(Round(MsecToWait / 5.0)));
end;
begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass
SPS.setup('FALLYPLANT', RUNESCAPE_OTHER);
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
exitTreasure(); // Exit treasure hunter
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
repeat
compass1();
WaitRandom(500);
Bank();
compass2();
WaitRandom(500);
RunTo();
repeat
Buy();
until TabBackpack.isFull();
Return();
WaitRandom(600);
until False;
end.
This map
FALLYPLANT.PNG