SRL Archive - Archive

putonajonny - SRL Member Application


putonajonny

2011-12-15 20:29:58

How Long have You Played Runescape?
4 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
I am reliantly new to programming (only being 17) but I have some knowledge of C++ and Java as well as pascal.


Are you a member of any other communities?
Not largely, but I have tried to play a key role in this one, I developed and have maintained a Script Request Compilation Thread here


Tell us about yourself…
From: putonajonny
I am actually called Sam, I am 17 and I live in the United Kingdom. I became interested in runescape about 4 years ago. I'm currently doing my A-Levels but I'm not sure what I want to do in the distant future, however I have just applied to do Engineering at university next year.



Please show us one (or multiple) of your scripts.

The first Script is my Goblin Killer, this used my new way of declaring players, have a look closely and you will see, it is over 600 lines long and works well. It includes my own IsFighting function. It uses Arrays and has great failsafes and antibans



//This script kills goblins in lumbridge, It will even walk back if you die. Give me feedback in the forms.

program GoblinKiller;

{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}
{$i sps/sps.simba}
{$i SRL/SRL/Misc/stats.simba}
{$i SRL/SRL/misc/paintsmart.scar}
{.include SRL/SRL/Skill/Fighting.scar}
// {.include SRL/DeclarePlayers.scar}

Var
Location, x, y, TimeLast, Time, bones, i, attackedsinceburried, bonesburried, timespentb, TimeLastPainted, z, t : Integer;
Lumbridge, Goblins1, Goblins2, Goblins3: TPoint;
WalkGoblins: TPointArray;
Colours, BoneColours, PlayersToUse : TIntegerArray;
Ver, CurStatus : String;
DoneAntiban, PermissionToLocate, NoMoreBones, PtoLB, LootBones, JustLootBones : Boolean;

Const
Version = 3;
NCPColour1 = 4363920; //If the script won't fight the goblins then change these
NCPColour2 = 8029837;
NCPColour3 = 5994344;
NCPColour4 = 6516083;
WaitTime = 2000; //Wait Time before attacking another NCP
Tolerance = 3; //Colour Tolerence
HowOften = 0; //How often in seconds should it check the location? If it gets lost a lot lower this, if it is slow and is always checking location increase this
INeedHelp = False; //Do you need help setting this script up?
SRLStats_User = 'IDonthaveAnAccount'; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = '12345abcde'; // Your SRL Stats Password (If you dont have one then just leave it as it is)
TimeSpentBurrying = 10; //How much of the time should be spent burrying bones? Scale 1 to 10
ChangePlayerEvery = 60; //How often should it swap players
ReusePlayers = True; //Once all the players have been used should it start again or end?


procedure DeclarePlayers;
begin

LootBones := True; //Loot and bury bones?
JustLootBones := False; //Just loot and bury bones? (no combat) For an explanation of why these aren't constants look here: [url]http://villavu.com/forum/showthread.php?p=863322[/url]

// DeclareThePlayers; //If you are unsure about how to declare players then just run the script, all will become clear.
CurrentPlayer := 0; //You must set up players in the DeclarePlayers.scar file located at C:\Simba\Includes\SRL,
PlayersToUse := [0]; //to learn how to set that up go here: [url]http://putonajonnyscripts.hostoi.com/Help.htm[/url]
//****If that file does not exist then run this script, it will create it.*****

end; //no editing required below here...
Procedure SetBitmaps;
begin
bones := BitmapFromString(21, 18, 'meJx9k1lLQmEQhqVf4g8oiCKIbo' +
'wguu0i2mihbF9tQyRsEdO0PbHEss0WWwxLDGm/if5WDwwMH+dUMBy' +
'G+Wbe953lVLoaKlz1la6G8po6sbLq2hKHIx4/HBubwtGgmaBGodSa' +
'CFQdHV96vX4cp7NcIgr1j0kadnGRDQRWpZzv5dV9LJbUV4ESSYjXw' +
'qenj9u7/MlJBvF+f6DXPSjxQuHt7Ox6fSMWDEZ9vsWJiRmC0qYY+A' +
'eH6c3NOKQLi8H5+WW+pgAwpRDM5pZ2iYMJUTi8wZPHM4eZCrU2my1' +
'EIlsqRuIYdAQHBkdlzjc3j5YesWLxEwpBlioxWgZzaGhcM9/fv0HY' +
'208hFSeff3l9+0Ihc7BgijEKxcTJ5Yqp1Dm9JJOnmUzu4fFZZPf1D' +
'5PJ6IizFOIQ4Wst88eHiHaYA5msXmRPT3sxBKyE1nlNJI7T57cQ0S' +
'b6pQvZHbymNlpg/jgjI5Mzsz58EnZ2E/BChG8/G20E2dG1Hab6a9c' +
'YCs1jFtMrZYAwWqatJtrk8u1Hi7alpVBHZ4+Um2n6v8jhmbVsiplw' +
'twijX6WWqtIql/0HNMvZCNe7vb3HqBsbm/SPU1K7bwKKcnYEdWtbp' +
'1n+F6kFTdYHe1e328JuB/kBYKY/7Q==');

FreeBitmap(bones);
end;

Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer); //Thanks to BobboHobbo
var
mx, my, Pic, I, B, H, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
for I := 0 to High(TP) do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;

