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:
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
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