Progress Report:
program RangeGuilder;
{$i SRL/SRL/Misc/Smart.scar}
{$i SRL/SRL.scar}
{$i SRL\SRL\Misc\Stats.simba}
{[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]]
[ RangeGuilder ]
[ Camo Developer ]
[ Competes at the range guild and collects Archery Tickets for items ]
[ Version 1.2 ]
[][][][][][][][][][][][][][][][][][][]Setup[][][][][][][][][][][][][][][][][][]]
[ Be in the range guild next to the judge ]
[ Make sure you have a bow in hand ]
[ Make sure you have money in your inventory ]
[ Also, this script requires SPS ]
[][][][][][][][][][][][][][][][]Player Integers[][][][][][][][][][][][][][][][]]
[ Times to compete : Players[CurrentPlayer].Integers[0] ]
[][][][][][][][][][][][][][][][]Player Strings[][][][][][][][][][][][][][][][][]
[ Item to trade for : Players[CurrentPlayer].Strings[0] ]
[ You must fill it out exactly as follows: ]
[ 'Rune Arrows' ]
[ 'Barb bolttips' ]
[ 'Studded body' ]
[ 'Coif' ]
[ 'Green dhide body' ]
[ 'Adamant javalin' ]
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]]}
const
SRLStatsUserName = '';
SRLStatsPassword = '';
Version = '1.2'; (* Please do not touch *)
var
maxGames, startupTickets, totTickets, totGames, totItems : Integer;
procedure VersionCheck();
var
oVersion : string;
begin
oVersion := GetPage('http://srl.kyleundefined.com/Scripts/RangeGuilder/Version.txt');
if(oVersion <> Version)then
begin
WriteLn('The version you''re using is outdated!');
WriteLn('Downloading new version...');
if(WriteFileString(RewriteFile(ScriptPath + 'RangeGuilder.simba', True), GetPage('http://srl.kyleundefined.com/Scripts/RangeGuilder/RangeGuilder.txt')))then
WriteLn('Successfully downloaded the script! Please close the script and re-open to see the changes, thank you!');
TerminateScript;
end
else
WriteLn('You have the current version, good to go!');
end;
procedure DeclarePlayers();
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Your RuneScape Account Name
Pass := ''; // Your RuneScape Account Password
Active := True; // Use in the Script. True / False.
Integers[0] := 5; // How many times to compete
Strings[0] := 'Rune Arrows'; // What item to get with tickets
end;
end;
procedure AntiRandoms;
begin
if (not(LoggedIn)) then
Exit;
WriteLn('Checking for AntiRandoms');
FindNormalRandoms;
srl_InFight;
end;
function CalculateGameCount(): Integer;
var
coinAmt, x, y, i : Integer;
begin
if not Gametab(tab_Inv) then
Gametab(tab_Inv);
if FindCoins(x, y, 'inv') then
begin
i := CoordsToItem(x, y);
WriteLn('Found coins in Inventory Slot #' + IntToStr(i));
coinAmt := GetAmountBox(InvBox(i));
Result := (coinAmt / 200);
end else
begin
WriteLn('Couldn''t find coins in the inventory!');
WriteLn('Terminating the script!');
TerminateScript();
end;
end;
function CountTickets(): Integer;
var
x, y, i, ticketAmt : Integer;
begin
if FindColorTolerance(x, y, 5867118, MIX1, MIY1, MIX2, MIY2, 5) then
begin
i := CoordsToItem(x, y);
WriteLn('Found Archer Tickets in Inventory Slot #' + IntToStr(i));
ticketAmt := GetAmountBox(InvBox(i));
startupTickets := ticketAmt;
Result := ticketAmt;
end else
WriteLn('Did not find Archer Tickets in Inventory.');
end;
function FindJudge(var rx, ry : Integer) : Boolean;
var
TPA : TPointArray;
I, CTS : Integer;
ATPA : T2DPointArray;
o : TPoint;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.03);
FindColorsTolerance(TPA, 7235945, MSX1, MSY1, MSX2, MSY2, 9);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(Length(TPA) = 0)then
begin
WriteLn('FindJudge could not find any points.');
Exit;
end;
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAToATPA(TPA, 15);
for I := 0 to High(ATPA) do
begin
o := MiddleTPA(ATPA[i]);
MMouse(o.x, o.y, 3, 3);
if(WaitUptext('Judge', RandomRange(250, 750)))then
begin
Result := True;
GetMousePos(rx, ry);
Exit;
end;
end;
end;
procedure SetupScript();
begin
MakeCompass('N');
SetAngle(True);
SetRun(True);
Wait(RandomRange(1000, 1750));
maxGames := CalculateGameCount();
WriteLn('You can play a total of ' + IntToStr(maxGames) + ' games!');
totTickets := CountTickets();
WriteLn('You have ' + IntToStr(totTickets) + ' tickets');
end;
function CompeteJudge() : Boolean;
var
x, y, BronzeArrowsBmp : Integer;
begin
Wait(RandomRange(500, 750));
WriteLn('Locating Judge...');
if FindJudge(x, y) then
begin
AntiRandoms();
WriteLn('Judge located, attempting to compete...');
Mouse(x, y, 3, 3, False);
Wait(RandomRange(500, 750));
ChooseOption('Compete');
WriteLn('Talked to Judge.');
Wait(RandomRange(1000, 1250));
MouseBox(247, 392, 274, 405, 1);
Wait(RandomRange(400, 750));
ClickToContinue();
Wait(RandomRange(500, 750));
AntiRandoms();
BronzeArrowsBmp := BitmapFromString(10, 33, 'meJytUssKwjAQDCsigg+qFbFQqF' +
'poEYWeLCheFC/ePHjx4B/5zy4duuRVwUcIZTKzM7slUerXRT5M9Td' +
'cbIRkDBCt90xO0iKIM6rKgKEuD1feo2Q1mM2pOgJDzU73pLxM8y1v' +
'qMBQW8Oom5/JnArL4hkUu6OobCSnGGVNgVBh1IuVYwRpdRcjyrwdG' +
'bj5/zJa6kdG+SOvUQbzGkG+N/bHD95NRpbandQ1YiTdiBxdDeMnjC' +
'JJLz0KpEjKjKI6Si7UilLmgxGVx3YfUi+4MemVlHYRX6wXd5Uwgw==');
WriteLn('Looking for arrows...');
if FindBitmapToleranceIn(BronzeArrowsBmp, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
begin
Wait(RandomRange(500, 750));
WriteLn('We have the arrows! Equiping...');
Mouse(x, (y + 10), 2, 2, True);
WriteLn('Arrows equipped!');
Result := True;
end;
FreeBitmap(BronzeArrowsBmp);
AntiRandoms();
end;
end;
function FindTargets(var rx, ry : Integer) : Boolean;
var
TPA : TPointArray;
I, CTS : Integer;
ATPA : T2DPointArray;
o : TPoint;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.54);
FindColorsTolerance(TPA, 11300959, MSX1, MSY1, MSX2, MSY2, 1);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(Length(TPA) = 0)then
begin
WriteLn('FindTargets could not find any points.');
Exit;
end;
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAToATPA(TPA, 15);
for I := 0 to High(ATPA) do
begin
o := MiddleTPA(ATPA[i]);
MMouse(o.x, o.y, 3, 3);
if(WaitUptext('arget', RandomRange(250, 750)))then
begin
Result := True;
GetMousePos(rx, ry);
Exit;
end;
end;
end;
function RandomRangeEx(rFrom, rTo : Variant) : Variant;
var
r : Variant;
begin
r := RandomRange(Floor(rFrom), Ceil(rTo));
r := r + RandomE;
repeat
begin
if r <= rFrom then
r := r + RandomE
else if r >= rTo then
r := r - RandomE;
end;
until ((r >= rFrom) and (r <= rTo))
r := (Trunc(r * 100) / 100.00)
Result := r;
end;
function ShootTargets() : Boolean;
var
x, y, i : Integer;
bClicked : Boolean;
begin
AntiRandoms();
Wait(RandomRange(500, 750));
WriteLn('Locating Targets...');
SetAngle(False);
MakeCompass(36.87 + RandomRangeEx(-1.75, 1.75));
Wait(RandomRange(1000, 1250));
if FindTargets(x, y) then
begin
AntiRandoms();
WriteLn('Targets found!');
Wait(RandomRange(500, 1000));
MMouse(x, y, 3, 3);
Wait(RandomRange(750, 1250));
WriteLn('Spam firing at targets');
repeat
ClickMouse2(True);
Inc(I);
bClicked := ClickToContinue();
if(bClicked)then
Break;
until((i >= 75));
Inc(totGames);
Result := bClicked;
AntiRandoms();
end;
end;
procedure GetTickets();
var
x, y, i : Integer;
begin
Wait(RandomRange(500, 750));
WriteLn('Locating Judge...');
if FindJudge(x, y) then
begin
WriteLn('Judge located, attempting to get tickets...');
Mouse(x, y, 3, 3, True);
Wait(RandomRange(500, 750));
ClickToContinue();
WriteLn('Got the tickets!');
if FindColor(x, y, 5867118, MIX1, MIY1, MIX2, MIY2) then
begin
i := CoordsToItem(x, y);
totTickets := GetAmountBox(InvBox(i));
WriteLn('You now have ' + IntToStr(totTickets) + ' tickets!');
end;
end;
end;
function LoadItemCost(which : string) : Integer;
begin
case which of
'Rune Arrows' : Result := 1020;
'Barb bolttips' : Result := 114;
'Studded body' : Result := 51;
'Coif' : Result := 12;
'Green dhide body' : Result := 856;
'Adamant javalin' : Result := 292;
end;
end;
function WalkToTrader() : Boolean;
begin
AntiRandoms();
MakeCompass('N');
SetAngle(True);
MouseBox(584, 35, 602, 52, 1);
Wait(RandomRange(7500, 8500));
Result := True;
AntiRandoms();
end;
function FindTrader(var rx, ry : Integer) : Boolean;
var
TPA : TPointArray;
I, CTS : Integer;
ATPA : T2DPointArray;
o : TPoint;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.38);
FindColorsTolerance(TPA, 1516875, MSX1, MSY1, MSX2, MSY2, 4);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(Length(TPA) = 0)then
begin
WriteLn('FindTrader could not find any points.');
Exit;
end;
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAToATPA(TPA, 15);
for I := 0 to High(ATPA) do
begin
o := MiddleTPA(ATPA[i]);
MMouse(o.x, o.y, 3, 3);
if(WaitUptext('ercha', RandomRange(250, 750)))then
begin
Result := True;
GetMousePos(rx, ry);
Exit;
end;
end;
end;
function TraderScreen() : Boolean;
begin
Result := CountColor(2070783, MSX1, MSY1, MSX2, MSY2) > 0;
end;
function TradeTickets() : Boolean;
var
x, y : Integer;
box : TBox;
begin
AntiRandoms();
if WalkToTrader() then
begin
Wait(RandomRange(1000, 3500));
WriteLn('Locating Trader...');
if FindTrader(x, y) then
begin
AntiRandoms();
WriteLn('Found Trader!');
WriteLn('Attempting to trade...');
Wait(RandomRange(500, 750));
Mouse(x, y, 3, 3, False);
Wait(RandomRange(500, 750));
ChooseOption('rad');
Wait(RandomRange(750, 1250));
if TraderScreen() then
begin
case Players[CurrentPlayer].Strings[0] of
'Rune Arrows' : box := IntToBox(203, 80, 228, 105);
'Barb bolttips' : box := IntToBox(52, 83, 77, 103);
'Studded body' : box := IntToBox(132, 84, 153, 104);
'Coif' : box := IntToBox(283, 84, 307, 106);
'Green dhide body' : box := IntToBox(360, 86, 376, 109);
'Adamant javalin' : box := IntToBox(428, 81, 458, 108);
end;
Wait(RandomRange(1000, 1750));
MouseBox(box.X1, box.Y1, box.X2, box.Y2, 2);
Wait(RandomRange(500, 750));
Result := ChooseOption('uy');
Wait(RandomRange(250, 500));
Inc(totItems);
Wait(RandomRange(500, 750));
MouseBox(479, 35, 494, 50, 1);
AntiRandoms();
end;
end
else
WriteLn('Couldn''t find Trader!');
end;
end;
function WalkToJudge() : Boolean;
begin
AntiRandoms();
MakeCompass('N');
SetAngle(True);
MouseBox(671, 134, 680, 139, 1);
Wait(RandomRange(7500, 8500));
Result := True;
AntiRandoms();
end;
function CalculateItemsCollected(count : Integer) : Integer;
begin
case Players[CurrentPlayer].Strings[0] of
'Rune Arrows' : Result := count * 50;
'Barb bolttips' : Result := count * 30;
'Adamant javalin' : Result := count * 20;
else
Result := count;
end;
end;
procedure Report;
begin
AntiRandoms();
SRLRandomsReport;
stats_IncVariable('Coins Spent', (totGames * 200));
stats_IncVariable('Items Picked Up', totItems);
stats_IncVariable('Loads Done', totGames);
stats_IncVariable('Archery Tickets (Earned)', (totTickets - startupTickets));
Stats_Commit;
Writeln('========== RangeGuilder by Camo Developer V' + Version + ' ==========');
Writeln('===================================================');
Writeln('||===== Time Running : ' + TimeRunning);
Writeln('||===== Games Completed : ' + IntToStr(totGames));
Writeln('||===== Tickets Earned : ' + IntToStr(totTickets - startupTickets));
Writeln('||===== GP Spent : ' + IntToStr(totGames * 200));
WriteLn('||===== ' + Players[CurrentPlayer].Strings[0] + ' collected : ' + IntToStr(CalculateItemsCollected(totItems)));
Writeln('===================================================');
Writeln('===================================================');
Writeln('===================================================');
end;
procedure EndScript(reason : string);
begin
WriteLn('Could not ' + reason + '. Please make a post on the thread about the issue.');
Logout();
TerminateScript();
end;
begin
VersionCheck();
SMART_Members := True;
SMART_Signed := True;
SetupSRL();
SetupSRLStats(222, SRLStatsUserName, SRLStatsPassword);
SRLRandomsReport;
ClearDebug();
ActivateClient();
DeclarePlayers();
LoginPlayer();
SetupScript();
Wait(RandomRange(750, 1250));
repeat
if (CompeteJudge()) then
begin
Wait(RandomRange(750, 1250));
if (ShootTargets()) then
begin
Wait(RandomRange(750, 1250));
if totTickets >= LoadItemCost(Players[CurrentPlayer].Strings[0]) then
begin
if (TradeTickets()) then
begin
Wait(RandomRange(750, 1250));
if (not WalkToJudge()) then
EndScript('walk back to Judge');
end else
EndScript('trade tickets');
end;
end else
EndScript('fire at targets');
end else
EndScript('start competition');
Report();
until((totGames >= Players[CurrentPlayer].Integers[0]) or (totGames >= maxGames));
Report();
WriteLn('Thanks for running! Please post your progress reports! :)');
TerminateScript;
end.