Procedure Paint;
begin
If((GetTimeRunning-TimeLastPainted)>5000) then
begin
PrintOnSmart(['Status:', CurStatus ], Point(42, 45), 16695040);
PrintOnSmart(['this script was written by putonajonny'], Point(270,359),16695040);
PrintOnSmart(['Time Running (Perodically Updated)',TimeRunning],Point(563,424),16695040);

TimeLastPainted := GetTimeRunning
end;
end;

function FindHPBars(Sx, Sy, x1, y1, x2, y2: Integer): TBoxArray; //this function is an exact copy of FindAllHPBars except the colours needed changing
var
a, b : TPointArray;
ATPA : T2DPointArray;
H, I : Integer;
begin
FindColorsSpiralTolerance(Sx, Sy, a, 524473, x1, y1, x2, y2, 0);
FindColorsSpiralTolerance(Sx, Sy, b, 51867, x1, y1, x2, y2, 0);
ATPA := TPAToATPAEx(CombineTPA(a, b), 55, 7);
H := High(ATPA);
SetLength(Result, Length(ATPA));
for I := 0 to H do
Result[i] := GetTPABounds(ATPA[i]);
end;
function GetHits(Sx, Sy, x1, y1, x2, y2: Integer): TIntegerArray; //this function is an exact copy of GetHitsIn but i needed to make it call FindHPBars not FindAllHPBars

var
E: Extended;
I, H: Integer;
TBA : TBoxArray;
begin
TBA := FindHPBars(Sx, Sy, x1, y1, x2, y2);
SetArrayLength(Result, GetArrayLength(TBA));
H := High(TBA);
for I := 0 To H Do
begin
E := CountColorTolerance(56488, TBA[i].x1, TBA[i].y1, TBA[i].x2, TBA[i].y2, 43) / 60;
Result[i] := Round(100 * E);
end;
end;

function IsFighting(Tolerance : Integer) : Boolean; //My function
var
Hits : TIntegerArray;
HP : Integer;
begin
Result := False
Hits := GetHits(253, 99, 0, 0, 764, 502);

if GetArrayLength(Hits) = 0 then
Exit;

HP := HPPercent
Result := ((HP-Tolerance) < Hits[0]) and ((HP+Tolerance) > Hits[0]);

if (GetArrayLength(Hits) > 1) and (not Result) then
Result := ((HP-Tolerance) < Hits[1]) and ((HP+Tolerance) > Hits[1]);
end;

Procedure CheckVersion;
Begin
CurStatus := 'Checking that you are running the most recent version'
Ver := GetPage('http://goblinkiller.webuda.com/Ver');
If Version = StrToInt(Ver) then
begin
WriteLn('You are using the most up to date version -Thank you');
end else
begin
If Version > StrToInt(Ver) then
begin
WriteLn('**You seem to be useing some sort of beta version, be careful')
end else
begin
ClearDebug;
WriteLn('Please Update This Script, opening web page...');
OpenWebPage('http://goblinkiller.webuda.com/Redirect');
TerminateScript; //Comment out this to use this version anyway
end;
end;
End;
Procedure CheckRandoms;
begin
CurStatus := 'Checking for Randoms'
Paint;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('I think we failed a random - I will just Check');
LoginPlayer;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('Client has Logged Out So Probably Failed a Random - Terminating Script');
TerminateScript;
end
end;
end;
Procedure CheckLocation;
begin
If((GetTimeRunning<60000) or ((GetTimeRunning-TimeLast)>HowOften*1000) or (PermissionToLocate)) then
begin
CurStatus := 'Checking Location'
Paint;
Wait(4000+Random(2000))
Location := 2;
if (SPS_PosOnMM(Lumbridge)) then
Location := 0; //lumbridge
if (SPS_PosOnMM(Goblins1)) or (SPS_PosOnMM(Goblins2)) or (SPS_PosOnMM(Goblins3)) then
Location := 1; //Goblins
TimeLast := GetTimeRunning
end;
end;
Procedure WalkToGoblins;
begin
CurStatus := 'Walking to Goblins'
Paint;

WalkGoblins := [Point(4708, 3767), Point(4733, 3767), Point(4753, 3761), Point(4759, 3743), Point(4748, 3723),
Point(4731, 3707), Point(4717, 3693), Point(4710, 3676), Point(4698, 3677), Point(4675, 3674),
Point(4648, 3678), Point(4625, 3675), Point(4598, 3677), Point(4580, 3676), Point(4565, 3676), Point(4565, 3650)]

If(SPS_WalkPath(WalkGoblins)) then
WriteLn('At Goblins');
end;
Procedure RectifyLocation;
begin
CurStatus := 'Rectifying Location'
Paint;
Mouse(254, 309, 10, 5, true);
Wait(250+Random(250));
Mouse(544, 24,5,5,true);

If (FindSymbol( x, y, 'fishing shop')) then //attempt 1
begin
WriteLn('using fishing shop to fix location')
CurStatus := 'using fishing shop to fix location'
Paint;
Wait(500+Random(200));
x := x-43
y := y-5
Mouse(x, y,5,5,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'dungeon')) then //attempt 2
begin
WriteLn('using dungeon to fix location')
CurStatus := 'using dungeon to fix location'
Paint;
Wait(500+Random(200));
x := x+66
y := y+7
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'fish')) then //attempt 3
begin
WriteLn('using fishing spot to fix location')
CurStatus := 'using fishing spot to fix location'
Paint;
Wait(500+Random(200));
x := x+59
y := y+68
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'water')) then //attempt 4
begin
WriteLn('using water to fix location')
CurStatus := 'using water to fix location'
Paint;
Wait(500+Random(200));
x := x-45
y := y+87
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'churn')) then //attempt 5
begin
WriteLn('using churn to fix location')
CurStatus := 'using churn to fix location'
Paint;
Wait(500+Random(200));
x := x-52
y := y+108
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

