SRL Archive - First Scripts

First script. Reflection ftw. Don't hate :)


kyleisntwild

2009-08-08 04:43:46

Well here is my first script.

I was surprised at how long it took me to make this. Actually writing the script did not take very long at all, but doing all the research and learning beforehand was a lot harder than I expected.

This is not the first script I have written to macro RS. A month or so ago I wrote a few scripts for a java bot called Optimusbot. The bot has since died and that is why I am back here trying to learn to script this stuff :). But man, java is sure easier than this pascal stuff. At least for writing scripts like this :p

Anyways, here is my first script. Its small enough to post in the thread but I will also attach it because that seems to be the preferred way around here :p

What its called: KIW Thief
What it does: pickpocket NPCs
I did take a few code snippets from other scripts, but they are all given credit and slightly modified.

v2:
program KIWthief;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}

{**********************************************************************
__ __ ______ __ __ ______ __ ___
/\ \/\ \ /\__ _\ /\ \ __/\ \ /\__ _\/\ \ __ /'___\
\ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \ \/_/\ \/\ \ \___ /\_\ __ /\ \__/
\ \ , < \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ _ `\/\ \ /'__`\ \ ,__\
\ \ \\`\ \_\ \__\ \ \_/ \_\ \ \ \ \ \ \ \ \ \ \ \/\ __/\ \ \_/
\ \_\ \_\ /\_____\\ `\___x___/ \ \_\ \ \_\ \_\ \_\ \____\\ \_\
\/_/\/_/ \/_____/ '\/__//__/ \/_/ \/_/\/_/\/_/\/____/ \/_/
By Kyleisntwild v2.0

Thanks to:
Seroko for all his help!
ZaSz for his awesome reflection tut.
Vilon for proof reading and various fixes.
Lancerawks aka Lance for his YakPwner script.
Runescapian and The Cnr Sport for their Ess Mining script.
Method for helping me with using reflection for experience tracking.

Only for use at : [url]http://www.villavu.com[/url]

************************************************************************}

var
Attempt, Fail, xp, exp: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Strings[0] := 'uard'; // NPC to pickpocket
Players[0].Integers[0] := 30; // Amount of Health to eat at
// Food Options : cakes, salmon, lobster, swordfish, monkfish, shark
end;


{******** Setup SMART ********}
procedure SetupSMART;
begin
Smart_Members := true;
Smart_Signed := true;
Smart_Server := 100;
Smart_SuperDetail := false;
end;

{******** Find Randoms ********}
procedure FindRandoms;
begin
FindNormalRandoms;
R_FindRandoms;
end;

{******** No Ban Hamma! ********}
procedure AntiBan;
begin
if (not (LoggedIn)) then
Exit;
case Random(60) of
0: RandomRClick;
1: GameTab(1 + Random(12));
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
end;
end;

{******** Disguise Title ********}
//Thanks to Seroko!
procedure UpdateDisguise;
begin
Disguise(Players[CurrentPlayer].name + ' has had a ' + IntToStr(Round(fail/attempt*100)) + '% fail rate and has gained ' + IntToStr(GetMySkill(17, false) - xp) + ' exp!');
end;

{******** Proggy ********}
// Thanks to Runescapian and The Cnr Sport
procedure Report;
begin
exp := GetMySkill(17, false) - xp;
ClearReport;
SRLRandomsReport;
addtoreport('===========================================');
addtoreport('| KIW Thief |');
addtoreport('===========================================');
addtoreport('|' + padr('Run Time: '+timerunning+'',35) +'|');
Addtoreport('|' + padr('Pickpocket Attempts: '+inttostr(Attempt)+'' , 35)+'|');
Addtoreport('|' + padr('Pickpocket Fails: '+inttostr(Fail)+'' , 35)+'|');
Addtoreport('|' + padr('EXP Gained: '+inttostr(exp)+'' , 35)+'|');
addtoreport('===========================================');
addtoreport('| By KyleIsntWild |');
addtoreport('===========================================');
Changereportwidth(400);
UpdateDisguise;
end;

{******** End Script ********}
// Thanks to Lance
procedure Terminate(Reason : String);
begin
writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
end;

