Simba Code:
program CrankOutPlanks;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i SRL-6/LIB/MISC/SRLPLAYERFORM.simba}
(* SETUP INSTRUCITONS:
Put a full invo of logs your select preset.
Log in the world and stand next to the bank,
you should be one spot away from the sawmill.
Play around with the zoom until it works,
will be closer to max zoom in rather than max zoom out
*)
const
{Stop SRL messages in the debug box?}
DisableDebug := True;
{Which banking preset do you want to use?}
BankPreset = (BANK_BUTTON_PRESET_1); //if you want to use 2 then: change to (BANK_BUTTON_PRESET_2);
{AntiBan chance of occurring, the higher
the number the lower the chance.}
Chance = 101;
//Don't change anything bellow//////////////////////////////////////////
/////////Don't change anything bellow///////////////////////////////////
////////////////Don't change anything bellow////////////////////////////
var
LogsDone: integer;
procedure initPlayerForm();
begin //Excluded Citadel, the sawmill isn't always placed in the same direction there.
with playerForm do
begin
name := 'Crank Out Planks';
scriptHelpThread := '';
//Can't think of a way to have the preset be in the player form
editBoxLabels := ['Number to do:']; //,'Preset Number:' , '1' ,'Which bank preset do you want to use?'
editBoxDefaults := ['5000'];
editBoxHints := ['How many logs do you want to process?'];
comboBoxLabels := ['Sawmill Direction:','Which Bank:'];
comboBoxDefaults := ['South','ShantyPass'];
comboBoxItems := [['North','East','South','West'], ['North','East','South','West','ShantyPass','Burthrope','Combat Academy/Lumbrdige']];
comboBoxHints := ['Which direction are the sawmills being set?','Pick a bank or the direction of the bank.'];
{checkBoxLabels := ['Color First'];
checkBoxDefaults := ['False'];
checkBoxHints := ['Less reliable, searches by color before static cords.']; }
end;
end;
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
integers[0] := strToInt(playerForm.players[i].settings[0]);
//Preset: integers[1] := strToInt(playerForm.players[i].settings[1]);
strings[0] := playerForm.players[i].settings[1];
strings[1] := playerForm.players[i].settings[2];
//Colorfirst' variable: booleans[0] := strToBool(playerForm.players[i].settings[4]);
end;
end;
procedure FindRandoms();
begin //Closes runescape pay extra money advertisements.
claimTicket();
exitTreasure();
end;
procedure MouseCords();
begin
case players[currentPlayer].strings[0] of
'North': MouseOval(299,111,20,20,Mouse_Move);
'East': MouseOval(395,193,18,22,Mouse_Move); //Not sure why this one is 18,22 instead of 20,20. I assume it works better...idr
'South': MouseOval(275,290,20,20,Mouse_Move);
'West': MouseOval(183,178,20,20,Mouse_Move);
end;
end;
procedure AntiBan(ReHover: boolean);
begin //antiban moves mouse off the sawmill, seperated PortableDirection into MouseCords to prevent this problem.
case random(Chance) of
10, 11: begin randomRClickItem(); if Rehover then MouseCords(); end;
20: begin pickUpMouse; if Rehover then MouseCords(); end;
25..30: begin mouseMovingObject(); if Rehover then MouseCords(); end;
40..45: begin sleepAndMoveMouse(randomRange(500, 7000)); if Rehover then MouseCords(); end;
50..57: begin wait(RandomRange(777, 9000)); if Rehover then MouseCords(); end;
61: begin smallRandomMouse(); if Rehover then MouseCords(); end;
62: begin writeLn('Starting mini break.'); wait(RandomRange(9001, 25000)); writeLn('Finished mini break.'); if Rehover then MouseCords(); end;
end;
end;
//the correct colors to the top of the portable, not inlcuding legs or weird handles
//3239582 11 tol 0.25 hue 0.24 sat
//legs= 2639984 9 0.18 1.30
function PortableColor: boolean;
var
Attempts, x, y: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin //DIDN'T REALLY TOUCH THIS... I planned on using tboxes or something to help focus the search.
if not isLoggedIn() then //I got lazy, these colors might work though
exit;
repeat //top of sawmill
if FindColorsSpiralTolerance(x, y, TPA, 2449277, mainscreen.getbounds(), 7, colorsetting(2, 0.26, 0.22)) then
begin
ATPA := SplitTPAEx(TPA, 15, 15);
FilterTPAsBetween(ATPA, 0, 7);
MouseBox(ATPA[0].getbounds, mouse_move);
if ismouseovertext(['awmill', 'Portable sa', 'mill', 'saw']) then
begin
wait(RandomRange(0, 300));
if random(5) <> 0 then
fastclick(mouse_left)
else begin
fastClick(MOUSE_RIGHT);
if chooseOption.select(['awmill', 'Portable sa', 'Make']) then
writeLn('Right clicked this time.');
end;
exit(true);
end;
Attempts := Attempts + 1;
AntiBan(true);
wait(RandomRange(1000,3000));
end;
until (Attempts >= 3) or (not isLoggedIn);
end;
procedure PortableDirection();
var
Waited: Integer;
begin
if (Tabbackpack.count() <= 27) then
exit;
MouseCords();
if bankScreen.isOpen() then
bankScreen.clickButton(BankPreset);
WriteLn('Beginning search for mouse over text.');
wait(225+random(500));
if IsMouseOverText(['awmill', 'Portable sa', 'mill', 'saw'], 500) then
fastclick(mouse_left)
else
repeat
if bankScreen.isOpen() then //Somehow got stuck on bankscreen in last version, This should fix it.
bankScreen.clickButton(BankPreset);
wait(1500+random(1000));
Waited := Waited + 1;
AntiBan(true);
if isMouseOverText(['awmill', 'Portable sa', 'mill', 'saw'], 400) then
fastclick(mouse_left);
until isMouseOverText(['awmill', 'Portable sa', 'mill', 'saw'], 400) or (Waited >= 15);
end;
procedure MakePlanks();
var
DialogueBox: tbox;
x, y: integer;
ATPA: T2DPointArray;
TPA: TPointArray;
timer: TTimeMarker;
begin
if bankScreen.isOpen() then
bankScreen.clickButton(BankPreset);
DialogueBox := conversationBox.getChatBounds(); //Failsafe for finding the white chatbox before continuing.
timer.start();
while not findColorsSpiralTolerance(x, y, TPA, 10470614, DialogueBox, 5, colorsetting(2, 0.22, 1.83)) and (timer.getTime() > 20000) do
begin
if not isLoggedIn() then exit;
wait(RandomRange(0, 200));
end;
wait(RandomRange(600, 1000));
mouseSpeed := randomRange(24,28); //Seems like this correlates with typing speed.
case random(131) of
1..35: typesend('30',true);
36..50: typesend('28',true);
51..100: typesend('32',true);
101..110: typesend('322',true);
111..120: typesend('288',true);
121..130: typesend('300',true);
end;
wait(RandomRange(950,1500)); //wait(777+random(400));
while not findColorsSpiralTolerance(x, y, TPA, 9877451, DialogueBox, 5, colorsetting(2, 0.04, 0.33)) and (timer.getTime() > 20000) do
begin
if not isLoggedIn() then exit;
wait(RandomRange(0, 200));
end;
wait(RandomRange(100, 400));
typesend('1',false);
wait(4800+random(500));
AntiBan(false);
mouseSpeed := randomRange(25,32);
end;
function OpenBank(): boolean;
var //modeled off of Coh3n's willow cutter, mostly changed.
NotOpened: integer;
begin
if not isLoggedIn() then
exit;
repeat
if (bankscreen.isOpen()) then
begin
result := true;
break();
end;
if not (bankscreen.isOpen()) then
wait(RandomRange(100, 300));
inc(NotOpened);
until(result := true) or (NotOpened >= 30); //minimum 3 second wait
WriteLn('Attempted to open the bank.');
end;
procedure CompactBanker();
begin //Note to self: Direction cords need to be added to top for an easier fix
case players[currentPlayer].strings[1] of
'North': begin MouseOval(299,111,20,20,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'East': begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'South': begin mouseOval(281,283,30,30,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'West': begin mouseOval(185,180,25,25,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'ShantyPass': begin if not bankScreen.open(BANK_CHEST_SHANTAY) then begin mouseOval(378,197,30,30,Mouse_Move); if IsMouseOverText(['Shantay c', 'y chest'], 777) then fastclick(mouse_left); end; end;
'Burthrope': begin if not bankScreen.open(BANK_TABLE_BURTHORPE) then begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['ank', 'booth'], 777) then fastclick(mouse_left); end; end;
'Combat Academy/Lumbrdige': begin if not bankScreen.open(BANK_CHEST_LUMBRIDGE) then begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['ank', 'hest'], 777) then fastclick(mouse_left); end; end;
end;
wait(RandomRange(0, 500));
if pinScreen.isOpen() then
pinScreen.enter(Players[currentPlayer].bankPin);
if (openBank()) then
begin
if Not bankScreen.isOpen() then
begin
WriteLn('Failed to open the bank.');
exit;
end;
end;
if bankScreen.isOpen() then
begin
WriteLn('Successfully opened the bank!');
if bankScreen.clickButton(BankPreset) then
LogsDone := LogsDone + 28;
end;
wait(RandomRange(800,1700));
end;
procedure BankThenCrank();
begin
if not isLoggedIn() then
exit;
CompactBanker();
if bankScreen.isOpen() then
bankScreen.clickButton(BankPreset);
PortableDirection;
MakePlanks;
clearDebug(); //if random(2) = 0 then clearDebug();
writeln('Logs Converted: ' + (toStr(LogsDone)));
if (not bankScreen.isOpen) and (Tabbackpack.isEmpty) then //(Tabbackpack.count() = 0)
begin
clearDebug();
WriteLn('Failed to withdraw anything.');
TerminateScript;
end;
end;
begin
clearDebug();
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
declarePlayers();
smartShowConsole := false;
if DisableDebug then
disableSRLDebug := true;
setupSRL();
FindRandoms();
Minimap.ClickCompass;
mainScreen.setAngle(MS_ANGLE_HIGH);
{if players[currentPlayer].integers[1] := 1 then
BankPreset = (BANK_BUTTON_PRESET_1) //Can't think of a way to have the preset be in the player form
else
if players[currentPlayer].integers[1] := 2 then
BankPreset = (BANK_BUTTON_PRESET_1)
else begin
WriteLn('Invalid preset chosen, terminating script.');
WriteLn('Valid preset numbers include: 1 and 2.');
TerminateScript();
end; }
repeat
mouseSpeed := randomRange(25,32);
if random(5) <= 0 then mainScreen.setAngle(MS_ANGLE_HIGH); //if random 0-5 is less than or equal to zero then set screen high
BankThenCrank();
if (LogsDone > players[currentPlayer].integers[0]) then //If logsdone is more than Number to do then stop
TerminateScript;
until (false);
end.