Feroc1ty
2011-03-02 12:42:57
How Long have You Played Runescape?
9 Year(s)
Are you affilated in anyway with Jagex LTD?
no
Were you Referred to SRL?
dunno it was irl friend
What is your general programming knowledge?
a bit of c++
Are you a member of any other communities?
mmowned, used to create rogue scripts for javascript wow bot
Tell us about yourself…
Please show us one (or multiple) of your scripts.
9 Year(s)
Are you affilated in anyway with Jagex LTD?
no
Were you Referred to SRL?
dunno it was irl friend
What is your general programming knowledge?
a bit of c++
Are you a member of any other communities?
mmowned, used to create rogue scripts for javascript wow bot
Tell us about yourself…
From: Feroc1ty
i got balls, son
Please show us one (or multiple) of your scripts.
program ChickenFighter;
// -------- include settings --------
const
// SMART client settings
CLIENT_MEMBERS = false;
CLIENT_SERVER = 75;
CLIENT_SIGNED = true;
CLIENT_DETAIL = false;
{$i SRL/SRL/Misc/SMART.scar }
{$i SRL/SRL.scar }
{$i reflection/reflection.simba }
// ----------------------------------
// -------- script constants --------
const
// script settings
MAX_PLAYERS = 3; // how many people inside the pen before switching world
GET_FEATHERS = true; // pickup feathers?
FEATHER_ID = 314; // item ID of feather
EXP_PRIORITY = true; // will ignore some items to speed up the training process
LEVELED_SKILL = 'strength'; // which skill experience to track
DEBUG_ENABLED = false; // if enabled will display debug messages, but won't post proggies
SCRIPT_VERSION = 3;
// ----------------------------------
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
name := '';
nick := '';
pass := '';
pin := '';
active := true;
end;
end;
var
scriptStart:longint;
displayDebug:boolean;
origexp,feathers,lastcheck,checks,breaktime:integer;
lastran,changedtime,checkworldto,lastreport:longint;
pen:TBox;
function fTimeFromStart():string;
var tempi:longint;
temps:string;
begin
tempi := GetSystemTime - scriptStart;
tempi := Floor(tempi / 1000);
temps := IntToStr(tempi mod 60);
if Length(temps) < 2 then
temps := '0' + temps;
tempi := Floor(tempi / 60);
temps := IntToStr(tempi mod 60) + ':' + temps;
if Length(temps) < 5 then
temps := '0' + temps;
tempi := Floor(tempi / 60);
temps := IntToStr(tempi mod 60) + ':' + temps;
if Length(temps) < 8 then
temps := '0' + temps;
result := temps;
end;
Function TimeOfDay: string;
var
H, M, S, Ms: Word;
begin
DecodeTime(Now, H, M, S, Ms);
Result := (Padz(IntToStr(H), 2) + ':' + Padz(IntToStr(M), 2) + ':' + Padz(IntToStr(S), 2));
end;
procedure fDebug(loc,msg:string);
begin
if displayDebug then writeln(TimeOfDay + ' [ ' + loc + ' ] ' + msg);
end;
function PtToBox(tile:TPoint;size:integer):TBox;
begin
Result.X1 := Round(tile.x - size/2);
Result.X2 := Round(tile.x + size/2);
Result.Y1 := Round(tile.y - size/2);
Result.Y2 := Round(tile.y + size/2);
end;
function MouseInBox(box:TBox):boolean;
var pt:TPoint;
begin
GetMousePos(pt.x,pt.y);
result := PointInBox(pt, box);
end;
procedure ClickBox(box:TBox;left:boolean);
var x,y:integer;
begin
x := (box.x2 - box.x1)/2;
y := (box.y2 - box.y1)/2;
if not MouseInBox(box) then
MMouse(box.x1 + x + Random(RandomRange(-x,x)), box.y1 + y + Random(RandomRange(-y,y)), 0, 0);
ClickMouse2(left);
end;
procedure MoveBox(box:TBox);
var x,y:integer;
begin
x := (box.x2 - box.x1)/2;
y := (box.y2 - box.y1)/2;
if not MouseInBox(box) then
MMouse(box.x1 + x + Random(RandomRange(-x,x)), box.y1 + y + Random(RandomRange(-y,y)), 0, 0);
end;
// Credits to BobboHobbo for below procedure
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH 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, Shadow);
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 fInitialize(debug:boolean);
begin
scriptStart := GetSystemTime;
displayDebug := debug;
Smart_Members := CLIENT_MEMBERS;
Smart_Server := CLIENT_SERVER;
Smart_Signed := CLIENT_SIGNED;
Smart_SuperDetail := CLIENT_DETAIL;
fDebug('Initialization','Setting up SRL!');
fDebug('Initialization','Activating SMART Client!');
SetupSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
SmartSetDebug(true);
PrintOnSmart(['Feroc1ty'],Point(700, 0), 16743964, 5813189);
fDebug('Initialization','Initialization fully complete, took ' + IntToStr(GetSystemTime - scriptStart) + ' milliseconds!');
end;
procedure Initialize;
begin
// variables
checks := 0;
lastcheck := 0;
changedtime := GetSystemTime;
lastreport := GetSystemTime;
pen := IntToBox(3185,3276,3191,3279);
breaktime := (changedtime + ((60+random(120))*60*1000));
// initializing the include
fInitialize(DEBUG_ENABLED);
fDebug('Initialization','Will take the next break in '+tostr((breaktime-GetSystemTime)/60/1000)+' minutes.');
WorldSwitcherEnabled := false;
// login the character
LoginPlayer;
if not R_LoggedIn then LoginPlayer;
//adjust the camera
R_MakeCompass('n');
SetAngle(true);
end;
procedure AntiBan;
begin
case Random(600) of
0: IdleTime(2000, 1000, 0.2);
1: HoverSkill(LEVELED_SKILL, False);
2: RandomRClick;
3: PickUpMouse;
4: LevelUp;
5: BoredHuman;
6: ExamineInv;
end;
end;
procedure TakeABreak;
var time:integer;
begin
if GetSystemTime > breaktime then
begin
time := ((15+random(30))*60*1000);
fDebug('TakeABreak','Taking a break for '+tostr(round(time/60/1000))+' minutes.');
wait(time);
time := ((60+random(120))*60*1000);
fDebug('TakeABreak','Returning from a break, will break again in '+tostr(round(time/60/1000))+' minutes.');
breaktime := GetSystemTime + time;
end;
end;
function JudgeExperience(exp:integer):string;
begin
case exp of
0: result := 'Did you have trouble setting it up?';
1..499: result := 'Weak!';
500..999: result := 'What are you... level 0?';
1000..2499: result := 'Not bad...';
2500..4999: result := 'Hey, that''s some fine experience!';
5000..9999: result := 'Damn son, that''s gotta be worth something!';
10000..19999: result := 'Oooohhhh, spicey!';
20000..29999: result := 'Godlike!';
30000..49999: result := 'Dude... it would be a shame if you didn''t post this report.';
end;
end;
procedure PrintReport;
begin
if (DEBUG_ENABLED = false) and (GetSystemTime > lastreport + 5*60*1000) then
begin
lastreport := GetSystemTime;
ClearDebug;
writeln('Feroc1ty''s Chicken Fighter V.'+tostr(SCRIPT_VERSION));
writeln('');
writeln('Script uptime: ['+fTimeFromStart+']');
writeln('Experience gained: '+tostr(r_GetSkillExperience(LEVELED_SKILL)-origexp)+'.');
writeln('Feathers gained: '+tostr(feathers)+'.');
writeln('');
writeln(JudgeExperience(r_GetSkillExperience(LEVELED_SKILL)-origexp));
end;
end;
function CheckActivity:boolean;
begin
result := false;
if lastcheck = r_GetSkillExperience(LEVELED_SKILL) then
begin
if GetSystemTime > changedtime+60*1000 then
begin
fDebug('CheckActivity','The script has detected you are earning no experience.');
result := true;
end;
end else
begin
lastcheck := r_GetSkillExperience(LEVELED_SKILL);
changedtime := GetSystemTime;
end;
end;
function NpcInBox(npc:TNPC;box:TBox):boolean;
begin
result := PointInBox(npc.tile,box);
end;
function CharacterInPen():boolean;
begin
result := PointInBox(GetMyPos,pen);
if not result then fDebug('CharacterInPen','Character was found outside the pen.');
wait(50+random(50));
end;
function CharacterInHouse():boolean;
begin
result := PointInBox(GetMyPos,IntToBox(3184, 3270,3192, 3275));
if result then fDebug('CharacterInHouse','Character was found inside the house.');
wait(50+random(50));
end;
function NearbyPoint(point:TPoint;tiles:integer):boolean;
begin
result := DistanceFrom(point) <= tiles;
end;
function PickupItemNear(id,area:integer):boolean;
var ground:TGroundItemArray;
feather:TInvItem;
index,num:integer;
begin
ground := GetItemsNear(area);
R_ItemExists(FEATHER_ID,feather);
num := feather.StackSize;
for index := 0 to high(ground) do
begin
if (ground[index].ID = id) and PointInBox(ground[index].tile,IntToBox(3185,3276,3191,3279)) then
begin
ClickBox(PtToBox(TileToMS(ground[index].tile,30),8),false);
result := R_WaitOption('eather',300);
wait(100+random(75));
r_Flag;
R_ItemExists(FEATHER_ID,feather);
feathers := feathers + feather.stacksize - num;
break;
end;
end;
wait(random(50));
end;
function InteractWithTile(action:string;offset:TPoint;tile:TTile):boolean;
var pt:TPoint;
begin
result := false;
fDebug('InteractWithOBJ','Attempting to '+action+'.');
if not TileOnMS(tile,30) then WalkToTile(tile,1,0);
pt := TileToMS(tile,0);
pt.x := pt.x + offset.x;
pt.y := pt.y + offset.y;
MoveBox(PtToBox(pt,8));
Wait(100+random(125));
if R_IsUpText(action) then
begin
ClickMouse2(true);
result := true;
end else
begin
ClickMouse2(false);
result := R_ChooseOption(action);
end;
wait(500+random(150));
r_Flag;
end;
function InteractWithNPC(action:string;npc:TNPC):boolean;
var t:TNPC;
begin
fDebug('InteractWithNPC','Attempting to '+action+' (to) a '+npc.name+'.');
if not TileOnMS(npc.tile,30) then
begin
WalkToTile(npc.tile,1,1);
R_Flag;
end;
MoveBox(PtToBox(TileToMS(npc.tile,30),10));
Wait(100+random(125));
if R_IsUpText(action+' '+npc.name) then
begin
ClickMouse2(true);
result := true;
end else
begin
ClickMouse2(false);
if R_ChooseOption(action+' '+npc.name) then result := true;
end;
end;
procedure FinishFight(delay:integer);
var i:integer;
mob:TNPC;
begin
r_Flag;
wait(delay);
for i := 0 to 30 do
begin
if CharacterAnimating then i := 0;
wait(50);
if AreWeInteracting(mob) = false then break;
end;
end;
function FightNPC(name:string):boolean;
var mobs:TNPCArray;
index:integer;
begin
index := 0;
mobs := SortNPCs(GetNPCs(name));
for index := 0 to high(mobs) do
begin
if (mobs[index].fighting or mobs[index].moving or not NpcInBox(mobs[index],pen)) then
continue;
result := InteractWithNPC('attack',mobs[index]);
if result then FinishFight(200);
fDebug('FightNPC','Finished fighting.');
break;
end;
end;
function TooCrowded():boolean;
var people,pen:TPlayerArray;
i,y:integer;
begin
people := GetAllPlayers;
y := 0;
for i := 0 to high(people) do
begin
if PointInBox(people[i].tile,IntToBox(3185,3276,3191,3279)) then
begin
setlength(pen,y+1);
pen[y] := people[i];
y := y + 1;
end;
end;
if high(pen) >= MAX_PLAYERS then result := true;
fDebug('TooCrowded','Amount of players found: ' + tostr(high(pen))+'.');
end;
function CheckWorld:boolean;
var world:integer;
begin
if GetSystemTime > checkworldto + 60*1000 then
begin
checkworldto := GetSystemTime;
if TooCrowded then
begin
while not r_LobbyScreen do
begin
if LoggedIn then
ExitToLobby
else
LoginPlayerToLob;
end;
result := true;
world := RandomWorld(CLIENT_MEMBERS,false);
if world = CurrentWorld then
world := RandomWorld(CLIENT_MEMBERS,false);
fDebug('CheckWorld','Changing the world to '+tostr(world)+'.');
SelectWorld(world);
LoginPlayer;
end;
end;
end;
begin
Initialize;
origexp := r_GetSkillExperience(LEVELED_SKILL);
while true do
begin
PrintReport;
TakeABreak;
if not R_LoggedIn then
begin
LoginPlayer;
if not R_LoggedIn then exit;
end;
if r_FindRandoms then changedtime := GetSystemTime;
if CheckActivity then
begin
Logout;
fDebug('Main','Waiting for 10 minutes, will attempt to run again.');
wait(10*60*1000);
changedtime := GetSystemTime;
continue;
end;
if not NearbyPoint(Tile(3188, 3277), 15) then
begin
fDebug('Main','Character was located too far from the spot, checking for randoms.');
FindNormalRandoms;
if not NearbyPoint(Tile(3188, 3277), 15) then
begin
fDebug('Main','Character is still too far, please relocate him, logging off.');
Logout;
exit;
end;
end;
R_MakeCompass('n');
if not CharacterInPen then
begin
WalkToTile(Tile(3190, 3277),1,0);
if not CharacterInPen then
begin
if CharacterInHouse then
InteractWithTile('open',Point(0,-15),Tile(3189, 3276))
else
InteractWithTile('open',Point(0,0),Tile(3188, 3280));
end;
WalkToTile(Tile(3190, 3277),1,0);
end;
if FightNPC('Chicken') then
begin
end else
begin
Antiban;
PickupItemNear(FEATHER_ID,4);
end;
if not EXP_PRIORITY then PickupItemNear(FEATHER_ID,4);
if CheckWorld then changedtime := GetSystemTime;
PrintOnSmart(['Feroc1ty''s Fighter','Experience: '+tostr(r_GetSkillExperience(LEVELED_SKILL)-origexp),'Feathers: '+tostr(feathers),'Time('+fTimeFromStart+')'],Point(30, 15), 16777088, 15790080);
wait(100);
end;
end.