{******** Check HP and Eat ********}
// Thanks to Seroko
procedure CheckHP;
var
HP: integer;
FoodIDs, ISlots : TIntegerArray ;
begin
HP := SmartGetFieldArrayInt(0, CurrentLevels, 3);
FoodIDs := [1896, 1894, 1892, 330, 386, 7947, 374, 380]
if (HP < Players[CurrentPlayer].Integers[0]) and (InventoryContainsMulti(FoodIDs, ISlots)) then
begin
MouseItem(ISlots[0],true);
Writeln('Eating.');
end else
if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
Terminate('Out of food');
end;

{******** Find and thieve NPC ********}
// Thanks to Seroko
procedure FindnThieveNPC;
var
N, P: TNPC;
T: TPoint;
begin
repeat
FindRandoms;
case GetAnimation of
-1: begin
if FindNPC(Players[0].Strings[0], N) then
begin
if not TileOnMS(N.Tile, 0) then
WalkToTile(N.Tile, 1, 0);
FindNPC(N.NPCType, P);
T := TileToMS(P.Tile, 0);
MMouse(P.MS.x, P.MS.y, 5, 5);
if IsupText(Copy(Players[0].Strings[0], 2, 3)) then
begin
Mouse(P.MS.x, P.MS.y, 0, 0, false);
R_ChooseOption('pocket');
Writeln('Found NPC. Pickpocketing...');
Inc(Attempt);
repeat
wait(100+random(100));
until not CharacterMoving;
Wait(RandomRange(500,1000));
end;
end;
end;
881: Wait(RandomRange(500, 2000));
424: begin
Writeln('Pickpocketing attempt failed. Stunned.');
Inc(Fail);
CheckHP;
AntiBan;
Wait(RandomRange(4500, 5000));
end;
end;
Report;
Until(false);
end;

begin
SetupSMART;
SetupSRL;
SetupReflection;
ClearDebug;
DeclarePlayers;
if not LoggedIn then LogInPlayer;
wait(1000);
xp := GetMySkill(17, false);
Attempt := 0;
Fail := 0;
SetAngle(True);
FindRandoms;
SetRun(true);
FindnThieveNPC;
end.

As you can see, mostly reflection. IMO reflection is far superior than color so I will be making all of my scripts with it. If you think its too easy or something, I don't care. :)

First run (4 lobbies and 30 thieving on Warrior Women in Ard) :

===========================================
| KIW Thief |
===========================================
|Run Time: 16 Minutes and 29 Seconds|
|Pickpocket Attempts: 141 |
|Pickpocket Fails: 42 |
|EXP Gained: 2002 |
===========================================
| By KyleIsntWild |
===========================================

I also just noticed that I never call the Antiban procedure lol. I'll get that fixed up later.

Please post comments and criticism :)

Thanks

rogeruk

2009-08-08 05:09:29

Program KIWthief;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}

{**********************************************************************
__ __ ______ __ __ ______ __ ___
/\ \/\ \ /\__ _\ /\ \ __/\ \ /\__ _\/\ \ __ /'___\
\ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \ \/_/\ \/\ \ \___ /\_\ __ /\ \__/
\ \ , < \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ _ `\/\ \ /'__`\ \ ,__\
\ \ \\`\ \_\ \__\ \ \_/ \_\ \ \ \ \ \ \ \ \ \ \ \/\ __/\ \ \_/
\ \_\ \_\ /\_____\\ `\___x___/ \ \_\ \ \_\ \_\ \_\ \____\\ \_\
\/_/\/_/ \/_____/ '\/__//__/ \/_/ \/_/\/_/\/_/\/____/ \/_/
By Kyleisntwild v1.0

Thanks to:
ZaSz for his awesome reflection tut.
Vilon for proof reading and various fixes.
Lancerawks aka Lance for his YakPwner script.
Runescapian and The Cnr Sport for their Ess Mining script.
Method for helping me with using reflection for experience tracking.

Only for use at : [url]http://www.villavu.com[/url]

************************************************************************}

Const
NPC = 'woman'; //NPC name

Type
TVariable = Record
FoodType: String;
End;

Var
Attempt, Fail, xp, Exp: Integer;
Variable: Array [0..0] Of TVariable;

{******** Player Setup ********}
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Variable[0].FoodType := 'lobster';
// Options: lobster, swordfish, monkfish, shark
End;

{******** Setup Smart ********}
Procedure SetupSMART;
Begin
Smart_Members := True;
Smart_Signed := True;
Smart_Server := 100;
Smart_SuperDetail := False;
End;