PermissionToLocate := True
CheckLocation;

case location of //final attempt
2: begin
Mouse(626,152,2,2,True)
Wait(2000+Random(1000));
end;
end;

PermissionToLocate := True
CheckLocation;

case location of
2:
begin
Writeln('Location Not Recognised - Lets Teleport Home')
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
Repeat
Wait(2000+Random(500));
If((GetTimeRunning - Time) > 15000) and (Not SPS_PosOnMM(Lumbridge)) then
begin
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
end;
Until(SPS_PosOnMM(Lumbridge));
PermissionToLocate := True;
Wait(2000+Random(1000))
end;
end;

end;
Procedure Attack;
begin
CurStatus := 'Attacking'
Paint;
If (FightNPC(Colours, Tolerance, WaitTime)) then
stats_IncVariable('Monsters Killed', 1)
else
SetAngle(True);
DoneAntiban := False;
attackedsinceburried := attackedsinceburried + 1
If (attackedsinceburried>(10-TimeSpentBurrying)) then
begin
PtoLB := True;
attackedsinceburried := 0
end;
end;
Procedure AntiBan;
begin
CurStatus := 'Antiban'
Paint;
If Not(DoneAntiban) then
begin
x := Random(51)
case x of
0: HoverSkill('Attack', False); //Beautiful Antiban
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;
16..25: RandomMovement;
26..27: RandomRClick;
28..32: BoredHuman;
33: ExamineInv;
34: RandomAngle(True);
35..48: Wait(1000+random(1000));
49..50: Wait(1000+Random(20000));
end;
DoneAntiban := True;
Wait(2000+Random(500));
end;
end;

function CreateDeclarePlayersFile : integer;
Var DecPlayScript : String;
begin
Result := 0;
If(Not DirectoryExists('C:\Simba\Includes\SRL')) then
CreateDirectory('C:\Simba\Includes\SRL');
If(Not FileExists('C:\Simba\Includes\SRL\DeclarePlayers.scar')) then
begin
Result := 1
DecPlayScript := GetPage('http://putonajonnyscripts.hostoi.com/DeclarePlayers')
If ((CreateFile('C:\Simba\Includes\SRL\DeclarePlayers.scar') = -1) or (not WriteFileString(0, DecPlayScript))) then
Result := 2;
WriteLn(FileSize(0));
CloseFile(0);
end;
end;

Procedure DeclarePlayersFile; //This procedure creates the declare players file if it doesn't exist
begin
Case CreateDeclarePlayersFile of
0: begin
Wait(200+Random(100)); //Didn't need to create the file
WriteLn('Good Luck!');
end;
1: begin
ClearDebug;
WriteLn('*************************************************************************************************')
WriteLn('This seems to be the first time you have used a script using this method of declaring players.')
WriteLn('Opening the help page on how to setup your players.')
WriteLn('***Please now uncomment lines 11 and 41***')
WriteLn('*************************************************************************************************')
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
TerminateScript;
end;
2: begin
WriteLn('an error occoured, opening a help page')
OpenWebPage('http://putonajonnyscripts.hostoi.com/Error.htm')
TerminateScript;
end;
end;


end;

Procedure BuryBones;
begin
CurStatus := 'Burying Bones'
Paint;
TimeSpentB := TimeSpentBurrying;
GameTab(25)
If (FindBitmapToleranceIn(bones, x, y, 546, 206, 735, 465, 15)) then
begin
Repeat
FreeBitmap(bones);
MMouse( x, y, 2, 2);
ClickMouse2(True);
bonesburried := bonesburried + 1;
stats_IncVariable('Bones (Burried)',1);
Wait(2000+Random(500));
NoMoreBones := not(FindBitmapToleranceIn(bones, x, y, 546, 206, 735, 465, 15))
TimeSpentB := TimeSpentB - 1
Until(NoMoreBones or (TimeSpentB <1))
end;
FreeBitmap(bones);
end;
Procedure Loot;
begin
CurStatus := 'Looting'
Paint;
BuryBones;
If((LootBones and PtoLB) or (JustLootBones)) then
begin
for i := 0 to GetArrayLength(BoneColours) do
begin
IF(FindColorTolerance(x, y, BoneColours[i], 0, 0, 516, 338, 10)) then
begin
Wait(400+Random(200))
Mouse( x, y, 2, 2, False);
(WaitOption('one', 2000));
stats_IncVariable('Bones (Collected)',1)
BuryBones;
end;
end;
Wait(3000+Random(500));
end;
end;
Procedure BonesProgress;
begin
CurStatus := 'Progress Report'
Paint;
If((((GetTimeRunning-Time)>15000) and (JustLootBones)) or ((GetTimeRunning-Time)>60000)) then
begin
WriteLn('')
WriteLn('')
WriteLn('[-------------------------------------------------------------------------------]');
WriteLn('[' + padr(padl('Bone Burrier by Putonjonny', 38 + Length('Bone Burrier by Putonjonny') / 2), 79) + ']');
WriteLn('[-------------------------------------------------------------------------------]');
WriteLn(PadR('[ Time Running: ' + TimeRunning, 80) + ']');
WriteLn(PadR('[ Bones Burried: ' + IntToStr(bonesburried), 80) + ']');
Writeln('[-------------------------------------------------------------------------------]');
WriteLn('')
Time := GetTimeRunning;
end;

