g2n
2012-01-02 16:44:36
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
no
Were you Referred to SRL?
Nickrules
What is your general programming knowledge?
HTML
CSS
php
javascript (little)
simba/scar (little)
Are you a member of any other communities?
gbatemp
JMU (my college)
Tell us about yourself…
Please show us one (or multiple) of your scripts.
My first script that I made was the Woot Loot. Currently, because of the color of the grand exchange (snow), it is currently inactive. It was my first experiment with movement based on colors on the minimap and picking up various random items. It is still unfinished, but I plan to finish it soon. Things I need to fix include: staying within the Grand Exchange area and better banking. Since it won't let me upload, I will copy paste:
I started working on a second script, in collaboration with SRL Member Nickrules. While the mining portion of the script is mostly his, what I've done is development for moving between bank and the mining spot, and a little work on the mining portion. What is most important is the knowledge learned. A version can be released that power mines and drops (shown below). This script was aimed for the free SRL community, and the soon-to-be released Members+ version allows for banking in free worlds. The script demonstrates knowledge of string manipulation for choosing which ore to mine at Al Kharid, and has an architecture to allow an array of TRocks, which allows for the mining of any rock (and more than one). Currently, the currentrocks is set to Rock_Iron (anti-leecher) so that it can't be easily edited by a leecher; but any SRL Member who understands the code can set it to look for any rock (by using Players[currentplayer].Arrays[0];). The architecture also allows for movement to be implemented (commented out for now). Color finding for the movement currently does not work. I am also still in the process of finding stable colors while moving in directions without roads.
Because of the holiday season (and no membership status), the member version isn't released yet. The powermining version that mines and drops all iron ore is shown below:
10 Year(s)
Are you affilated in anyway with Jagex LTD?
no
Were you Referred to SRL?
Nickrules
What is your general programming knowledge?
HTML
CSS
php
javascript (little)
simba/scar (little)
Are you a member of any other communities?
gbatemp
JMU (my college)
Tell us about yourself…
From: g2n
I am a Junior Engineer and a Computer Science major at James Madison University. I've been playing Runescape since classic and I generally don't have a lot of time to get the levels I want in the game. My interests are nerdy things involving math, strategy, science, and programming.
Please show us one (or multiple) of your scripts.
My first script that I made was the Woot Loot. Currently, because of the color of the grand exchange (snow), it is currently inactive. It was my first experiment with movement based on colors on the minimap and picking up various random items. It is still unfinished, but I plan to finish it soon. Things I need to fix include: staying within the Grand Exchange area and better banking. Since it won't let me upload, I will copy paste:
program WootLoot; //(c) g2n, firra, Matt M
// Do not modify this script without my permission.
// (except for Declare Players)
// Includes...
{$i srl/srl/misc/smart.scar}
{$i srl/srl.scar}
{$i SRL/SRL/Misc/stats.simba}
const
SRLStats_User = ''; // Your SRL Stats ID
SRLStats_Password = ''; // Your SRL Stats Password
var
Members: Boolean;
x, y: Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Supports 1 Player, Don't touch
NumberOfPlayers(HowManyPlayers); // Don't touch
CurrentPlayer := 0; // Don't touch
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Members := False; //Are you a member? (True = yes)
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
//Set BoxRewards to AntiRandom rewards
end;
procedure SetupLogin; // Logs Player In
var
Members: Boolean;
begin
ClearDebug;
Smart_Server := 2;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
SetupSRLStats(296, SRLStats_User, SRLStats_Password);
if (Members) then
begin
LoginPlayerToLob;
SelectWorld(2);
LoginPlayer;
Writeln('Logging In... (World 2)');
end else
begin
LoginPlayerToLob;
SelectWorld(1);
LoginPlayer;
Writeln('Logging In... (World 1)');
end;
end;
Procedure AntiBan; //Provides the Antiban (thanks putonajonny)
begin
case Random(900) of
0: HoverSkill('Attack', False);
1: HoverSkill('Strength', False);
2: HoverSkill('Defence', False);
3: HoverSkill('hitpoints', False);
4: HoverSkill('smithing', False);
5: HoverSkill('woodcutting', False);
6: HoverSkill('firemaking', False);
7: HoverSkill('magic', False);
8: HoverSkill('woodcutting', False);
9: HoverSkill('fishing', False);
10: HoverSkill('prayer', False);
11: HoverSkill('runecrafting', False);
12..15: PickUpMouse;
26..27: RandomRClick;
60..90: ExamineInv;
34: RandomAngle(True);
end;
Wait(2000+Random(500));
end;
procedure AntiRandoms; //Provides AntiRandoms
begin
FindNormalRandoms;
LampSkill := 'dungeoneering';
LevelUp;
end;
procedure GrabObject(x, y: Integer); //Picks up the object
begin
Writeln('Uptext Confirmed');
GetMousePos(x, y)
Mouse(x, y, 0, 0, True)
Writeln('Item Received');
end;
procedure MovePlayerAndMouse(x, y: Integer); //Moves Player to object and places cursor under player
begin
Writeln('Found Item on Minimap');
Mouse(x, y, 5, 5, True);
Flag;
MMouse(253, 182, 3, 3);
end;
procedure MainLoop; //Main Loop that finds objects and picks them up.
var
x, y: Integer;
i: Integer;
Clickpoints: TPointArray;
begin
Clickpoints :=
[Point(216, 145),
Point(292, 181),
Point(293, 216),
Point(253, 144),
Point(252, 216),
Point(216, 145),
Point(214, 180),
Point(212, 215)];
repeat
MakeCompass('N');
SetAngle(True);
if (FindColorSpiralTolerance(x, y, 524785, MMX1, MMY1, MMX2, MMY2, 50)) then
begin
MovePlayerAndMouse(x, y);
if WaitUptext('ake', 2000) then
begin
GrabObject(x, y);
end else
begin
for i := 0 to High(ClickPoints) do
MMouse(Clickpoints[i].x, Clickpoints[i].y, 5, 5);
if WaitUptext('ake', 2000) then
begin
GrabObject(x, y);
break;
end;
end;
end else
begin
Antiban;
AntiRandoms;
end;
until (InvFull)
OpenBankNPC;
DepositAll;
CloseBank;
end;
begin //Calls all functions
SetupLogin;
MainLoop;
end.
I started working on a second script, in collaboration with SRL Member Nickrules. While the mining portion of the script is mostly his, what I've done is development for moving between bank and the mining spot, and a little work on the mining portion. What is most important is the knowledge learned. A version can be released that power mines and drops (shown below). This script was aimed for the free SRL community, and the soon-to-be released Members+ version allows for banking in free worlds. The script demonstrates knowledge of string manipulation for choosing which ore to mine at Al Kharid, and has an architecture to allow an array of TRocks, which allows for the mining of any rock (and more than one). Currently, the currentrocks is set to Rock_Iron (anti-leecher) so that it can't be easily edited by a leecher; but any SRL Member who understands the code can set it to look for any rock (by using Players[currentplayer].Arrays[0];). The architecture also allows for movement to be implemented (commented out for now). Color finding for the movement currently does not work. I am also still in the process of finding stable colors while moving in directions without roads.
Because of the holiday season (and no membership status), the member version isn't released yet. The powermining version that mines and drops all iron ore is shown below:
program AlKharidMiner; //By Nickrules, additional credit to g2n
/////////////////////////////////////////////////////
// this is a powerminer in it's current state.
// If you think you know what you're doing
// everything needed for a multiplayer AKM
// (or anywhere you chose) is here.
// All you have to do is fill in some stuff...
// You have to figure out what on your own ;)
/////////////////////////////////////////////////////
// Includes...
{$i srl/srl/misc/smart.scar}
{$i srl/srl.scar}
{$i SRL/SRL/misc/paintsmart.scar}
//{$i SRL/SRL/Misc/stats.simba}
Type
TRock = record
Color: integer;
HMod: extended;
SMod: extended;
Tol: integer;
end;
var
Rock_Iron,
Rock_Coal,
Rock_Silver,
Rock_Gold,
Rock_Mithril: TRock;
Rocksmined:integer;
currentrocks: Array of TRock;
//////////////////////////////////////////
////////////SETUP BEGINS HERE/////////////
//////////////////////////////////////////
const
DrawOnSmart = true; //Debug TPAs?
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
LampSkill := 'dungeoneering';
With Players[0] do
begin
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
//Booleans[0] := False; //Bank? And no, this isn't the only thing to edit.
Booleans[1] := True; //pick in inv.?
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
//Set BoxRewards to AntiRandom rewards
end;
end;
function walking:boolean;
begin
Result := (PixelShift(inttobox(236,132,295,176),100) > 700);
end;
function mining:boolean;
begin
result := (PixelShift(inttobox(236,132,295,176),100) >300);
end;
Procedure DeclareRocks;
begin
with Rock_Gold do
begin
Color := 4045283;
HMod := 0.02;
SMod := 2.56;
Tol := 9;
end;
with Rock_Silver do
begin
Color := 16448253;
HMod := 0;
Smod := 21.43;
Tol := 3;
end;
with Rock_Mithril do
begin
Color := 8083800;
HMod := 0.03;
SMod := 0.2;
Tol := 19;
end;
With Rock_Iron do
begin
color := 3293028;
HMod := 0.06;
SMod := 1.18;
Tol := 11;
end;
With Rock_Coal do
begin
color := 1118481;
HMod := 8.34;
SMod := 1.43;
Tol := 2;
end;
end;
Procedure SetupScript;
begin
Smart_Server := 16;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
setupsrl;
DeclarePlayers;
cleardebug;
end;
Procedure SetupPlayer;
var x,y:integer;
begin
mousespeed := mousespeed + random (5);
LoginPlayer;
SetAngle(true);
SetRun(true);
currentrocks := [Rock_Iron];
end;
Procedure AntiBan; //Provides the Antiban
begin
case Random(500) of
10..30: HoverSkill('mining', False);
40..42: PickUpMouse;
26..27: RandomRClick;
60..90: ExamineInv;
end;
Wait(1000+Random(500));
end;
procedure AntiRandoms; //Provides AntiRandoms
begin
FindNormalRandoms;
LevelUp;
end;
{ NR_FindObjTPA * By Nickrules * Heavily documented, good for intermediates/beginers to learn from(?)
| = Finds an object using CTS2 and TPAs. Returns true if DidRedClick
| ------------------------------------------------------------------
| ====Color - Color of the object being searched for
| ====Tol - Tolerance allowed for the color
| ====Size - Size of the object, used for TPA splitting
| ====HMod - Hue Modifier for the color
| ====SMod - Saturation Modifier for the color
| ====ReCalc - Set to true if you wish to attempt to stop the
| player from moving after a misclick (clicks orig. tile.
| ====Uptext - Uptext of the object being searched for
| ------------------------------------------------------------------ }
function NR_FindObjTPA(color, tol, size:integer;HMod,SMod:extended; ReCalc:Boolean; uptext:string):Boolean;
var x,y,i,cts:integer;
tpa: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed; //get current CTS
ColorToleranceSpeed(2) //set CTS
SetColorspeed2Modifiers(Hmod,SMod); //set modifiers
freeze; //more accurate searching
FindColorsSpiralTolerance(x,y,TPA,color,MSX1,MSY1,MSX2,MSY2,tol); //searches for colors within the allowed tolerance on the MS
unfreeze; //unfreezes the canvas, allowing for new canvas info
if (High(tpa) <= 0) then writeln('color not found');
SetColorToleranceSpeed(CTS); //resets the CTS
Result := false; //There is only one way to result true. This reduces redundancy, by assuming false
ATPA := TPAtoATPA(TPA,size); //splits the TPA into an ATPA (set of mini TPAs) of the specified size
if DrawOnSmart then DrawDotsMulti(true,ATPA);
for i := 0 to high(ATPA) do
begin
MiddleTPAex(ATPA[i],x,y); //find the middle of the currently manipulated mini-TPA
MMouse(x,y,10,10) //move the mouse there
if WaitUptext(uptext,200) then //wait for the uptext, timeout after 100ms
begin
getmousepos(x,y) //We found the uptext, grab mouse coords (so there isn't any re-moving of the mouse
mouse(x,y,0,0,true); //Click :D
if DidRedClick then //Check if misclick
begin
result := true; //Result in true (yay!)
exit; //exit the function.
end;
if ReCalc then
begin
writeln('[Warning] - Misclick in FindObjTPA() - Attempting relocation');
mouse(mscx,mscy,15,15,true); //We misclicked (boo!). Clicks in the center of the screen to prevent lost..ness
wait(2500)
end;
end;
end;
end;
Function FindRock: boolean;
var i : integer;
begin
if not loggedin then exit;
FindNormalRandoms;
for i:=0 to high(CurrentRocks) do
if nr_findobjtpa(currentrocks[i].color, currentrocks[i].tol, 30, currentrocks[i].hmod,currentrocks[i].smod, true, 'ock') then
begin
//inc(rocksmined)
writeln('Rock clicked.');
break;
end;
end;
procedure MoveToBank;
begin
if not loggedin then exit;
end;
procedure MoveToNodes; //Moves to mining spot
begin
if not loggedin then exit;
end;
function GetDepth: integer;
begin
//if findddtm blah then result := 1; //etc.
end;
Procedure GoToDepth(from,To_:integer);
begin
if from = to_ then exit;
end;
Procedure HandleDepth;
begin
FindNormalRandoms;
//case depth of
//1: GoToDepth(1,2);
//etc.
//writeln('to be completed');
end;
Procedure ManageAllBanking;
begin
if not loggedin then exit;
{ if players[currentplayer].Booleans[0] then //if currentplayer is set to bank
begin
writeln('Walking to bank.');
MoveToBank;
writeln('At bank, depositing stuff!');
OpenBank('VEB',false,false);
if players[currentplayer].Booleans[1] then Deposit(2,28,27) else DepositAll;
writeln('Banking successful. Returning to mine.');
Inc(players[currentplayer].banked);
MoveToNodes;
writeln('At mine. Resuming mining.');
end else }
if players[0].Booleans[1] then DropAllExcept([1]) else DropAll;
end;
Procedure ManageAllMining;
var fails, locFails: integer;
begin
repeat
if not findrock then
begin
inc(fails);
if fails >= 10 then
begin; {
writeln('No rock found 10 times.');
inc(LocFails);
HandleDepth;
fails := 0; }
NextPlayer(false);
writeln('We dun can''t find any colors, setting player false');
end;
wait(1000+random(200));
{
if locFails >= 10 then
begin
nextplayer(false);
//writeln('We''ve moved to different areas 10 times with this player. We found ore in 0 of these places');
writeln('Setting false');
end; }
end else
begin
while walking do wait(500);
while mining do wait(500);
inc(rocksmined);
end;
until(not loggedin or invfull);
locfails := 0;
writeln('Load finished or player is false.');
end;
begin //Calls all functions
SetupScript;
SetupPlayer;
DeclareRocks;
Repeat
ManageAllMining;
ManageAllBanking;
until(not loggedin);
writeln('Done.');
// nr_findobjtpa(currentrocks[0].color, currentrocks[0].tol, 30, currentrocks[0].hmod,currentrocks[0].smod, true, 'ock')
end.