{******** Item IDs ********}
// Thanks to Lance for this
Function ItemID(i: String; inv: Boolean): Integer;
Begin
Case LowerCase(i) Of
'shark': Result := 385;
'monkfish': Result := 7946;
'swordfish': Result := 373;
'lobster': Result := 379;
End;
If inv Then
Begin
Result := Result + 1;
End;
End;

{******** Proggy ********}
// Thanks to Runescapian and The Cnr Sport
Procedure Report;
Begin
Exp := GetMySkill(17, False) - xp;
ClearReport;
Changereportwidth(400);
SRLRandomsReport;
addtoreport('===========================================');
addtoreport('| KIW Thief |');
addtoreport('===========================================');
addtoreport('|' + padr('Run Time: ' + timerunning + '', 35) + '|');
Addtoreport('|' + padr('Pickpocket Attempts: ' + IntToStr(Attempt) + '',
35) + '|');
Addtoreport('|' + padr('Pickpocket Fails: ' + IntToStr(Fail) + '', 35) + '|');
Addtoreport('|' + padr('EXP Gained: ' + IntToStr(Exp) + '', 35) + '|');
addtoreport('===========================================');
addtoreport('| By KyleIsntWild |');
addtoreport('===========================================');
End;

{******** End Script ********}
// Thanks to Lance for this
Procedure Terminate(Reason: String);
Begin
Writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
End;

{******** No Ban Hamma! ********}
Procedure AntiBan;
Begin
If (not (LoggedIn)) Then Exit;
Case Random(60) Of
0: RandomRClick;
1: GameTab(1 + Random(12));
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
End;
End;

{******** No Randoms Por Favor ********}
Procedure FindRandoms;
Begin
FindNormalRandoms;
R_FindRandoms;
End;

{******** Check HP and Eat ********}
// Thanks to Lance for this
Procedure HPCheck;
Var
slot: TIntegerArray;
B: TBox;
I: Integer;
Begin
If not LoggedIn Then Exit;
FindRandoms;
If HpPercent < 50 Then
Begin
Writeln('Eating');
GameTab(5);
Repeat
If InventoryContains(ItemID(Variable[CurrentPlayer].FoodType, True), slot) Then
Begin
For i := 0 To High(slot) Do
Begin
B := InvBox(slot[i]);
MouseBox(B.x1 + 15, B.y1 + 15, B.x2 - 15, B.y2 - 15, 1);
Wait(800 + RandomRange(100, 300));
If HpPercent > 70 Then
Begin
Exit;
End;
End;
End Else
Begin
Terminate('Out of food');
End;
Until (HpPercent > 70)
End;
End;

{******** Find and thieve NPC ********}
Procedure FindnThieveNPC;
Var
N, P: TNPC;
T: TPoint;
Begin
Repeat
If (GetAnimation = -1) Then // If no animation
Begin
If FindNPC(NPC, N) Then
Begin
If not TileOnMS(N.Tile, 0) Then WalkToTile(N.Tile, 1, 0);
FindNPC(N.NPCType, P);
T := TileToMS(P.Tile, 0);
Mouse(T.x, T.y, 5, 5, False);
ChooseOption('pocket');
Writeln('Found NPC. Pickpocketing...');
Inc(Attempt);
wait(2000 + Random(100));
End;
End Else If (GetAnimation = 881) Then // If pickpocketing
Begin
wait(2000 + Random(100));
FindRandoms;
End Else If (GetAnimation = 397) Then // If stunned
Begin
Writeln('Pickpocketing attempt failed. Stunned.');
Inc(Fail);
HPCheck;
wait(4000 + Random(2000));
FindRandoms;
End;
Report;
Until (False);
End;

{******** Main Loop ********}
Begin
SetupSMART;
SetupSRL;
SetupReflection;
ClearDebug;
DeclarePlayers;
If not LoggedIn Then LogInPlayer;
wait(2000);
xp := GetMySkill(17, False);
Attempt := 0;
Fail := 0;
SetAngle(True);
FindRandoms;
SetRun(True);
FindnThieveNPC;
End.

Altered standards if you require.

Looking good, as you stated AntiBan isnt called.

kyleisntwild

2009-08-08 05:25:32

From: rogeruk
Program KIWthief;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}