end;
Procedure ChangePlayer;
begin
MarkTime(t)
z := z+1
If(LoggedIn) then
Logout;
if(z = GetArrayLength(PlayersToUse)) then
begin
case ReusePlayers of
True: z := 0;
False: begin
WriteLn('****All players Used and ReusePlayers is False so Ending Script****')
TerminateScript;
end;
end;
end;
SwitchToPlayer(PlayersToUse[z],ReusePlayers)
Repeat
LoginPlayer;
Wait(2000);
Until(LoggedIn)

end;
Procedure OpenHelpPage;
begin
ClearDebug;
WriteLn('You have not uncommented lines 11 and 44 or you have not setup the script correctly')
Wait(1000+Random(100)); //why have I put a random on this :S
WriteLn('You obvoiusly need some help...')
Wait(1000+Random(100));
WriteLn('Reaching out for help...')
Wait(1000+Random(100));
WriteLn('I cant find any...')
Wait(1000+Random(100));
WriteLn('It seems that nobody can help you now...')
Wait(1000+Random(100));
WriteLn('Oh wait...')
Wait(1000+Random(100));
WriteLn('Here we go... :)')
Wait(1000+Random(100));
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
WriteLn('')
WriteLn('')
WriteLn('')
Wait(250)
WriteLn('To Clarify: You have not uncommented lines 11 and 44 or you have not setup the script correctly.')
WriteLn('Please set up script again then restart.')
WriteLn('The Webpage that Just Opened should help.')
TerminateScript;
end;


begin
ClearDebug;
DeclarePlayersFile;
If (IneedHelp) then
begin
WriteLn('Opening Help Page');
OpenWebPage('http://goblinkiller.webuda.com/Help');
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
TerminateScript;
end;

CheckVersion;

CurStatus := 'Setting Up'
Lumbridge := Point(4706, 3767);
Goblins1 := Point(4570, 3650);
Goblins2 := Point(4570, 3650);
Goblins3 := Point(4570, 3650);
Colours := [NCPColour1,NCPColour2,NCPColour3,NCPColour4];
BoneColours := [13159633,13948382,11974847,9803164,9671578,8421510,14211810];
bonesburried := 0;
z := 0

Smart_Server := 11;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetupSRL;
SetupSRLStats(305, SRLStats_User, SRLStats_Password);
cleardebug;
Paint;
WriteLn('***************Goblin Killer by Putonajonny Version '+IntToStr(Version)+'***************');
CheckVersion;
SetBitmaps;


DeclarePlayers;

If(GetArrayLength(Players) = 0) then
begin
OpenHelpPage;
end;

LoginPlayer;


SPS_Areas := ['11_9'];
SPS_Setup(RUNESCAPE_SURFACE, SPS_Areas);

MarkTime(t);

If (JustLootBones) then
begin
SetAngle(True)
Repeat
If(TimeFromMark(t)>(60000*ChangePlayerEvery)) then
ChangePlayer;
Loot;
BonesProgress;
CheckRandoms;
Stats_Commit;
Until(false)
end;

Repeat
If(TimeFromMark(t)>60000*ChangePlayerEvery) then
ChangePlayer;
Paint;
SetAngle(True);
CheckRandoms;
Stats_Commit;
CheckLocation;
case location of
0: WalkToGoblins;
1:begin
Loot;
If(bonesburried>0) then
BonesProgress;
If(isfighting(10)) then
AntiBan
else
Attack;
end;
2: RectifyLocation;
else
RectifyLocation;
end;
until(false)
end.

My next Script is a Logging in and out bot that can be customized, it was requested in the link at the top of the script this demonstrates knowledge of Multiplayer Scripts.
//Script that logs in and out Specific Accounts, can do what you want once logged in.
//Requested Here: [url]http://villavu.com/forum/showthread.php?t=68663[/url]
//Uses Smart

program LogInAndOut;

{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}

Var
i, j : integer;
//---------------------- edit below this line ----------------------\\
Const
Version = 2;
NumberOfAccounts = 3;
NumberOfTimesToLoginEachAccount = 1;
WhatToDoWhilstLoggedIn = 'wait'; // Valid Arguments:
// wait - waits 20 - 40 seconds
// procedure - does your procedure (edit below)

Procedure DeclarePlayers;
begin

NumberOfPlayers(NumberOfAccounts);

//Player 1
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
CurrentPlayer := 0;

//Player 2
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Active := True;
CurrentPlayer := 0;

//Player 3
Players[2].Name := '';
Players[2].Pass := '';
Players[2].Active := True;
CurrentPlayer := 0;

//Keep Copying and Pasting for more

end;

Procedure WhatEverYouWant; //put here what you want this script to do once it loggs in
begin
wait(2000+random(2000))
//place code here
wait(2000+random(2000))
end;
//---------------------- don't edit below this line ----------------------\\
Procedure PlayerSwitch;
begin

i := i + 1;

if (i = NumberOfAccounts) then
begin
i := 0;
j := j + 1;
end;

SwitchToPlayer(i, True);

end;

begin

i := 0
j := 0

Smart_Server := 11;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
cleardebug;

