Simba Code:
(* This program is for fishing and banking trout/salmon on the Lumbridge River.
To use, have a Lumbridge map named 'Lumby' in your RUNESCAPE_SURFACE folder.
Simply fill out username and password in the first procedure to start!
The program uses ACA, DTM, and SPS.
Programmed by geek borgel, 24 June 2015
*)
program lumbridgeTrout;
{$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
var
north: boolean;
// Fill this out for your player.
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'USERNAME HERE';
password := 'PASSWORD HERE';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
// This procedure uses an SPS path to walk to the fishing spot.
// Failsafes: If the player fails to walk to the fish spot the program will terminate.
procedure walkToFish();
var
pathToFish : TPointArray;
begin
if (not isLoggedIn()) then
exit;
pathToFish := [Point(173, 159), Point(201, 155), Point(241, 146), Point(274, 146), Point(297, 156), Point(284, 183)];
if SPS.walkPath(pathToFish) then
minimap.waitPlayerMoving()
else
begin
writeLn('Failed to walk to fish.');
terminatescript;
end;
north := true;
end;
// This procedure uses an SPS path to walk to the Lumbridge bank chest.
// Failsafes: If the player fails to walk to the bank the program will terminate.
procedure walkToBank();
var
pathToBank : TPointArray;
begin
if (not isLoggedIn()) then
exit;
pathToBank := [Point(284, 183), Point(297, 156), Point(274, 146), Point(241, 146), Point(201, 155), Point(173, 159)];
if SPS.walkPath(pathToBank) then
minimap.waitPlayerMoving()
else
begin
writeLn('Failed to walk to bank.');
terminatescript;
end;
end;
// This uses a DTM to find feathers and withdraws them after banking inventory.
// Failsafes: If the bankscreen fails to close the program will terminate.
procedure findBanker();
var
feather: integer;
begin
if (not isLoggedIn()) then
exit;
feather := DTMFromString('mbQAAAHicY2VgYOADYmEGCACx2YCYA8oXBWIBIOYEiUlzMmxavRpMz502jWHV4sUMrEBxfiCG0SDMhAWDAQB3sAbL');
bankScreen.open(BANK_CHEST_LUMBRIDGE);
Wait(1000 + random(1000));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
Wait(1000 + random(1000));
bankScreen.withdraw(feather, 28);
Wait(1000 + random(1000));
freeDTM(feather);
if (not bankScreen.close()) then
begin
if (exitTreasure()) then
if (bankScreen.close()) then
exit
else
terminatescript;
end;
end;
// This procedure swaps the player between the north and south fishing spots.
// If one doesn't have any locations it will send the player to the other one.
// changeLocation uses a DTM for each spot on the minimap.
procedure changeLocation();
var
x, y, northDTM, southDTM: Integer;
begin
northDTM := DTMFromString('mlwAAAHicY2dgYFBiZmAQBmIRIA4GYnMg9gfif0wMDKeA8ieBeBEQnwbiB0D8Doi/AbGumhxDXGoFQ02CDENtZRFDoIsxQ3NRMEOomxkDP1AeHUtCaWY8GAoAt74PdQ==');
southDTM := DTMFromString('mggAAAHicY2NgYNAFYjkGCJAF4kAgdgBifyAOBeISqFwQEDsBsZqiNENcehlDY30pQ0umDENNvi9DkLsRAz9QDhtmwoEhAAC1agkw');
if (north = true) then
findDTM(southDTM, x, y, minimap.getBounds())
else
findDTM(northDTM, x, y, minimap.getBounds());
mouse(x, y, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
minimap.waitPlayerMoving();
Wait(500 + random(250));
freeDTM(northDTM);
freeDTM(southDTM);
if (north = true) then
north := false
else
north := true;
end;
// This function uses ACA to find the fishing spot. It seaches for the white circles.
// If it finds enough matches it will move the mouse and click if it is a fishing spot.
// Output: Boolean if it succeeds on clicking the fishing spot or not.
function findFish(): boolean;
var
x, y, t: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
t := 0;
repeat
findColorsSpiralTolerance(x, y, TPA, 13283741, mainScreen.getBounds(), 9, colorSetting(2, 0.10, 1.02));
t := t + 1;
writeLn(length(TPA));
until (length(TPA) > 15 or (t > 250));
if (length(TPA) > 15) then
begin
ATPA := TPA.toATPA(15, 15);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
//smartImage.debugATPA(ATPA);
//smartImage.clear();
mouse(middleTPA(ATPA[0]), MOUSE_MOVE, MOUSE_HUMAN);
end;
if(isMouseOverText(['ishing'], 500)) then
begin
fastClick(MOUSE_LEFT);
result := true;
end else
result := false;
end;
// This procedure runs until the backpack is full. If the contents of the backpack
// does not change in several seconds, it will call findFish to seach for a new fishing
// spot. If it cannot it will send the player to the other fishing location.
// Failsafes: If the player is not logged in the program will terminate.
procedure goFishing();
var
count: integer;
begin
findFish();
while (not tabBackPack.isFull()) do
begin
count := tabBackpack.count();
wait(6000 + random(5000));
if (count = tabBackpack.count()) then
begin
if (not findFish()) then
changeLocation();
end;
if (not isLoggedIn()) then
exit;
end;
end;
// main loop
begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
disableSRLDebug := false;
smartShowConsole := false;
setupSRL(); // Load the SRL include files
SPS.setup('Lumby', RUNESCAPE_SURFACE); // Setup our map
declarePlayers(); // Set up your username/pass
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
Wait(5000);
exitTreasure(); // Exit treasure hunter
mainScreen.setZoom(true);
minimap.clickCompass(false);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
// Main loop, banks first, then walks to the fish and fishes until backpack is full then repeats.
while (isLoggedIn()) do
begin
walkToBank();
findBanker();
walkToFish();
goFishing();
end;
end.