microsphere
2013-03-16 19:28:59
How Long have You Played Runescape?
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
I took one data structures class at Carnegie Mellon University two summers ago. The rest is self-taught. I regularly use Ruby, JavaScript, Clojure, and Lua. I'm very competent with Ruby and decent with the others.
Are you a member of any other communities?
Any community or just botting ones?
This is the only botting community I've joined. Outside of it, I'm also a member of Hacker News, MetaFilter, and MeFightClub (the kindest gaming community that I know of.)
Tell us about yourself…
Please show us one (or multiple) of your scripts.
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
I took one data structures class at Carnegie Mellon University two summers ago. The rest is self-taught. I regularly use Ruby, JavaScript, Clojure, and Lua. I'm very competent with Ruby and decent with the others.
Are you a member of any other communities?
Any community or just botting ones?
This is the only botting community I've joined. Outside of it, I'm also a member of Hacker News, MetaFilter, and MeFightClub (the kindest gaming community that I know of.)
Tell us about yourself…
From: microsphere
Hi all,
I'm a high school senior living in St. Louis, Missouri. My memory is fuzzy, but I believe that I started playing Runescape late 2001 and quit in 2007. I came back to the old school servers for the nostalgia and stumbled across Villavu. The friendly atmosphere here is wonderful and SRL itself is awesome. Scripting for RS reminds me of the excitement that I had when I first learned how to program.
I'm applying for a membership because there seems to be a lot that I'm missing out on here. Members have access to resources that non-members don't. Just take a look at the OSR Script subforum. There's only one or two scripts there that can be learned from. The rest were created by people entirely new to scripting.
I have no interest in leeching, I would never gold farm, and I am a decent programmer. So while I'm not entirely sure of why an "SRL Member" rank is necessary, I don't think that it is for keeping people like me out. I would really appreciate the opportunity to continue contributing as a full member of this community.
Thanks for reading,
Dave
Please show us one (or multiple) of your scripts.
// http://villavu.com/forum/showthread.php?t=98406 - DTM file can be found here
// The DTMs might need to be created anew, but it should run smoothly after that.
// If you only look at one function, let it be "LoadDTMs".
// I plan on swapping DTMs out for DDTMs, ObjectDTMs (after the extension is updated for OSR), or SPS when I get the chance.
program Boomerang;
{$DEFINE SMART8}
{$i SRL-OSR/SRL.simba}
{$I SRL-OSR/srl/misc/SmartGraphics.simba}
const
DEBUG_ENABLED = True;
USING_TIARA = True; // Change this!
var
// T and B (There and Back) contain the minimap DTMs for each
// point along the path to the altar and bank
T: array of TIntegerArray;
B: array of TIntegerArray;
x, y, i, j: Integer;
runsCompleted: Integer;
aFound: Extended;
airTalismanBmp: Integer;
procedure Debug(message: string);
begin
if DEBUG_ENABLED then
writeln(message);
end;
procedure Die(message: string);
begin
writeln('[ERROR] ' + message);
{$IFDEF WINDOWS}
PlaySound('C:/Windows/Media/notify.wav');
{$ENDIF}
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := message;
LogOut;
end;
procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Active := true;
end;
end;
{*
LoadDTMs
path - path to the DTM file
*}
function LoadDTMs(path: string): array of array of TIntegerArray;
var
handle, curArr, waypointIndex, dtmIndex: Integer;
data: string;
lines: TStringArray;
dtmArrs: array of array of TIntegerArray;
begin
if not FileExists(path) then
begin
Die('DTM file ' + path + ' does not exist');
TerminateScript;
end;
handle := OpenFile(path, False);
ReadFileString(handle, data, FileSize(handle));
lines := srl_Explode(data, #13#10);
// The index of the current DTM array that we're defining
curArr := -1;
for i := 0 to High(lines) do
begin
// Skip empty lines and comments
if (Length(lines[i]) = 0) or StartsWith('//', lines[i]) then
continue;
// "Define DTMs" marks the beginning of a new DTM array
if lines[i] = 'Define DTMs' then
begin
SetLength(dtmArrs, Length(dtmArrs) + 1);
Inc(curArr);
waypointIndex := 0;
continue;
end;
try
waypointIndex := StrToInt(lines[i]);
// Calling SetLength every single time is inefficient, I know, but
// it's really not worth optimizing.
SetLength(dtmArrs[curArr], Length(dtmArrs[curArr]) + 1);
dtmIndex := 0;
except
// The current line is not an integer and therefore must be a DTM.
SetLength(dtmArrs[curArr][waypointIndex],
Length(dtmArrs[curArr][waypointIndex]) + 1);
try
if LowerCase(lines[i]) = 'stop' then
begin
// An unmatchable DTM. Useful for stopping the walk at a certain waypoint.
dtmArrs[curArr][waypointIndex][dtmIndex] := DTMFromString('m6wAAAHic42ZgYDBkYmDQB2I7IA4G4ilAPAmIHYHYGohVgPg0IwNDJRALAdWrA7ExEFsDsSkQxwPxdiDeC8QHgDgLiI8DsYHdGoaEYFcGQX4ehqpKWYa8KlkGTW8GBqdOT4aT4REMU1yYGFatFGF4ulqKgRTASAJGAgB/YxQE');
end else
dtmArrs[curArr][waypointIndex][dtmIndex] := DTMFromString(lines[i]);
except
Die('Invalid DTM at line ' + IntToStr(i));
TerminateScript;
end;
Inc(dtmIndex);
end;
end;
CloseFile(handle);
Result := dtmArrs;
end;
procedure AllocateMemory;
var
dtmArr: array of array of TIntegerArray;
begin
dtmArr := LoadDTMs('C:/Simba/Scripts/Boomerang.txt');
T := dtmArr[0];
B := dtmArr[1];
airTalismanBmp := BitmapFromString(8, 9, 'meJyLS8gID4/z8w9buXKLo6O7pZW9' +
'kZGZlpZeTGwaUDwgIAIo7uzsaWPjZGpqqaKiAeQCUVBQFJB0c/MBk' +
'hYWtkAtyck5QC1ALlCLl1cgRBlQKj29IDEpKzo6JTQ0BiIItAVoWl' +
'5+JZAdl5ARGZkIZPj4hgBNA6ovK2uASMEtAkoBra6qagVK5eSWQyw' +
'Cug2oHmgvULykpA6oJTOzCCgF9IidnYu+vgkAof5XJw==');
end;
procedure FreeMemory;
begin
for i := 0 to High(T) do
for j := 0 to High(T[i]) do
FreeDTM(T[i][j]);
for i := 0 to High(B) do
for j := 0 to High(B[i]) do
FreeDTM(B[i][j]);
FreeBitmap(airTalismanBmp);
end;
function FormatTime: string;
var
hours, minutes: Integer;
begin
if not LoggedIn then Exit;
minutes := GetTimeRunning / (60 * 1000);
hours := minutes / 60;
Result := IntToStr(hours) + ':';
if minutes < 10 then
begin
Result := Result + '0' + IntToStr(minutes);
end else
begin
Result := Result + IntToStr(minutes);
end;
end;
procedure DrawProgressReport;
var
text: array of string;
xpEarned: Integer;
begin
if not LoggedIn then Exit;
if USING_TIARA then
xpEarned := runsCompleted * 28 * 5
else
xpEarned := runsCompleted * 27 * 5;
text := ['Runs Completed: ' + IntToStr(runsCompleted),
'XP Earned: ' + IntToStr(xpEarned),
'Running for ' + FormatTime];
SMART_DrawTextMulti(True, True, text, Point(360, 280), UpChars07, $B36025);
end;
function FindWaypoint(DTM: Integer): Boolean;
begin
Result := FindDTMRotatedSE(DTM, x, y, MMX1, MMY1, MMX2, MMY2, 0, MATH_2PI, Pi / 60, aFound);
end;
procedure Walk(dtmArr: array of TIntegerArray);
var
waypointFound: Boolean;
time: Integer;
begin
// Iterate through dtmArr, clicking on each DTM when it appears
for i := 0 to High(dtmArr) do
begin
// Start running every so often
if randomRange(1, 100) <= 16 then
SetRun(true);
Debug('Looking for waypoint ' + IntToStr(i));
MarkTime(time);
waypointFound := False;
repeat
if TimeFromMark(time) > 30000 then
begin
Die('Lost the trail');
Exit;
end;
for j := 0 to High(dtmArr[i]) do
begin
if FindWaypoint(dtmArr[i][j]) then
begin
waypointFound := True;
break;
end;
end;
Wait(RandomRange(50, 75));
case RandomRange(1, 200) of
1: PickUpMouse;
2: RandomMovement;
3: SmallRandomMouse;
4: MMouseOffClient('random');
end;
until waypointFound;
Debug('Found waypoint ' + IntToStr(i) + ' (DTM #' + IntToStr(j) + ')');
Mouse(x, y, 3, 3, True);
end;
WaitNotMoving(True);
end;
procedure WalkToAltar;
begin
if not LoggedIn then Exit;
Debug('Walking to altar');
Walk(T);
Debug('Arrived at altar');
end;
procedure WalkToBank;
begin
if not LoggedIn then Exit;
debug('Walking to bank');
Walk(B);
debug('Arrived at bank');
end;
function FindBankBooth: Boolean;
var
CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not LoggedIn then Exit;
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.11, 0.34);
FindColorsTolerance(TPA, 3888489, MSX1, MSY1, MSX2, MSY2, 2);
SetColorToleranceSpeed(CTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if Length(ATPA) > 0 then
begin
Result := MiddleTPAEx(ATPA[0], x, y);
end else
Result := False
end;
procedure OpenBankBooth;
var
time: Integer;
begin
if not LoggedIn then Exit;
MarkTime(time);
repeat
FindBankBooth;
Mouse(x, y, 3, 3, False);
if WaitOptionMulti(['quickly', 'uick'], RandomRange(200, 300)) then
begin
repeat
Wait(RandomRange(50, 100));
until BankScreen;
Exit;
end;
until TimeFromMark(time) > 10000;
Die('Failed to open bank.');
end;
procedure DepositAndWithdraw;
var
// Inventory slot which contains our air runes
runesSlot: Integer;
begin
if not LoggedIn then Exit;
OpenBankBooth;
wait(RandomRange(300, 500));
if USING_TIARA then
runesSlot := 1
else
runesSlot := 2;
Deposit(runesSlot, runesSlot, True);
Wait(RandomRange(250, 500));
Debug('Deposited runes');
if Withdraw(0, 0, 0) then
Debug('Withdrew essence');
else
Die('Failed to withdraw essence');
end;
function FindRuins: Boolean;
var
CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(1.71, 0.53);
FindColorsTolerance(TPA, 4213576, MSX1, MSY1, MSX2, MSY2, 10);
SetColorToleranceSpeed(CTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if Length(ATPA) > 0 then
Result := MiddleTPAEx(ATPA[0], x, y)
else
Result := False
end;
function FindAltar: Boolean;
var
CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.46, 0.44);
FindColorsSpiralTolerance(x, y, TPA, 4409677, MSX1, MSY2 - 100, MSX2 - 3, MSY2 - 3, 11);
SetColorToleranceSpeed(CTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if Length(ATPA) > 0 then
Result := MiddleTPAEx(ATPA[0], x, y)
else
Result := False;
end;
function FindPortal: Boolean;
var
CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.07, 0.58);
FindColorsTolerance(TPA, 7117476, MSX1, MSY1, MSX2, MSY2, 8);
SetColorToleranceSpeed(CTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if Length(ATPA) > 0 then
Result := MiddleTPAEx(ATPA[0], x, y)
else
Result := False;
end;
procedure CraftRunes;
begin
if not LoggedIn then Exit;
MakeCompass('s');
SetAngle(SRL_ANGLE_HIGH);
if not USING_TIARA then
begin
GameTab(tab_Inv);
if FindBitmapToleranceIn(airTalismanBmp, x, y, MIX1, MIY1, MIX2, MIY2, 65) then
begin
Mouse(x, y, 3, 3, True);
Wait(RandomRange(75, 150));
end else
begin
Die('Failed to find talisman');
Exit;
end;
end;
if FindRuins then
begin
Mouse(x, y, 15, 15, True);
Wait(RandomRange(4000, 5000));
if FindAltar then
begin
MultiMouse(x + Random(3), y - RandomRange(10, 15), 70, 3, False);
Wait(RandomRange(5800, 6200));
// Wait after clicking "continue" on the level up dialogue
if LevelUp then
Wait(RandomRange(300, 600));
if FindPortal then
begin
Mouse(x, y + 3, 3, 3, True);
Wait(RandomRange(3000, 4000));
end else
begin
Die('Failed to find portal.');
Exit;
end;
end else
begin
Die('Failed to find altar');
Exit;
end;
end else
begin
Die('Failed to find ruins');
Exit;
end;
end;
begin
DeclarePlayers;
ActivateClient;
SetupSRL;
SMART_ClearCanvas;
SetScriptProp(SP_WriteTimeStamp, [True]);
Smart_FixSpeed := True;
AllocateMemory;
AddOnTerminate('FreeMemory');
if not LoggedIn then
LogInPlayer;
repeat
repeat
DrawProgressReport;
WalkToAltar;
CraftRunes;
WalkToBank;
DepositAndWithdraw;
Inc(runsCompleted);
until not LoggedIn;
NextPlayer(Players[CurrentPlayer].Active);
until False;
end.