WriteLn('***************LogIn and Out by Putonajonny Version '+IntToStr(Version)+'***************');
WriteLn('if you write anything really useful with this script please post it for everybody to use')
DeclarePlayers;
SwitchToPlayer(0,True);

Repeat
LoginPlayer;
WriteLn('Logged In - Now Waiting')
Case WhatToDoWhilstLoggedIn of
'wait' : Wait(20000+Random(20000)); //Waits Between 20 and 40 Seconds
'procedure' : WhatEverYouWant;
end;
WriteLn('Waited - Now Logging Out')
Logout;
PlayerSwitch;
Until(j = NumberOfTimesToLoginEachAccount);

WriteLn('Hope You Enjoyed')
end.

My next Script isn't runescape related, it just calculates pi (you know that number in maths) it is just quite fun to use, it can't get it to too much accuracy before the numbers becoming too big for extended's to take but have a go…
//Ever wanted some Pi? well this gets it for you, just a bit of fun, have a play around with it.

program CalculatePi;

Var
x, y, t, o, pi: extended;
n, j: integer;

Const
Iterations = 100; //Increase this to increase the accuracy of Pi
(* the biggest this can be put to is 46341 but i suggest you start low and go
higher, it is quite interesting to see the accuracy grow. *)

Procedure Percent;
begin
Writeln(InttoStr((n*100)/Iterations)+'%') //Comment out this line to significanty speed things up.
end;

begin
ClearDebug
n := 1 (*hello crazy people*)
t := 0
Repeat
x := (n*n)
y := 1 / x
t := t+y
n := n+1
j := Random(Iterations/100)
case j of
0: Percent;
end
If(x<0) then
Begin
WriteLn('x is too big for an extended to hold')
TerminateScript;
end;
Until(n=Iterations)

o := 6*t
pi := SQRT(o)

Writeln('When we do '+IntToStr(Iterations)+' then:')
Writeln('x =')
Writeln(x)
Writeln('y =')
Writeln(y)
Writeln('n =')
Writeln(n)
Writeln('t =')
Writeln(t)
Writeln('o =')
Writeln(o)
Writeln('pi =')
Writeln(pi)
end.

I hope you have enjoyed my scripts, this is just a selection so if there is anything key I have missed out chances are it is in one of my other script so just let me know…


Thanks
-putonajonny

Kyle Undefined

2011-12-15 20:33:12

I'm sorry, this script is just way too simple to apply for Members. It's a no for me.

Try showing your knowledge of the SRL Include and make a banking script. Or something that does a specific task, very well.

KingKong

2011-12-15 20:47:02

I agree with Camo. Although the script is large, you do not show any knowledge of TPA/ATPA/dtms. And i noticed that you don't have failsafes(no uptext whatsoever). Not to mention you have too many global variables.

Hobbit

2011-12-15 20:51:34

From: KingKong
I agree with Camo. Although the script is large, you do not show any knowledge of TPA/ATPA/dtms. And i noticed that you don't have failsafes(no uptext whatsoever).


That's not completely true. In his WalkToGoblins procedure he has 5 fall backs. So there is the concept of fail-safes there.

But I am also going to have to say no. Its an AMAZING start and you are quite close! Just add a little bit more like mentioned above (TPA/ATPA/DTMs) and a little bit more fail-safes (uptext). If you add those to the amazing start in the goblin script im sure you will have no issue getting in the next time around (If you don't this time)

Great start! I am impressed :)


Cheers
Hobbit

Kyle Undefined

2011-12-15 20:58:37

Well, when I voted his Goblin Killer wasn't on there. It's more advanced than the last two. I agree with Hobbit though. It's not nearly as simple as my post said (Since that wasn't on there), and is a very very very good start. If you just added failsafes and a little more advanced goblin finding, I would vote yes.

Daniel

2011-12-15 21:05:52

Shows commendable knowledge of the PASCAL language and a few inner workings of the SRL include as-well as use of a few external libraries (e.g. SPS). You know your mathematics and apply it well in a few algorithms I see throughout your script. You don't go overboard with your script and only use what is necessary to create a working script.

Your attitude shows that you want to learn and (I think) you are capable of understanding and implementing advanced concepts into your scripts you produce.

Yes.

putonajonny

2011-12-15 21:07:22

Thank you everybody for their feedback

NCDS

2011-12-15 21:12:54

I would vote yes if you showed just some knowledge of arrays used for object finding. I don't expect you to know multidimensional arrays, though they are good to know how to use.

KingKong

2011-12-15 21:33:59

From: Hobbit
That's not completely true. In his WalkToGoblins procedure he has 5 fall backs. So there is the concept of fail-safes there.


Why you "Psychotic Midget", picking on a KingKong :norris: ;)

I was talking about uptext failsafes because it's a fighting script after all and no matter how perfectly you can walk, its no use if the goblin isn't attacked, and yes i noticed he has other ways of walking if he was to get lost.

Griff

2011-12-15 21:40:23

You have a great attitude to learn, and your script is pretty good. Just remember failsafes, like KingKong said.

Yes.

grats

2011-12-15 21:44:55

You joined, learned very quickly.. have proven that you've learned quite a bit and it doesn't look like you're going to stop learning and getting better, so I voted yes

weequ

2011-12-15 22:03:34

Yes from me.

