The Spark
2014-08-05 23:20:42
How Long have You Played Runescape?
8 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Well, I attempted to learn python a few years ago, only learned the basics, but it has really helped me in learning to code with Simba and using SRL.
Are you a member of any other communities?
No
Tell us about yourself…
Please show us one (or multiple) of your scripts.
If you ultimately decide to vote no on this poll, please make a post telling me why. I'd love to know what I can improve on :)
8 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Well, I attempted to learn python a few years ago, only learned the basics, but it has really helped me in learning to code with Simba and using SRL.
Are you a member of any other communities?
No
Tell us about yourself…
From: sparkyownage
Well, my name is Thad. I'm 19 years old, I'm a student, I go to college in California. I'm doing my undergrad at Stanford University, and I hope to get into their medical school in a few years. I am currently studying to become a Cardiac Surgeon, which takes an extremely long time. I spend most of my time studying, my education is probably the #1 most important thing for me :D. I don't really play or watch any sports, but I really like coding, it's very fascinating and I love the different scripts you can create to solve the same issue. That's pretty much why I'm here, to learn more :)
Please show us one (or multiple) of your scripts.
program CanifisTanner;
{$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
// Thanks to TheMayor for his amazing tutorials and his help to me in the process of making this script :)
// Thanks to Turpinator and Slacky for taking the time to help me on IRC :D
{
__ __ _ ____
| \/ | | | | _ \
| \ / | __ _ __| | ___ | |_) |_ _
| |\/| |/ _` |/ _` |/ _ \ | _ <| | | |
| | | | (_| | (_| | __/ | |_) | |_| |
|_| |_|\__,_|\__,_|\___| |____/ \__, |
__/ |
|___/
_____ _
/ ____| | |
| (___ _ __ __ _ _ __| | ___ _ _____ ___ __ __ _ __ _ ___
\___ \| '_ \ / _` | '__| |/ / | | |/ _ \ \ /\ / / '_ \ / _` |/ _` |/ _ \
____) | |_) | (_| | | | <| |_| | (_) \ V V /| | | | (_| | (_| | __/
|_____/| .__/ \__,_|_| |_|\_\\__, |\___/ \_/\_/ |_| |_|\__,_|\__, |\___|
| | __/ | __/ |
|_| |___/ |___/
{-----------------------------INSTRUCTIONS: -----------------------------------)
{------------------------------------------------------------------------------)
Have it zoomed all the way out
Start the script with your player in Canifis Bank
Have NOTHING in your inventory
If you want the script to work well, go in a world where your ping is good
Fill out your username and password
Fill out at what percent you want to rest at
Press Play or F9
Have fun :)
Written for SRL Membership Application
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------}
const
VERSION = '1.1';
SBOTT_COLOR = 2040107;
SBOTT_TOL = 6;
SBOTT_HUE = 0.55;
SBOTT_SAT = 1.09;
BANK_COLOUR = 1723228;
BANK_TOL = 5;
BANK_HUE = 0.04;
BANK_SAT = 2.74;
NumberOfLoads = 1000; // How many loads do you want it to complete?
PercentRest = 45; // # at what percent you would like the bot to rest
var
loadscomplete : Integer = 0;
rested : Integer;
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := ''; // Put your username in between the apostraphes
password := ''; // Put your password in between the apostraphes
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{--------------------------END OF SCRIPT SETUP---------------------------------)
(--------------------------DO NOT TOUCH BELOW----------------------------------)
(-------------------UNLESS YOU KNOW WHAT YOU'RE DOING--------------------------)
{------------------------------------------------------------------------------)
(------------------------------------------------------------------------------}
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
{------------------------------------------------------------------------------)
Procedure: autoUpdateMe
Description: Checks for updated script online, and downloads if avaliable.
Credits: Shuttleu and Ashaman88 and TheMayor (modified by Sparkyownage)
(------------------------------------------------------------------------------}
procedure autoUpdateMe();
var
newFile: integer;
onlineVersion, latestScript, newFileName: string;
begin
writeln('Checking for script updates...');
writeLn('');
onlineVersion := getPage('tannerrs3.googlecode.com/git/version.txt');
writeLn('NOTIFICATION: Current script version: ' + version + ' | Online version: ' + onlineVersion);
if (trim(onlineVersion) > version) then
begin
writeLn('NOTIFICATION: Downloading the newer version from Google Code');
latestScript := GetPage('https://tannerrs3.googlecode.com/git/CanifisTanner.simba');
newFileName := scriptPath+ 'The Mayors Plank Banker v'+OnlineVersion+'.simba';
newFile := rewriteFile(newFileName, true);
if not writeFileString(newFile, latestScript) then
begin
writeLn('NOTIFICATION: Fatal error writing to ' + newFileName);
terminatescript();
end;
closeFile(newFile);
writeLn('NOTIFICATION: New script downloaded to ' + newFileName + ' | Please use this one!');
writeLn('');
terminateScript();
end else
writeLn('NOTIFICATION: You have the latest version.');
end;
{------------------------------------------------------------------------------)
Procedure: scriptTerminate
Description: Logs the player out when something goes wrong)
(------------------------------------------------------------------------------}
procedure scriptTerminate();
begin
writeln('Shutting down: Took a picture, please post the picture in the thread for assistance');
saveScreenshot(scriptPath + timeRunning() + ':' + 'TannerFailure.png');
players[currentPlayer].logout;
terminateScript;
end;
{------------------------------------------------------------------------------)
Procedure: paintStatus
Description: Paints the current script status on SMART, in the chatbox.
Credits: TheMayor (Modified by Sparkyownage)
(------------------------------------------------------------------------------}
procedure paintStatus(status: string);
begin
smartImage.clearArea(intToBox(6, 6, 740, 75));
smartImage.drawText('Status: ' + status, point(6,6), SmallChars, false, ClYellow);
end;
{------------------------------------------------------------------------------)
Procedure: antiban
Description: Does some random (human-like) stuff.
(------------------------------------------------------------------------------}
procedure antiBan();
var
i: integer;
begin
if not isLoggedin() then
exit;
paintStatus('Engaging in antiban');
i := random(500);
case i of
1..12: pickUpMouse();
13..18: randomRClickItem();
19..26: sleepAndMoveMouse(random(2000) + 750);
27..32: smallRandomMouse();
33..50: mouseOffClient(OFF_CLIENT_RANDOM);
51..85: randomCompass(random(300), randomrange(10, 100), false);
86..120: mainScreen.setAngle(MS_ANGLE_HIGH);
121..150: hoverRandomSkill();
end;
end;
{------------------------------------------------------------------------------)
Function: runPercent
Description: Estimates run energy using a polynomial equation of colour counts
Credits: The Mayor and Ashaman88 ( Modified by Sparkyownage)
(------------------------------------------------------------------------------}
function runPercent(): integer;
var
count: integer;
begin
if not isLoggedIn then
exit;
count:= countColorTolerance(1719429, minimap.button[MM_BUTTON_RUN].bounds, 11, colorSetting(2, 0.23, 1.34));
if count >= 280 then
result := 100
else
if count <= 10 then
result := 0
else
result := round((0.0009 * (count * count)) + (0.069 * count) + 3.7717);
print('Our 2nd degree polynomial prediction equation estimates run energy is: ' + toStr(result) + '%');
end;
{------------------------------------------------------------------------------)
Function: needToRest
Description: Determines if the player is low on energy.
Credits: TheMayor (Modified by Sparkyownage)
(------------------------------------------------------------------------------}
function needToRest(): boolean;
begin
result := runPercent <= PercentRest;
end;
{------------------------------------------------------------------------------)
Procedure: Rest
Description: Rests when low on energy.
Credits: TheMayor (Modified by Sparkyownage)
(------------------------------------------------------------------------------}
procedure Rest();
var
energy, x, y: integer;
restTimer : TTimeMarker;
begin
if not isLoggedIn then
exit;
energy := (70 + random(25));
if needToRest() then
begin
if (random(2) = 0) then // 1/3 or 33% chance of actually resting
begin
writeLn('Energy less than ' + toStr(runPercent) +'%, we need to rest');
if not minimap.isResting() then
begin
mouse(point(minimap.button[MM_BUTTON_RUN].center.x+random(4), minimap.button[MM_BUTTON_RUN].center.y+random(4)), MOUSE_MOVE);
fastClick(MOUSE_RIGHT);
wait(gaussRangeInt(100, 350));
if chooseOption.select(['est']) then
begin
paintStatus('Resting to regenerate energy');
restTimer.start();
repeat
if random(1) = 0 then
antiban();
wait(gaussRangeInt(1000, 2000));
until (runPercent() >= energy) or (restTimer.getTime() > 15000);
inc(Rested);
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
end;
end;
end;
end
{------------------------------------------------------------------------------)
Procedure: findBanker
Description: Locates the Banker
(------------------------------------------------------------------------------}
procedure findBanker();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
paintStatus('We are locating the banker');
findColorsSpiralTolerance(x, y, TPA, BANK_COLOUR, mainScreen.getBounds(), BANK_TOL, colorSetting(2, BANK_HUE, BANK_SAT));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ooth'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: takeOutHides
Description: Withdraws 28 Dragonhide using the first preset
(------------------------------------------------------------------------------}
procedure takeOutHides();
begin
if not isLoggedin() then
exit;
wait(randomRange(2000, 2250));
paintStatus('We are withdrawing the dragonhides');
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
end;
{------------------------------------------------------------------------------)
Procedure: WalktoTanner
Description:Uses SPS to walk from the bank to the tanner
(------------------------------------------------------------------------------}
procedure WalktoTanner();
var
pathtoTanner: TPointArray;
p: TPoint;
begin;
if not isLoggedin() then
exit;
if needToRest() then
rest();
wait(randomRange(500, 1000));
if(tabBackpack.count() = 28) then
begin
paintStatus('We are walking to the tanner');
pathtoTanner := [Point(237, 174), Point(213, 167), Point(193, 160), Point(185, 147), Point(175, 133), Point(163, 124), Point(153, 115), Point(147, 98), Point(162, 90)];
if SPS.walkPath(pathtoTanner) then
minimap.waitPlayerMoving()
end;
wait(randomRange(2000, 2500));
if(tabBackpack.count() < 28) then
wait(randomRange(2000, 2500));
if(tabBackpack.count() < 28) then
begin;
WriteLn('We failed to walk to the Tanner for some reason.');
scriptTerminate();
terminateScript();
end;
end;
{------------------------------------------------------------------------------)
Function: findSbott
Description: Locates Sbott(The Tanner) in his shop
(------------------------------------------------------------------------------}
function findSbott(): boolean;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedin() then
exit;
paintStatus('We are locating Sbott');
minimap.setangle(MM_DIRECTION_EAST);
wait(randomRange(100, 250));
findColorsSpiralTolerance(x, y, TPA, SBOTT_COLOR, mainScreen.getBounds(), SBOTT_TOL, colorSetting(2, SBOTT_HUE, SBOTT_SAT));
if length(TPA) < 1 then
begin
writeLn('Didn''t find any pixels that match Sbott''s colour!');
exit;
end;
ATPA := TPA.cluster(10, 10);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(MiddleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Sbott'], 500) then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['rade']);
smartImage.clearArea(mainscreen.getBounds());
exit(true);
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: TanHides
Description: Clicks on the tan option to tan the dragonhide into dragon leather
(------------------------------------------------------------------------------}
procedure tanHides();
var
RoyalBox: TBox;
begin;
if not isLoggedin() then
exit;
paintStatus('We are tanning the hides!');
wait(randomRange(2500, 3000));
RoyalBox := intToBox(285, 325, 510, 355);
mouseBox(RoyalBox, MOUSE_MOVE);
fastclick(MOUSE_LEFT);
wait(randomRange(50, 100));
end;
{------------------------------------------------------------------------------)
Procedure: WalktoBank
Description: Uses SPS to walk to the bank in Canifis
(------------------------------------------------------------------------------}
procedure WalktoBank();
var
pathtoBanker: TPointArray;
pathtoTanner: TPointArray;
begin;
if not isLoggedin() then
exit;
if needToRest() then
rest();
paintStatus('We are walking to the bank');
pathtoBanker := [Point(162, 90), Point(147, 98), Point(153, 115), Point(163, 124), Point(175, 133), Point(185, 147), Point(193, 160), Point(213, 167), Point(237, 174)];
if SPS.walkPath(pathtoBanker) then
minimap.waitPlayerMoving()
else
WriteLn('We failed to walk to the Bank');
end;
{------------------------------------------------------------------------------)
Procedure: Report
Description: Displays how many loads have been completed in te debug window
(------------------------------------------------------------------------------}
procedure Report();
var
TannedHides: integer
begin;
TannedHides := loadscomplete * 28
if not isLoggedin() then
exit;
writeLn('{-------------------------------------------------------}');
writeLn('{-------------------------------------------------------}');
writeLn('{-------------------------------------------------------}');
writeLn('{-------------------------------------------------------}');
writeLn('{-------------Canifis Tanner by Sparkyownage------------}');
writeLn(' Script has been running for: ' + timeRunning());
writeLn('{---------------We have completed ' + IntToStr(loadscomplete) + ' loads---------------}');
writeLn('{-----------We have tanned: ' + IntToStr(TannedHides) + ' Hides--------------------}');
writeLn('{-------------------------------------------------------}');
writeLn('{-------------------------------------------------------}');
writeLn('{-------------------------------------------------------}');
end;
{------------------------------------------------------------------------------)
The Main Loop
Description: Puts all of the above procedures and functions together in the
correct order
(------------------------------------------------------------------------------}
// main loop
begin
clearDebug(); // Clear the debug box
autoUpdateMe(); //Automatically updates the script
smartPlugins := ['D3d9.dll', 'opengl32.dll']; // Enables the Direct X plugin
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass
SPS.setup('Canifis_Map', RUNESCAPE_OTHER, 5, 775, 0.5);
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
repeat
findBanker();
takeOutHides();
WalktoTanner();
findSbott();
tanHides();
walktoBank();
antiban();
Inc(loadscomplete);
Report();
until (loadscomplete) = NumberOfLoads;
end.If you ultimately decide to vote no on this poll, please make a post telling me why. I'd love to know what I can improve on :)