{**********************************************************************
__ __ ______ __ __ ______ __ ___
/\ \/\ \ /\__ _\ /\ \ __/\ \ /\__ _\/\ \ __ /'___\
\ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \ \/_/\ \/\ \ \___ /\_\ __ /\ \__/
\ \ , < \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ _ `\/\ \ /'__`\ \ ,__\
\ \ \\`\ \_\ \__\ \ \_/ \_\ \ \ \ \ \ \ \ \ \ \ \/\ __/\ \ \_/
\ \_\ \_\ /\_____\\ `\___x___/ \ \_\ \ \_\ \_\ \_\ \____\\ \_\
\/_/\/_/ \/_____/ '\/__//__/ \/_/ \/_/\/_/\/_/\/____/ \/_/
By Kyleisntwild v1.0

Thanks to:
ZaSz for his awesome reflection tut.
Vilon for proof reading and various fixes.
Lancerawks aka Lance for his YakPwner script.
Runescapian and The Cnr Sport for their Ess Mining script.
Method for helping me with using reflection for experience tracking.

Only for use at : [url]http://www.villavu.com[/url]

************************************************************************}

Const
NPC = 'woman'; //NPC name

Type
TVariable = Record
FoodType: String;
End;

Var
Attempt, Fail, xp, Exp: Integer;
Variable: Array [0..0] Of TVariable;

{******** Player Setup ********}
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Variable[0].FoodType := 'lobster';
// Options: lobster, swordfish, monkfish, shark
End;

{******** Setup Smart ********}
Procedure SetupSMART;
Begin
Smart_Members := True;
Smart_Signed := True;
Smart_Server := 100;
Smart_SuperDetail := False;
End;

{******** Item IDs ********}
// Thanks to Lance for this
Function ItemID(i: String; inv: Boolean): Integer;
Begin
Case LowerCase(i) Of
'shark': Result := 385;
'monkfish': Result := 7946;
'swordfish': Result := 373;
'lobster': Result := 379;
End;
If inv Then
Begin
Result := Result + 1;
End;
End;

{******** Proggy ********}
// Thanks to Runescapian and The Cnr Sport
Procedure Report;
Begin
Exp := GetMySkill(17, False) - xp;
ClearReport;
Changereportwidth(400);
SRLRandomsReport;
addtoreport('===========================================');
addtoreport('| KIW Thief |');
addtoreport('===========================================');
addtoreport('|' + padr('Run Time: ' + timerunning + '', 35) + '|');
Addtoreport('|' + padr('Pickpocket Attempts: ' + IntToStr(Attempt) + '',
35) + '|');
Addtoreport('|' + padr('Pickpocket Fails: ' + IntToStr(Fail) + '', 35) + '|');
Addtoreport('|' + padr('EXP Gained: ' + IntToStr(Exp) + '', 35) + '|');
addtoreport('===========================================');
addtoreport('| By KyleIsntWild |');
addtoreport('===========================================');
End;

{******** End Script ********}
// Thanks to Lance for this
Procedure Terminate(Reason: String);
Begin
Writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
End;

{******** No Ban Hamma! ********}
Procedure AntiBan;
Begin
If (not (LoggedIn)) Then Exit;
Case Random(60) Of
0: RandomRClick;
1: GameTab(1 + Random(12));
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
End;
End;

{******** No Randoms Por Favor ********}
Procedure FindRandoms;
Begin
FindNormalRandoms;
R_FindRandoms;
End;

{******** Check HP and Eat ********}
// Thanks to Lance for this
Procedure HPCheck;
Var
slot: TIntegerArray;
B: TBox;
I: Integer;
Begin
If not LoggedIn Then Exit;
FindRandoms;
If HpPercent < 50 Then
Begin
Writeln('Eating');
GameTab(5);
Repeat
If InventoryContains(ItemID(Variable[CurrentPlayer].FoodType, True), slot) Then
Begin
For i := 0 To High(slot) Do
Begin
B := InvBox(slot[i]);
MouseBox(B.x1 + 15, B.y1 + 15, B.x2 - 15, B.y2 - 15, 1);
Wait(800 + RandomRange(100, 300));
If HpPercent > 70 Then
Begin
Exit;
End;
End;
End Else
Begin
Terminate('Out of food');
End;
Until (HpPercent > 70)
End;
End;