You might want to use
end else if..
with the stuff below.
Currently it would Click all of the symbols if all of them were on the minimap. If you use end else it will do up to one of them.
If (FindSymbol( x, y, 'fishing shop')) then    //attempt 1
begin
WriteLn('using fishing shop to fix location')
CurStatus := 'using fishing shop to fix location'
Paint;
Wait(500+Random(200));
x := x-43
y := y-5
Mouse(x, y,5,5,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'dungeon')) then //attempt 2
begin
WriteLn('using dungeon to fix location')
CurStatus := 'using dungeon to fix location'
Paint;
Wait(500+Random(200));
x := x+66
y := y+7
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'fish')) then //attempt 3
begin
WriteLn('using fishing spot to fix location')
CurStatus := 'using fishing spot to fix location'
Paint;
Wait(500+Random(200));
x := x+59
y := y+68
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'water')) then //attempt 4
begin
WriteLn('using water to fix location')
CurStatus := 'using water to fix location'
Paint;
Wait(500+Random(200));
x := x-45
y := y+87
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'churn')) then //attempt 5
begin
WriteLn('using churn to fix location')
CurStatus := 'using churn to fix location'
Paint;
Wait(500+Random(200));
x := x-52
y := y+108
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

Flight

2011-12-15 22:28:50

Yuz from me.

marpis

2011-12-16 00:41:42

It's a Yes from me. You clearly show a will to learn and understand to not only make your own procedures but to improve the existing SRL ones.
Please leave a few empty rows between functions, it's a pain to read that code.

Notelist:
  1. Standards!
  2. Making your script easier to read
  3. More standards!
  4. Learn TPA-based object finding
  5. Study the logics in your script better, like exiting the procedures when it's not necessary to continue
  6. Failsafes in general

Here you immediately free the bitmap you've just loaded. Does the burying work when you run the script?

//This script kills goblins in lumbridge, It will even walk back if you die. Give me feedback in the forms.
[SIMBA]
Procedure SetBitmaps;
begin
bones := BitmapFromString(21, 18, 'meJx9k1lLQmEQhqVf4g8oiCKIbo' +
'wguu0i2mihbF9tQyRsEdO0PbHEss0WWwxLDGm/if5WDwwMH+dUMBy' +
'G+Wbe953lVLoaKlz1la6G8po6sbLq2hKHIx4/HBubwtGgmaBGodSa' +
'CFQdHV96vX4cp7NcIgr1j0kadnGRDQRWpZzv5dV9LJbUV4ESSYjXw' +
'qenj9u7/MlJBvF+f6DXPSjxQuHt7Ox6fSMWDEZ9vsWJiRmC0qYY+A' +
'eH6c3NOKQLi8H5+WW+pgAwpRDM5pZ2iYMJUTi8wZPHM4eZCrU2my1' +
'EIlsqRuIYdAQHBkdlzjc3j5YesWLxEwpBlioxWgZzaGhcM9/fv0HY' +
'208hFSeff3l9+0Ihc7BgijEKxcTJ5Yqp1Dm9JJOnmUzu4fFZZPf1D' +
'5PJ6IizFOIQ4Wst88eHiHaYA5msXmRPT3sxBKyE1nlNJI7T57cQ0S' +
'b6pQvZHbymNlpg/jgjI5Mzsz58EnZ2E/BChG8/G20E2dG1Hab6a9c' +
'YCs1jFtMrZYAwWqatJtrk8u1Hi7alpVBHZ4+Um2n6v8jhmbVsiplw' +
'twijX6WWqtIql/0HNMvZCNe7vb3HqBsbm/SPU1K7bwKKcnYEdWtbp' +
'1n+F6kFTdYHe1e328JuB/kBYKY/7Q==');

FreeBitmap(bones);
end;


Crediting the original functions, very good.
If that fighting function works well, you should find a way to get rid of the tolerance parameter and we'll add it to SRL.
Also we might edit the colours of the bars, if yours work better.
function FindHPBars(Sx, Sy, x1, y1, x2, y2: Integer): TBoxArray;               //this function is an exact copy of FindAllHPBars except the colours needed changing
var
a, b : TPointArray;
ATPA : T2DPointArray;
H, I : Integer;
begin
FindColorsSpiralTolerance(Sx, Sy, a, 524473, x1, y1, x2, y2, 0);
FindColorsSpiralTolerance(Sx, Sy, b, 51867, x1, y1, x2, y2, 0);
ATPA := TPAToATPAEx(CombineTPA(a, b), 55, 7);
H := High(ATPA);
SetLength(Result, Length(ATPA));
for I := 0 to H do
Result[i] := GetTPABounds(ATPA[i]);
end;
function GetHits(Sx, Sy, x1, y1, x2, y2: Integer): TIntegerArray; //this function is an exact copy of GetHitsIn but i needed to make it call FindHPBars not FindAllHPBars

var
E: Extended;
I, H: Integer;
TBA : TBoxArray;
begin
TBA := FindHPBars(Sx, Sy, x1, y1, x2, y2);
SetArrayLength(Result, GetArrayLength(TBA));
H := High(TBA);
for I := 0 To H Do
begin
E := CountColorTolerance(56488, TBA[i].x1, TBA[i].y1, TBA[i].x2, TBA[i].y2, 43) / 60;
Result[i] := Round(100 * E);
end;
end;

function IsFighting(Tolerance : Integer) : Boolean; //My function
var
Hits : TIntegerArray;
HP : Integer;
begin
Result := False
Hits := GetHits(253, 99, 0, 0, 764, 502);

if GetArrayLength(Hits) = 0 then
Exit;

