Simba Code:
{
Instructions:
• This is a 600 line script, so treat it well
• Setup your preset with ore to smelt
• Setup in-game character to work with srl6, (SRL --> Player Manager). More information on Villavu forms.
• Select what bartype you would like to use at line 36 (optional).
• Run Lemons Script
• Best of luck from @Lemonstar
}
program LemonStarsBarMaker;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{$i SPS/lib/SPS-RS3.Simba}
var
runTime, breakTime, barTypeXp, barDTM, defaultXp, playerModBMP,
jagexModBMP, bankSymbol, smithSymbol, oreDTM, mouseClickRate: Integer;
myTotalTimeRunning, failSafeTimer, breakTimer: TTimeMarker;
coalBag, breakOption, lookForMods, smartPaint, startAnywhere: Boolean;
presetKey: String;
const
RUNITE = 1;
ADAMANITE = 2;
MITHRIL = 3;
STEEL = 4;
IRON = 5;
GOLD = 6;
SILVER = 7;
BRONZE = 8;
barType = GOLD;
SCRIPT_VERSION = '2.95';
{--- Your done filling things out here ---
Stop here unless you know what you are doing}
// CREDIT: This is Claritys way of making the code look nice and easy to find.
// Not sure if I should credit this or not, anyways nice work!
//EXAMPLE:
{PROCEDURE --
Purpose:
Comments: }
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]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
integers[3] := strToInt(playerForm.players[i].settings[3]);
booleans[0] := strToBool(playerForm.players[i].settings[4]);
booleans[1] := strToBool(playerForm.players[i].settings[5]);
booleans[2] := strToBool(playerForm.players[i].settings[6]);
booleans[3] := strToBool(playerForm.players[i].settings[7]);
booleans[4] := strToBool(playerForm.players[i].settings[8]);
strings[0] := playerForm.players[i].settings[9];
world := integers[0];
runTime := integers[1];
breakTime := integers[2];
mouseClickRate := integers[3];
coalBag := booleans[0];
breakOption := booleans[1];
lookForMods := booleans[2];
smartPaint := booleans[3];
startAnywhere := booleans[4];
case strings[0] of
'Preset 1': presetKey := '1';
'Preset 2': presetKey := '2';
end;
players[i].isActive := true;
writeLn('Logging in...');
end;
begin
if (not players[currentPlayer].login()) then
exit;
writeLn('Just logged in, waiting a bit...');
wait(randomRange(3000, 5000));
exitTreasure();
writeLn('Setup complete - player is logged in.');
end;
end;
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Lemonstar''s Lumby smithy 2.95';
scriptHelpThread := 'https://villavu.com/forum/showthread.php?t=116193';
editBoxLabels := ['World', 'Run Timer', 'Min Break In', 'Mouse click rate %'];
editBoxDefaults := ['-1', '240', '240', '5'];
editBoxHints := ['Enter your favorite world, -1 is random best connection world.',
'How long do you want to run this script for (In minutes)? Default is 240 minutes',
'In how many minutes would you like to break?',
'Type in %. This is how big of a chance it would click Make Bars intead of pressing spacebar'];
checkBoxLabels := ['Use CoalBag','Use Breaking', 'Look For Mods', 'Show Smart Paint', 'Start anywhere'];
checkBoxDefaults := ['False', 'True', 'True', 'True'];
checkBoxHints := ['Do you want to use a coalbag during your adventures? Notice that your coalbag must be in your 27nd inventory slot',
'Do you want to take breaks?',
'Do you want the script to keep an eye out for moderators?',
'Show smart paint, THIS IS FOR THE FUTURE. This has no meaning atm.',
'Start anywhere? This will teleport you to lumbridge and walk to the bank.'];
comboBoxLabels := ['Bank Preset'];
comboBoxDefaults := ['Preset 1'];
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Preset 1', 'Preset 2'];
end;
end;
{PROCEDURE -- autoUpdateMe
Purpose: Autoupdates Script.
Comments:
By: Shuttleu
Edited By: Ashaman88.}
procedure autoUpdateMe;
var
Neifile: Integer;
OnlineVersion, NewScript, NeiFeilNennen: String;
begin
writeln('Checking for script updates...');
OnlineVersion := GetPage('http://pastebin.com/raw/fQFZRLGG');
writeln('Online Version: '+ToStr(OnlineVersion));
writeln('Local Version: '+ToStr(SCRIPT_VERSION));
if (trim(OnlineVersion) > SCRIPT_VERSION) then
begin
writeLn('Newer script version online!');
writeLn('Autoupdating to newer version.');
NewScript := GetPage('http://pastebin.com/raw/ZNbrD48c');
NeiFeilNennen := ScriptPath+ 'Lemonstars Lumby Smither V'+OnlineVersion+'.simba';
Neifile := Rewritefile(NeiFeilNennen, true);
try
WriteFileString(Neifile, NewScript);
except
begin
WriteLn('Fatal error writing to '+NeiFeilNennen+'!!');
Terminatescript;
end;
end;
CloseFile(Neifile);
writeLn('New script downloaded to '+NeiFeilNennen+'!! Please use this one!!');
terminateScript;
end else
writeLn('You have the latest version of the script!');
end;
{PROCEDURE -- loadMemory
Purpose: Loads our memory.
Comments: None.}
procedure loadMemory;
begin
oreDTM := DTMFromString('mggAAAHicY2NgYDBlhWAPKK0NxJpAzMTEwMAJxF8ZGRjeAPE3IP4PxAEOukBdTBj4PwN2wIgDQwAAauAHFQ==');
playerModBMP := BitmapFromString (11, 6, 'meJy7e+XK/GnTcKHJXV13CSkQFeSAqGFkYAAiZAZQVlVeUJSfHa4AjQQq4Odi4uNkxKNAiJdNiIcZyMCF5KQEABnjWTQ=');
jagexModBMP := BitmapFromString (10, 7, 'meJzj+/9RY9lJZSmerv8/+f5/hCCgiIIYJ1AEWRAT4ZeVFmKBKGBkYAAiZAayjXApOAmURdaLKQvUCyRxIQCH7WsV');
bankSymbol := BitmapFromString(7, 7, 'meJwBkwBs/wYVNB9ylCynzCy13B5v' +
'kAkgPwQLKyOGrDO64y+w2i613jG23yugyQwoSC6r1SqZxBBPcRmYw' +
'hphhR1rkQYTMy+v3iiTvhFFZimmzwUPLgcVNQQLKyqZyTO78Cmk1B' +
'WRvAQPLwUMLAcOLw4lSiuYxjK58jW++C+u3xM2XAkSNQkQMwgSMRm' +
'GsiOFsjSy7y2e0w8qUBF9Nis=');
smithSymbol := BitmapFromString(7, 7, 'meJwriPKTkxJjZ2dDRpb6mlxcnGjI' +
'Qk9j+7qVOzesBqJdMGShq54SF9VWW75w+oRlc6YC0dJZk22NtEVFR' +
'XQ01QszU+ZO6pk9obOzvsLOWFdERBiIvNycpna1tFSXWJoZ25voSU' +
'tJqSkrFeWk97TUNJQXeLk4AgCrLy34');
end;
{PROCEDURE -- failSafeProcedure
Purpose: Checks if its time for failsafes, will be used more in the future(i have plans heheh).
Comments: None.}
procedure failSafeProcedure();
begin
if (failSafeTimer.getTime > 80000) then
begin
writeln('nothing happend for 80 secounds (probably out of ores), terminating script.');
terminateScript;
end;
end;
{PROCEDURE -- barTypeDTM
Purpose: Sets the right barDTM for the bar that you are using, depending on what bar you took in the setup.
Comments: None.}
function barTypeDTM : integer;
begin
case(barType) of
1: barDTM := DTMFromString('mbQAAAHicY2VgYHjOysDwAohfAfEtIP4KxHMYGRjWAfFMIF4MxPOB2NrdB6iaCQVLMmACRiwYDADw3gjF');
2: barDTM := DTMFromString('mbQAAAHicY2VgYOhlY2BwAGJ9ILYCYncgvsbIwMDKxMDwF0h/AuKvQGzpZAlUzYSCRRgwASMWDAYA8JYGOw==');
3: barDTM := DTMFromString('mbQAAAHicY2VgYMhgY2BwAGJ9ILYCYncgvsjIwMDKxMDwF0h/AuKvQGxq6gdUzYSCuRgwASMWDAYA3uUGCw==');
4: barDTM := DTMFromString('mbQAAAHicY2VgYBBiY2BwAGJ9ILYCYncg/sbIwMDKxMDwF0h/AuKvQJySkABUzYSCJRkwASMWDAYA5agGVQ==');
5: barDTM := DTMFromString('mbQAAAHicY2VgYBBkY2BwAGJ9ILYCYncgvsrIwMDKxMDwF0h/AuKvQOxkbw9UzYSC+RkwASMWDAYAv4cFxQ==');
6: barDTM := DTMFromString('mggAAAHicY2NgYIhjZWCIBeJMIE4C4ggg9gdiBiYGBkEgZgPiP4wMDP+AmB3IXtQoDpFEw0YM2AEjDgwBADdDBfA=');
7: barDTM := DTMFromString('mbQAAAHicY2VgYLBhY2BwAGJ9ILYCYncg/sHIwMDKxMDwF0h/AuKvQNzU1AFUzYSC5RgwASMWDAYAEnIG7g==');
8: barDTM := DTMFromString('mbQAAAHicY2VgYHjJysDwCYg/APFjIH4KxJcYGRhuA/F5IL4IxI+A2FZPGqiaCQVrMGACRiwYDAA2GAmh');
else
writeLn('Invalid choice of bars.');
end;
end;
{PROCEDURE -- initPlayer
Purpose: Makes sure everything is setup.
Comments: None.}
procedure initPlayer();
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
mainScreen.setAngle(MS_ANGLE_HIGH);
writeLn('Setting run.');
if not (minimap.isRunEnabled()) then
minimap.toggleRun(true);
writeLn('Setting gametab.');
if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK);
writeLn('Clicking compass.');
minimap.clickCompass;
myTotalTimeRunning.start;
defaultXp := chatBox.getXPBar;
end;
{PROCEDURE -- progressReport
Purpose: Shows a report over your progress.
Comments: None.}
procedure progressReport();
var
xpCounter, madePerHour, xpPerHour, hourTime, amount :Integer;
begin
amount := (amount + tabBackpack.countDTM(barDTM));
xpCounter := (chatBox.getXPBar - defaultXp);
madePerHour := round(amount/myTotalTimeRunning.getTime*3600000);
xpPerHour := round(xpCounter/myTotalTimeRunning.getTime*3600000);
writeln('_________________________________________________________________');
writeln('_________________________PROGRESS REPORT_________________________');
writeln(amount, ' Bars made in ', msToTime(myTotalTimeRunning.getTime, TIME_FORMAL));
writeln(madePerHour, ' Bars per hour');
writeln(xpCounter,' XP gained(Per hour:',xpPerHour, ')');
writeln('_________________________________________________________________');
if smartPaint then
begin
//for the future, not.
end;
end;
{PROCEDURE -- takeABreak
Purpose: Checks if it's time for break, if so it will afk.
Comments: Figured ill make my own breaking procedure, so I did!}
procedure takeABreak();
var
I, breakTimeTimer: Integer;
breakDuration: TTimeMarker;
begin
I := Random(250);
case I Of
1..50: breakTimeTimer = I * Random(3420, 3660);
51..150: breakTimeTimer = I * Random(420, 660);
151..250: breakTimeTimer = I * Random(220, 260);
end;
begin
players[currentPlayer].exitToLobby();
breakDuration.start();
writeln('We are taking a lovely break');
end;
repeat
wait(gaussRangeInt(20000, 30000));
until breakDuration.getTime() > breakTimeTimer;
end;
{PROCEDURE -- antiBan
Purpose: The more random antibans.
Comments: None.}
procedure antiBan;
var
I: Integer;
begin
I := Random(500);
case I Of
1..7:
begin
hoverSkill(SKILL_SMITHING);
Wait(GaussRangeInt(1000, 6500));
TabBackpack.Open;
end;
8..20: mouseMovingObject;
21..100: SleepAndMoveMouse(GaussRangeInt(150, 1500));
101..200: Wait(GaussRangeInt(0, 750));
201..495: mouseOffClient(OFF_CLIENT_RANDOM);
496..500:
begin
hoverSkill(SKILL_SMITHING);
Wait(GaussRangeInt(1000, 6500));
if (breakTimer.getTime() > breakTime * 60000) and breakOption then
takeABreak;
end;
end;
end;
{PROCEDURE -- walkToBank
Purpose: Walks to the bank and reset failsafecount.
Comments: Claritys, edited by LemonStar}
procedure walkToBank;
var
x, y: Integer;
walkPoint: TPoint;
p: TPoint;
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
writeln('Walking to the bank.');
repeat
if findBitmapToleranceIn(BankSymbol, x, y, minimap.getBounds(), 30) then break;
walkPoint := Point(minimap.cx - 35 + random(-7, 7), minimap.cy + -70 + random(-7, 7));
mouse(walkPoint, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(500, 800));
minimap.waitPlayerMoving();
until findBitmapToleranceIn(BankSymbol, x, y, minimap.getBounds(), 30);
mouse(point(x + random(-7, 7), y + 5 + random(-2, 7)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(300, 400));
minimap.waitPlayerMoving();
end;
{PROCEDURE -- walkToSmith
Purpose: walks to the furness.
Comments: None}
procedure walkToSmith;
var
x, y: Integer;
walkPoint: TPoint;
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
writeln('Walking to the smelter.');
findBitmapToleranceIn(SmithSymbol, x, y, minimap.getBounds(), 20);
mouse(point(x + random(-3, 5), y + 10 + random(-1, 5)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(500, 700));
minimap.waitPlayerMoving();
end;
{PROCEDURE -- teleportToBank
Purpose: Teleports and calls function WalktoBank if failsafes from bank chest.
Comments: None}
procedure teleportToBank ();
begin
if lodestoneScreen.teleportTo(LOCATION_LUMBRIDGE) then
begin
wait(gaussrangeint(950, 1060));
MouseOffClient(Random(4));
wait(gaussrangeint(15000, 16000));
end else
begin
writeln('Script terminating, failed to teleport. Probably due to heavy lag.');
terminateScript;
end;
end;
{PROCEDURE -- doBanking
Purpose: Opens bank and takes out resources.
Comments: Credit to @Sin for coalbag code}
procedure doBanking();
var
failCount: Integer;
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
wait(gaussrangeint(1000, 2000));
progressReport;
repeat
bankscreen.open(11);
writeln('Trying to open bank.');
failCount + 1;
until bankscreen.isopen(1000) or failCount = 4;
if failcount = 4 then
begin
writeln('Failed to open bank, color.');
terminateScript;
end;
if bankscreen.isOpen and coalBag = false then
begin
writeln('Bank screen is open.');
repeat
typeSend(presetKey, false);
wait(gaussrangeint(300, 1200));
until bankscreen.isOpen = false;
end else
begin
writeln('Bank screen is open, filling up coalbag.');
repeat //start of credit
MouseBox(bankScreen.getPackSlotBox(27), MOUSE_RIGHT);
chooseOption.select(['Fill C', 'l C'], 500);
mouseBox(IntToBox(589,401,614,421) , MOUSE_move);//end of credit
typeSend(presetKey, false);
wait(gaussrangeint(300, 1200));
until bankscreen.isOpen = false;
end;
writeln('done banking, closing bank');
failCount = 0;
end;
{PROCEDURE -- findSmelter
Purpose: Finds the smelter and clicks it.
Comments: Credit to shield, I made my own but I might aswell use this. Had to change colors though.}
procedure findSmelter();
var
x,y,i : Integer;
bTPA, ladTPA : TPointArray;
ladATPA : T2DPointArray;
furnessTPoint : TPoint;
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
findColorsSpiralTolerance(x, y, bTPA, 1122239, mainScreen.getBounds(), 3, colorSetting(2, 0.07, 0.27));
if (Length(bTPA) < 1) then //makes sure that you are clicking the furness
begin
writeLn('Failed to find furnace colors, please report this');
exit;
end;
furnessTPoint := middleTPA(bTPA);
findColorsSpiralTolerance(x,y, ladTPA, 1254843, mainScreen.getBounds(), 5, colorSetting(2, 0.29, 1.46));
if (Length(ladTPA) < 1) then
begin
writeLn('Failed to find furnace colors, please report this');
exit;
end;
ladATPA := ladTPA.toATPA(25,30);
ladATPA.sortFromMidPoint(furnessTPoint);
for i := 0 to high(ladATPA) do
begin
mouse(middleTPA(ladATPA[i]), MOUSE_MOVE);
if isMouseOverText(['melt']) then
begin
writeLn('Found colors, clicking furnace!');
fastClick(MOUSE_LEFT);
wait(gaussrangeint(4000, 4200));
exit;
end;
end;
end;
{PROCEDURE -- makeBars
Purpose: Make the bars and waits.
Comments: None}
procedure makeBars();
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
if mouseClickRate >= random(100) then
begin
writeLn('Clicking!');
wait(gaussRangeInt(300, 700));
productionScreen.clickStart(false);//space: boolean = false
end else
begin
writeLn('space baring!');
productionScreen.clickStart();
end;
failSafeTimer.start;
repeat
writeln('Waiting until interface is gone');
wait(gaussRangeInt(2000, 4000));// not spamming writeln
until productionScreen.isOpen = false or (failSafeTimer.getTime > 80000);
writeln('Interface is gone');
failSafeProcedure;
antiBan;
repeat
wait(gaussRangeInt(3000, 5000));
failSafeProcedure;
until (tabBackpack.countDTM(oreDTM)) = false;// waits until done
end;
{PROCEDURE -- findMod
Purpose: Looks in chat for mod crown.
Comments: Credits to Justin for this!}
procedure findMod();
var
x, y: Integer;
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
end;
if (findBitmapToleranceIn(playerModBMP, x, y, IntToBox(1, 508, 604, 590), 50)) or (findBitmapToleranceIn(jagexModBMP, x, y, IntToBox(1, 508, 604, 590), 50)) then
begin
writeln('Jagex/Player mod found, hopping');
takeScreenshot(ToStr(random(10000)) + '_mod.png');
players[currentPlayer].exitToLobby();
lobbyWorlds.selectRandomWorld(true);
players[currentPlayer].login();
sleep(randomRange(2458, 5497));
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
end;
end;
{PROCEDURE -- freeMemory
Purpose: Makes sure we don't get any memory leaks.
Comments: None}
procedure freeMemory;
begin
FreeBitmap(jagexModBMP);
FreeBitmap(PlayerModBMP);
FreeBitmap(bankSymbol);
FreeBitmap(smithSymbol);
FreeDTM(barDTM); //good thing about this is that it frees the barDTM on the current bar, not all of them, no need.
FreeDTM(oreDTM);
end;
{PROCEDURE -- mainLoop
Purpose: Loop procedures.
Comments: None}
procedure mainLoop;
begin
walkToBank();
doBanking();
walkToSmith();
findSmelter();
makeBars();
if lookForMods then
findMod();
end;
begin
autoUpdateMe;
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
loadMemory();
addOnTerminate('freeMemory');
setupSRL();
declarePlayers();
InitPlayer();
breakTimer.start;
if startAnywhere then
teleportToBank;
repeat
if not isLoggedIn() then
begin
DeclarePlayers();
InitPlayer();
end;
mainLoop();
writeln(myTotalTimeRunning.getTime);
until myTotalTimeRunning.getTime() > (runTime * 60000);//60000 is one minute, run time in minutes
end.
Thanks