{******** Find and thieve NPC ********}
Procedure FindnThieveNPC;
Var
N, P: TNPC;
T: TPoint;
Begin
Repeat
If (GetAnimation = -1) Then // If no animation
Begin
If FindNPC(NPC, N) Then
Begin
If not TileOnMS(N.Tile, 0) Then WalkToTile(N.Tile, 1, 0);
FindNPC(N.NPCType, P);
T := TileToMS(P.Tile, 0);
Mouse(T.x, T.y, 5, 5, False);
ChooseOption('pocket');
Writeln('Found NPC. Pickpocketing...');
Inc(Attempt);
wait(2000 + Random(100));
End;
End Else If (GetAnimation = 881) Then // If pickpocketing
Begin
wait(2000 + Random(100));
FindRandoms;
End Else If (GetAnimation = 397) Then // If stunned
Begin
Writeln('Pickpocketing attempt failed. Stunned.');
Inc(Fail);
HPCheck;
wait(4000 + Random(2000));
FindRandoms;
End;
Report;
Until (False);
End;

{******** Main Loop ********}
Begin
SetupSMART;
SetupSRL;
SetupReflection;
ClearDebug;
DeclarePlayers;
If not LoggedIn Then LogInPlayer;
wait(2000);
xp := GetMySkill(17, False);
Attempt := 0;
Fail := 0;
SetAngle(True);
FindRandoms;
SetRun(True);
FindnThieveNPC;
End.

Altered standards if you require.

Looking good, as you stated AntiBan isnt called.


Cool thanks :)

I was thinking of calling the Antiban when the animation is pickpocketing and when its stunned. Would that be too much? Maybe just when stunned… that would make more sense I guess.

Coh3n

2009-08-08 05:43:02

Nice for a first script. :)

end else
begin
Terminate('Out of food');
end;

You don't need the begin..end nest there, unless you have more than one line of code. An if..then statement will do only the first line of code, unless a begin..end nest is used. So, when you only want it to do one line, a begin..end is not needed.

As for the AntiBan, with a thieving script, to be honest, I don't know how much it is actually needed, considering you're always moving the mouse. I would suggest, for an antiban, have the character eat when they are stunned. I know when I do thieving in RS I always eat a slice of cake or two when I'm stunned.

Anyway, just a thought. ;)

I think it's pretty good for a first script, and I think you can do much better. :)

Cheers!

rogeruk

2009-08-08 05:43:49

Human-like id prob go with AntiBan during the stun. When im pickpocketing if i success i dont do anything just right click again, if i stun ill check my theiv xp / friends list etc.

Thats my opinion.

Seroko

2009-08-08 05:49:00

PM'd and helping :) We'll sort this out

Sandstorm

2009-08-08 07:46:08

Now, I know you said that you'd be using reflection, but you should at least attempt to make a color script like this. Color doesn't go outdated as quickly :P.

Nice as a first script though.

~Sandstorm

kyleisntwild

2009-08-08 07:58:58

From: Sandstorm
Now, I know you said that you'd be using reflection, but you should at least attempt to make a color script like this. Color doesn't go outdated as quickly :P.

Nice as a first script though.

~Sandstorm


Why? I honestly don't see the point. Reflection is way more accurate and precise.

You say color doesn't get outdated as quickly… which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates…

I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.

Coh3n

2009-08-08 08:05:06

From: kyleisntwild
Why? I honestly don't see the point. Reflection is way more accurate and precise.

You say color doesn't get outdated as quickly… which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates…

I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.


Wonderfully said. <3

Rep +

Sandstorm

2009-08-08 09:29:14

From: kyleisntwild
Why? I honestly don't see the point. Reflection is way more accurate and precise.

You say color doesn't get outdated as quickly… which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates…

I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.


Oh, I agree with you. Whenever I script for runescape nowadays I use reflection. I'm just saying, I, personally, think it's good to learn color first. That way when you get to something reflection can't handle (not often, but I find it DOES happen every so often), it comes in handy.

I was in a hurry last post, lol.

~Sandstorm

kyleisntwild

2009-08-08 10:23:50

From: Sandstorm
Oh, I agree with you. Whenever I script for runescape nowadays I use reflection. I'm just saying, I, personally, think it's good to learn color first. That way when you get to something reflection can't handle (not often, but I find it DOES happen every so often), it comes in handy.

I was in a hurry last post, lol.

~Sandstorm


No worries. :p

From: Seroko
PM'd and helping :) We'll sort this out


Thank you soo much!
This guy has helped me basically rewrite the entire script. Everything is working great atm.

I was going to toss this into the FFA section so others can use it too but I saw NCDS's NatThiever. His looks better than mine, and was recently updated, so I don't think mine is needed :p

Anyways, below (and attached) is v2. Seroko guided me step by step on the tricky thieving and eating procedures and I learned a ton. He is awesome :)