HP := HPPercent
Result := ((HP-Tolerance) < Hits[0]) and ((HP+Tolerance) > Hits[0]);

if (GetArrayLength(Hits) > 1) and (not Result) then
Result := ((HP-Tolerance) < Hits[1]) and ((HP+Tolerance) > Hits[1]);
end;

Version checking, nice!
Procedure CheckVersion;
Begin
CurStatus := 'Checking that you are running the most recent version'
Ver := GetPage('http://goblinkiller.webuda.com/Ver');
If Version = StrToInt(Ver) then
begin
WriteLn('You are using the most up to date version -Thank you');
end else
begin
If Version > StrToInt(Ver) then
begin
WriteLn('**You seem to be useing some sort of beta version, be careful')
end else
begin
ClearDebug;
WriteLn('Please Update This Script, opening web page...');
OpenWebPage('http://goblinkiller.webuda.com/Redirect');
TerminateScript; //Comment out this to use this version anyway
end;
end;
End;

This is a very nice CheckRandoms procedure, just fix your standards.
Procedure CheckRandoms;
begin
CurStatus := 'Checking for Randoms'
Paint;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('I think we failed a random - I will just Check');
LoginPlayer;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('Client has Logged Out So Probably Failed a Random - Terminating Script');
TerminateScript;
end
end;
end;

Here you might want it to check your position only once and find the location closest to you. Once you've found that you're at Lumbridge, you shouldn't need to check if your at Goblins, because you clearly aren't.
Procedure CheckLocation;
begin
If((GetTimeRunning<60000) or ((GetTimeRunning-TimeLast)>HowOften*1000) or (PermissionToLocate)) then
begin
CurStatus := 'Checking Location'
Paint;
Wait(4000+Random(2000))
Location := 2;
if (SPS_PosOnMM(Lumbridge)) then
Location := 0; //lumbridge
if (SPS_PosOnMM(Goblins1)) or (SPS_PosOnMM(Goblins2)) or (SPS_PosOnMM(Goblins3)) then
Location := 1; //Goblins
TimeLast := GetTimeRunning
end;
end;


Here you could use a local variable instead.
Procedure WalkToGoblins;
begin
CurStatus := 'Walking to Goblins'
Paint;

WalkGoblins := [Point(4708, 3767), Point(4733, 3767), Point(4753, 3761), Point(4759, 3743), Point(4748, 3723),
Point(4731, 3707), Point(4717, 3693), Point(4710, 3676), Point(4698, 3677), Point(4675, 3674),
Point(4648, 3678), Point(4625, 3675), Point(4598, 3677), Point(4580, 3676), Point(4565, 3676), Point(4565, 3650)]

If(SPS_WalkPath(WalkGoblins)) then
WriteLn('At Goblins');
end;


Here you should exit the procedure after a successfull attempt to relocate, now your script may click multiple times for no use.
Procedure RectifyLocation;
begin
CurStatus := 'Rectifying Location'
Paint;
Mouse(254, 309, 10, 5, true);
Wait(250+Random(250));
Mouse(544, 24,5,5,true);

If (FindSymbol( x, y, 'fishing shop')) then //attempt 1
begin
WriteLn('using fishing shop to fix location')
CurStatus := 'using fishing shop to fix location'
Paint;
Wait(500+Random(200));
x := x-43
y := y-5
Mouse(x, y,5,5,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'dungeon')) then //attempt 2
begin
WriteLn('using dungeon to fix location')
CurStatus := 'using dungeon to fix location'
Paint;
Wait(500+Random(200));
x := x+66
y := y+7
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'fish')) then //attempt 3
begin
WriteLn('using fishing spot to fix location')
CurStatus := 'using fishing spot to fix location'
Paint;
Wait(500+Random(200));
x := x+59
y := y+68
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'water')) then //attempt 4
begin
WriteLn('using water to fix location')
CurStatus := 'using water to fix location'
Paint;
Wait(500+Random(200));
x := x-45
y := y+87
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

If (FindSymbol( x, y, 'churn')) then //attempt 5
begin
WriteLn('using churn to fix location')
CurStatus := 'using churn to fix location'
Paint;
Wait(500+Random(200));
x := x-52
y := y+108
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;

PermissionToLocate := True
CheckLocation;

case location of //final attempt
2: begin
Mouse(626,152,2,2,True)
Wait(2000+Random(1000));
end;
end;

PermissionToLocate := True
CheckLocation;

case location of
2:
begin
Writeln('Location Not Recognised - Lets Teleport Home')
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
Repeat
Wait(2000+Random(500));
If((GetTimeRunning - Time) > 15000) and (Not SPS_PosOnMM(Lumbridge)) then
begin
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
end;
Until(SPS_PosOnMM(Lumbridge));
PermissionToLocate := True;
Wait(2000+Random(1000))
end;
end;

end;

Procedure Attack;
begin
CurStatus := 'Attacking'
Paint;
If (FightNPC(Colours, Tolerance, WaitTime)) then
stats_IncVariable('Monsters Killed', 1)
else
SetAngle(True);
DoneAntiban := False;
attackedsinceburried := attackedsinceburried + 1
If (attackedsinceburried>(10-TimeSpentBurrying)) then
begin
PtoLB := True;
attackedsinceburried := 0
end;
end;

Nice antiban.
Procedure AntiBan;
begin
CurStatus := 'Antiban'
Paint;
If Not(DoneAntiban) then
begin
x := Random(51)
case x of
0: HoverSkill('Attack', False); //Beautiful Antiban
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;
16..25: RandomMovement;
26..27: RandomRClick;
28..32: BoredHuman;
33: ExamineInv;
34: RandomAngle(True);
35..48: Wait(1000+random(1000));
49..50: Wait(1000+Random(20000));
end;
DoneAntiban := True;
Wait(2000+Random(500));
end;
end;

I'm not sure what you're doing here, but I really like the idea "Seems like you're a first time user" :)
function CreateDeclarePlayersFile : integer;
Var DecPlayScript : String;
begin
Result := 0;
If(Not DirectoryExists('C:\Simba\Includes\SRL')) then
CreateDirectory('C:\Simba\Includes\SRL');
If(Not FileExists('C:\Simba\Includes\SRL\DeclarePlayers.scar')) then
begin
Result := 1
DecPlayScript := GetPage('http://putonajonnyscripts.hostoi.com/DeclarePlayers')
If ((CreateFile('C:\Simba\Includes\SRL\DeclarePlayers.scar') = -1) or (not WriteFileString(0, DecPlayScript))) then
Result := 2;
WriteLn(FileSize(0));
CloseFile(0);
end;
end;

Procedure DeclarePlayersFile; //This procedure creates the declare players file if it doesn't exist
begin
Case CreateDeclarePlayersFile of
0: begin
Wait(200+Random(100)); //Didn't need to create the file
WriteLn('Good Luck!');
end;
1: begin
ClearDebug;
WriteLn('*************************************************************************************************')
WriteLn('This seems to be the first time you have used a script using this method of declaring players.')
WriteLn('Opening the help page on how to setup your players.')
WriteLn('***Please now uncomment lines 11 and 41***')
WriteLn('*************************************************************************************************')
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
TerminateScript;
end;
2: begin
WriteLn('an error occoured, opening a help page')
OpenWebPage('http://putonajonnyscripts.hostoi.com/Error.htm')
TerminateScript;
end;
end;


end;

It's good that you take care of freeing your bitmaps, but it seems you're not doing it right. You can't free a bitmap twice, it will cause a terminal error.
Also, you can't use a bitmap in FindBitmapToleranceIn after you've free'd it.
Procedure BuryBones;
begin
CurStatus := 'Burying Bones'
Paint;
TimeSpentB := TimeSpentBurrying;
GameTab(25)
If (FindBitmapToleranceIn(bones, x, y, 546, 206, 735, 465, 15)) then
begin
Repeat
FreeBitmap(bones);
MMouse( x, y, 2, 2);
ClickMouse2(True);
bonesburried := bonesburried + 1;
stats_IncVariable('Bones (Burried)',1);
Wait(2000+Random(500));
NoMoreBones := not(FindBitmapToleranceIn(bones, x, y, 546, 206, 735, 465, 15))
TimeSpentB := TimeSpentB - 1
Until(NoMoreBones or (TimeSpentB <1))
end;
FreeBitmap(bones);
end;

You report the bones collected wheter or not the white color you hovered actually was bones:
Procedure Loot;
begin
CurStatus := 'Looting'
Paint;
BuryBones;
If((LootBones and PtoLB) or (JustLootBones)) then
begin
for i := 0 to GetArrayLength(BoneColours) do
begin
IF(FindColorTolerance(x, y, BoneColours[i], 0, 0, 516, 338, 10)) then
begin
Wait(400+Random(200))
Mouse( x, y, 2, 2, False);
(WaitOption('one', 2000));
stats_IncVariable('Bones (Collected)',1)
BuryBones;
end;
end;
Wait(3000+Random(500));
end;
end;


Here you could just open the page, right? :rolleyes:
Procedure OpenHelpPage;
begin
ClearDebug;
WriteLn('You have not uncommented lines 11 and 44 or you have not setup the script correctly')
Wait(1000+Random(100)); //why have I put a random on this :S
WriteLn('You obvoiusly need some help...')
Wait(1000+Random(100));
WriteLn('Reaching out for help...')
Wait(1000+Random(100));
WriteLn('I cant find any...')
Wait(1000+Random(100));
WriteLn('It seems that nobody can help you now...')
Wait(1000+Random(100));
WriteLn('Oh wait...')
Wait(1000+Random(100));
WriteLn('Here we go... :)')
Wait(1000+Random(100));
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
WriteLn('')
WriteLn('')
WriteLn('')
Wait(250)
WriteLn('To Clarify: You have not uncommented lines 11 and 44 or you have not setup the script correctly.')
WriteLn('Please set up script again then restart.')
WriteLn('The Webpage that Just Opened should help.')
TerminateScript;
end;

marpis

2011-12-16 00:43:08

All you voters: remember that our beloved leader WT-Fakawi has stated that the threshold for SRL Members status should be lowered.

Harry

2011-12-16 00:49:48

You have quite a bit of coord clicking. Be careful with that.

Nava2

2011-12-16 01:18:45

Careful with using Symbols for walking, but I like how you did use them as fail safes.

I'd love to see some more TPAs from you and other array based mechanics.

Its a yes from me. Keep up the attitude. :)

Sir R. M8gic1an

2011-12-16 07:01:08

I think you haven't tested the script and thats pretty much a straightaway no from me…. not having uptext will surely make your script not run as good as it could… other than that you're on a good path and with some cleaning up you'll definitely be getting members soon.

-RM

Hobbit

2011-12-24 01:33:11

IN!

Welcome :)