This script will thieve and NPC you want. Only problem is, it only has stun detection for Warrios and Guards atm lol (every npc has a different stun animation I guess). It eats a few types of food and many more can be added easily.

v2:
program KIWthief;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}

{**********************************************************************
__ __ ______ __ __ ______ __ ___
/\ \/\ \ /\__ _\ /\ \ __/\ \ /\__ _\/\ \ __ /'___\
\ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \ \/_/\ \/\ \ \___ /\_\ __ /\ \__/
\ \ , < \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ _ `\/\ \ /'__`\ \ ,__\
\ \ \\`\ \_\ \__\ \ \_/ \_\ \ \ \ \ \ \ \ \ \ \ \/\ __/\ \ \_/
\ \_\ \_\ /\_____\\ `\___x___/ \ \_\ \ \_\ \_\ \_\ \____\\ \_\
\/_/\/_/ \/_____/ '\/__//__/ \/_/ \/_/\/_/\/_/\/____/ \/_/
By Kyleisntwild v2.0

Thanks to:
Seroko for all his help!
ZaSz for his awesome reflection tut.
Vilon for proof reading and various fixes.
Lancerawks aka Lance for his YakPwner script.
Runescapian and The Cnr Sport for their Ess Mining script.
Method for helping me with using reflection for experience tracking.

Only for use at : [url]http://www.villavu.com[/url]

************************************************************************}

var
Attempt, Fail, xp, exp: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Strings[0] := 'uard'; // NPC to pickpocket
Players[0].Integers[0] := 30; // Amount of Health to eat at
// Food Options : cakes, salmon, lobster, swordfish, monkfish, shark
end;


{******** Setup SMART ********}
procedure SetupSMART;
begin
Smart_Members := true;
Smart_Signed := true;
Smart_Server := 100;
Smart_SuperDetail := false;
end;

{******** Find Randoms ********}
procedure FindRandoms;
begin
FindNormalRandoms;
R_FindRandoms;
end;

{******** No Ban Hamma! ********}
procedure AntiBan;
begin
if (not (LoggedIn)) then
Exit;
case Random(60) of
0: RandomRClick;
1: GameTab(1 + Random(12));
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
end;
end;

{******** Disguise Title ********}
//Thanks to Seroko!
procedure UpdateDisguise;
begin
Disguise(Players[CurrentPlayer].name + ' has had a ' + IntToStr(Round(fail/attempt*100)) + '% fail rate and has gained ' + IntToStr(GetMySkill(17, false) - xp) + ' exp!');
end;

{******** Proggy ********}
// Thanks to Runescapian and The Cnr Sport
procedure Report;
begin
exp := GetMySkill(17, false) - xp;
ClearReport;
Changereportwidth(400);
SRLRandomsReport;
addtoreport('===========================================');
addtoreport('| KIW Thief |');
addtoreport('===========================================');
addtoreport('|' + padr('Run Time: '+timerunning+'',35) +'|');
Addtoreport('|' + padr('Pickpocket Attempts: '+inttostr(Attempt)+'' , 35)+'|');
Addtoreport('|' + padr('Pickpocket Fails: '+inttostr(Fail)+'' , 35)+'|');
Addtoreport('|' + padr('EXP Gained: '+inttostr(exp)+'' , 35)+'|');
addtoreport('===========================================');
addtoreport('| By KyleIsntWild |');
addtoreport('===========================================');
UpdateDisguise;
end;

{******** End Script ********}
// Thanks to Lance
procedure Terminate(Reason : String);
begin
writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
end;

{******** Check HP and Eat ********}
// Thanks to Seroko
procedure CheckHP;
var
HP: integer;
FoodIDs, ISlots : TIntegerArray ;
begin
HP := SmartGetFieldArrayInt(0, CurrentLevels, 3);
FoodIDs := [1896, 1894, 1892, 330, 386, 7947, 374, 380]
if (HP < Players[CurrentPlayer].Integers[0]) and (InventoryContainsMulti(FoodIDs, ISlots)) then
MouseItem(ISlots[0],true)
Writeln('Eating.');
else
if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
Terminate('Out of food');
end;

{******** Find and thieve NPC ********}
// Thanks to Seroko
procedure FindnThieveNPC;
var
N, P: TNPC;
T: TPoint;
begin
repeat
FindRandoms;
case GetAnimation of
-1: begin
if FindNPC(Players[0].Strings[0], N) then
begin
if not TileOnMS(N.Tile, 0) then
WalkToTile(N.Tile, 1, 0);
FindNPC(N.NPCType, P);
T := TileToMS(P.Tile, 0);
MMouse(P.MS.x, P.MS.y, 5, 5);
if IsupText(Copy(Players[0].Strings[0], 2, 3)) then
begin
Mouse(P.MS.x, P.MS.y, 0, 0, false);
R_ChooseOption('pocket');
Writeln('Found NPC. Pickpocketing...');
Inc(Attempt);
repeat
wait(100+random(100));
until not CharacterMoving;
Wait(RandomRange(500,1000));
end;
end;
end;
881: Wait(RandomRange(500, 2000));
397, 424: begin
Writeln('Pickpocketing attempt failed. Stunned.');
Inc(Fail);
CheckHP;
AntiBan;
Wait(RandomRange(4500, 5000));
end;
end;
Report;
Until(false);
end;

begin
SetupSMART;
SetupSRL;
SetupReflection;
ClearDebug;
DeclarePlayers;
if not LoggedIn then LogInPlayer;
wait(1000);
xp := GetMySkill(17, false);
Attempt := 0;
Fail := 0;
SetAngle(True);
FindRandoms;
SetRun(true);
FindnThieveNPC;
end.


My proggy:
===========================================
| KIW Thief |
===========================================
|Run Time: 24 Minutes and 28 Seconds|
|Pickpocket Attempts: 269 |
|Pickpocket Fails: 49 |
|EXP Gained: 3588 |
===========================================
| By KyleIsntWild |
===========================================

Seroko's prog (beat me by 10 mins lol):
|Run Time: 34 Minutes and 42 Seconds|
|Pickpocket Attempts: 444 |
|Pickpocket Fails: 136 |
|EXP Gained: 8471

We both white screened lol.

So should run great for Warriors and Guards, if you want to use it for a different NPC, just gotta find the stun animation id and toss it in the thieving procedure :)

Added it to first post too. Post any comments or criticisms :)

Sandstorm

2009-08-08 10:53:25

Looks nice! If you want any more help, feel free to add my MSN.

[email]Hey321@runescapology.net[/email]

~Sandstorm

[JS]

2009-08-08 12:05:47

Yeah dude script looks great. I rep you for your reflection statements as I highly agree with you. The only reason i learned color was to start reflection and so i can eventually get SRL Members status. But yeah keep up the good work ;)

Iroki

2009-08-08 13:57:29

Nice first script, but i prefer color scripts.
Btw, I found one bug xD

if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
Terminate('Out of food');

it will stay logged in after all food is eaten so it'll looks suspicious :)

Method

2009-08-08 19:18:54

From: Iroki
Nice first script, but i prefer color scripts.
Btw, I found one bug xD

if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
Terminate('Out of food');

it will stay logged in after all food is eaten so it'll looks suspicious :)


I'm going to guess you just looked at the name of the function instead of the function itself. The code quite clearly logs out the player.

procedure Terminate(Reason : String);
begin
writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
end;

Smarter Child

2009-08-08 22:41:31

Looks, nice and i totally agree with ur comments. :p, n i guess coming from a java based bot, reflection would be easier than color, i assume?

Iroki

2009-08-09 00:21:15

From: Method
I'm going to guess you just looked at the name of the function instead of the function itself. The code quite clearly logs out the player.

procedure Terminate(Reason : String);
begin
writeln('Ending script. Reason:' + Reason);
Report;
Logout;
TerminateScript;
end;


Yeah, you're right. The name "Terminate" is similar to "TerminateScript", its similar for me :P, and thats why i posted that "I have found a bug".

cupcake

2009-08-10 06:00:31

nice script i would use but im not mem no more =\

ZaSz

2009-08-10 08:33:38

Im glad my ref tut could help

<3

kyleisntwild

2009-08-10 21:50:12

From: ZaSz
Im glad my ref tut could help

<3


Yes ty for your guide :) Was very helpful.

I fixed the one tiny error in the first post. I was missing a begin and end thing. I am pretty sure you get an animation of 424 when your stunned by any mob when your not wielding a weapon. So now the script should be compatible with ANY thievable monster as long as you dont equip a weapon. :)

Used it yesterday and got to 45 thieving, planning on getting 53 today :) then the script will be useless to me haha

Hillzee

2009-08-12 23:48:30

this worked great. forgot proggy will post later.