SCAR Code:
program Chickenator; // by n3ss3s
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Amount.scar}
{.include SRL/SRL/Extended/xAutoTalk.scar}
{.include SRL/SRL/Skill/Fighting.scar}
{ __________________________________________________________________
/ TOAG additional credits and other crap \
| 1. Credits to SRL Team ofcourse |
| 2. Credits to RuneHQ and their skills section. Helped me a lot :) |
| 3. Credits to StarBlaster for making the scripting competition |
| 4. SRL Community, without it I propably wouldnt even know about SCAR.|
| 5. Jagex , I wouldnt be able to do this without you!!! |
| 6. EVERY SINGLE SCRIPTING TUTORIAL IN INTERNET!!! |
| 7. Slayer for keeping me coding!! :) |
\ __________________________________________________________________ /
INSTRUCTIONS :
1: Set your players at the chicken hut near windmill( Lumby - Draynor)
2: Drag crosshair.
3: Hit play logged out!
4: Answer the questions (you know what this means when you run script.
}
{
List of knows bugs
* The info about equiped arrows doesnt work. Not important.
I did not use DDTM's since there were some good
differences in the environment and I can use FreeBitmap.
Now I have to continue testing the script
And I can not spend time on learning DDTM's
Actually I already learned them, but I propably
am missing something because I couldnt get em workking
So, now its bitmapped.
This actually aint a bug, but if a chicken is running
when trying to click it, it may have to click like 3 times
or let another play catch it.
But, that can be count as antiban :)
}
// Const
const
Arrows = 'bronze'; // bronze iron steel mithril adamantite. not "addy"
Style = 'rapid'; // accurate rapid longrange
StartPlayer = 0; // You dont need explanation.
FlagLog = True; // Log out if maybe flagged?
// Misc variables
var
YouEquiped: Integer;
// DTMs and Bitmaps, related.
var
LandMark: Integer;
Arrow: Integer;
Arrowss: Integer;
// Time marks
var
FightMark: Integer;
ScriptStart: Integer;
// Arrays , stuff like that
var
MPA: array[1..12] of string;
PAQ: array[1..12] of string;
PlayerArrows: array[1..4] of Boolean;
///////////////////////////////////////
// End of variables. DO NOT GO UNDER //
///////////////////////////////////////
procedure LoadPAQ;
begin
PAQ[1] := 'Player 0 Username';
PAQ[2] := 'Player 0 Password';
PAQ[3] := 'Player 0 Nick';
PAQ[4] := 'Player 1 Username';
PAQ[5] := 'Player 1 Password';
PAQ[6] := 'Player 1 Nick';
PAQ[7] := 'Player 2 Username';
PAQ[8] := 'Player 2 Password';
PAQ[9] := 'Player 2 Nick';
PAQ[10] := 'Player 3 Username';
PAQ[11] := 'Player 3 Password';
PAQ[12] := 'Player 3 Nick';
end;
procedure LoadMPA;
var I: Integer;
begin
for I := 1 to 12 do
begin
case I of
1: MPA[I] := ReadLn(PAQ[I]);
2: MPA[I] := ReadLn(PAQ[I]);
3: MPA[I] := ReadLn(PAQ[I]);
4: MPA[I] := ReadLn(PAQ[I]);
5: MPA[I] := ReadLn(PAQ[I]);
6: MPA[I] := ReadLn(PAQ[I]);
7: MPA[I] := ReadLn(PAQ[I]);
8: MPA[I] := ReadLn(PAQ[I]);
9: MPA[I] := ReadLn(PAQ[I]);
10: MPA[I] := ReadLn(PAQ[I]);
11: MPA[I] := ReadLn(PAQ[I]);
12: MPA[I] := ReadLn(PAQ[I]);
end;
end;
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 4;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;
Players[0].Name := MPA[1];
Players[0].Pass := MPA[2];
Players[0].Nick := MPA[3];
Players[0].Active := True;
Players[1].Name := MPA[4];
Players[1].Pass := MPA[5];
Players[1].Nick := MPA[6];
Players[1].Active := True;
Players[2].Name := MPA[7];
Players[2].Pass := MPA[8];
Players[2].Nick := MPA[9];
Players[2].Active := True;
Players[3].Name := MPA[10];
Players[3].Pass := MPA[11];
Players[3].Nick := MPA[12];
Players[3].Active := True;
end;
procedure Load;
begin
Arrow := BitmapFromString(6, 10, 'z78DA8D8F4B0A80300C44AF34F969B' +
'76AEF7F26A563305041679196BE479286FB667B8C8A110D597983' +
'F088C5BB2B2B9E8841910F850A42F4D31921AD0E6984295A75AE0' +
'D5B4ACB218E5E9D7943529A77CFE9A7A4C5C959A50FA9794E7A73' +
'FEE40459A04749');
LandMark := BitmapFromString(14, 12, 'z78DAE5D13D0E80200C80D12B4152' +
'5A1915DAFB1F496D178C29F107274BF2A5D34B00AA285148CB3AB' +
'6D38C104B5A608A72BD41871AF3200F35AD029C196DFF9BC9C0D3' +
'68B3FDAF94EF9958316D47EBC95890033F333DDF4C7BE1731976C' +
'7DA37FBF56EF4C6F4FCF0D9AC98D7E11C');
Arrowss := BitmapFromString(12, 5, 'z78DA333630024230303435353632B' +
'080B08D11E25059643546A686E628E20678650D0D4C0D8DB09983' +
'A20619A0ABC704C826605189C32F587461BA04430D15000094694' +
'4A7');
end;
procedure CompassMMouse(Dx, Dy, RandX, RandY, Degrees, Direction, LowHigh: Integer);
var I, Cx, V, Cy, DirAdj, VertAdj, CMark: Integer;
Path: TPointArray;
begin
GetMousePos(Cx, Cy);
Path := MakeMouseSplinePath(Cx, Cy, Dx, Dy, 7, 50, 40);
repeat
for I := 0 to Degrees / 10 do
begin
DirAdj := Direction;
VertAdj := LowHigh;
case DirAdj of
1: begin
case VertAdj of
1: begin
KeyDown(VK_LEFT);
Wait(1 + random(1));
KeyDown(VK_UP);
Wait(10 + random(5));
KeyUp(VK_UP);
KeyUP(VK_LEFT);
end;
2: begin
KeyDown(VK_LEFT);
Wait(1 + random(1));
KeyDown(VK_DOWN);
Wait(10 + random(5));
KeyUp(VK_DOWN);
KeyUP(VK_LEFT);
end;
end;
end;
2: begin
case VertAdj of
1: begin
KeyDown(VK_RIGHT);
Wait(1 + random(1));
KeyDown(VK_UP);
Wait(10 + random(5));
KeyUp(VK_UP);
KeyUP(VK_RIGHT);
end;
2: begin
KeyDown(VK_RIGHT);
Wait(1 + random(1));
KeyDown(VK_DOWN);
Wait(10 + random(5));
KeyUp(VK_DOWN);
KeyUP(VK_RIGHT);
end;
end;
end;
end;
MarkTime(CMark);
while (TimeFromMark(CMark) < 10) do
begin
MMouse(Path[V].x, Path[V].y, RandX, RandY);
V := V + 1;
end;
end;
until (V = GetArrayLength(Path));
end;
function FindNearestObj(var Nx, Ny: Integer; Color1, Color2, Color3,
StartTol, MaxTol, MaxDist: Integer; Text1, Text2, Text3: string): Boolean;
var i, j: Integer;
begin
if (not (LoggedIn)) then Exit;
for j := 5 to MaxDist do
begin
J := J + 4;
for i := StartTol to MaxTol do
begin
I := I + 4;
if (FindColorTolerance(x, y, Color1, MSCX - j, MSCY - j, MSCX + j, MSCY + j, I))
or (FindColorTolerance(x, y, Color2, MSCX - j, MSCY - j, MSCX + j, MSCY + j, I))
or (FindColorTolerance(x, y, Color3, MSCX - j, MSCY - j, MSCX + j, MSCY + j, I)) then
begin
Break;
MMouse(x, y, 0, 0);
if (IsUpText(Text1))
or (IsUpText(Text2))
or (IsUpText(Text3)) then
begin
GetMousePos(Nx, Ny);
Result := True;
Break;
end;
end;
end;
end;
end;
procedure ImpatiencyEruption(Ms: Integer);
var FL: array[1..12] of Integer;
KMark, F: Integer;
begin
FL[1] := 112;
FL[2] := 113;
FL[3] := 114;
FL[4] := 115;
FL[5] := 116;
FL[6] := 117;
FL[7] := 118;
FL[8] := 119;
FL[9] := 120;
FL[1] := 121
FL[11] := 122;
FL[12] := 123;
MarkTime(KMark);
while TimeFromMark(KMark) < MS do
begin
try
F := Random(12);
KeyDown(FL[F]);
Wait(50 + Random(20));
KeyUp(FL[F]);
Wait(100 + Random(25));
except
F := Random(10);
end;
end;
end;
function MonsterBusy(var Mx, My: Integer; MonsterName: string; MonsterColor,
x1, y1, x2, y2, tol: integer): boolean;
{ Auth: n3ss3s}
{ Description : Checks is the monster busy and chats a bit.}
begin
if (FindMonsterTol(Mx, My, MonsterName, MonsterColor, x1, y1, x2, y2, tol)) then
begin
MouseSpeed := 8;
MMouse(x, y, 0, 0);
if (FindColor(x, y, 65280, x - 70, y - 70, x + 70, y + 70))
or (FindColor(x, y, 255, x - 70, y - 70, x + 70, y + 70)) then
begin
result := true;
end;
end;
if (CountColor(16711422, MMX1, MMY1, MMX2, MMY2) > 3) then
begin
if (random(8) < random(5)) then
begin
case random(2) of
1: begin
GhostSpeak('fighting');
end;
2: begin
case random(3) of
1: begin
HoverSkill('attack', false);
end;
2: begin
HoverSkill('strenght', false);
end;
3: begin
HoverSkill('defence', false);
end;
end;
end;
end;
end;
end;
end;
function PickUpArrows(Which: string): Boolean;
var ArrowColor1, ArrowColor2, RealSpeed: Integer;
begin
RealSpeed := MouseSpeed;
case lowercase(Which) of
'bronze': begin
ArrowColor1 := 1847102;
ArrowColor2 := 2441042;
end;
'iron': begin
ArrowColor1 := 5460825;
ArrowColor2 := 4144963;
end;
'steel': begin
ArrowColor1 := 9935011;
ArrowColor2 := 9079701;
end;
'mithril': begin
ArrowColor1 := 5059636;
ArrowColor2 := 6307904;
end;
'adamantite': begin
ArrowColor1 := 5334609;
ArrowColor2 := 5070924;
end;
end;
if (TimeFromMark(FightMark) > 20000) then
begin
if (FindNearestObj(x, y, ArrowColor1, ArrowColor2, ArrowColor1,
10, 50, 300, Copy(Which, 1, 3), Copy(Which, 1, 3), Copy(Which, 1, 3))) then
begin
MouseSpeed := 7 + Random(1);
MMouse(x, y, 0, 0);
if (IsUpText('Take')) then
begin
Mouse(x, y, 0, 0, True);
Result := True;
end;
end;
end;
end;
function MyFindInvArrows(var Ax, Ay: Integer): Boolean;
var Tries: Integer;
begin
try
GameTab(4);
for Tries := 1 to 5 do
begin
if (FindDeformed(x, y, Arrow, MIX1, MIY1, MIX2, MIY2))
or (FindDeformed(x, y, Arrowss, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 0, 0);
if (IsUpText('rrow')) then
begin
Result := True;
GetMousePos(Ax, Ay);
Break;
end;
end;
end;
except
Writeln('Some acces violation shit would come if we´d try wield em');
Writeln('the arrows I mean');
end;
FreeBitmap(Arrow);
FreeBitmap(Arrowss);
end;
function MyEquipArrows(var Equiped: Integer): Boolean;
var EquipTries, Slot: Integer;
begin
if (MyFindInvArrows(x, y)) then
begin
MMouse(x, y, 0, 0);
if (IsUpText('rrow')) then
begin
Equiped := GetAmount(x, y);
Slot := rs_GetInvSlot(x, y);
repeat
begin
Mouse(x, y, 0, 0, True);
Wait(500 + Random(200));
EquipTries := EquipTries + 1;
end;
until (not (ExistsItem(Slot))) or (EquipTries > 10);
if (not (ExistsItem(Slot))) then Result := True;
end;
end;
end;
procedure GoFetchArrows;
var LandMark: Integer;
begin
PickUpArrows(Arrows);
Flag;
MakeCompass('n');
if (FindDTM(LandMark, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 5, 5, True);
Flag;
end;
MakeCompass('s');
FreeDTM(LandMark);
end;
procedure HandleArrows;
begin
if (TimeFromMark(FightMark) > 20000) then
begin
MakeCompass('s');
MyEquipArrows(YouEquiped);
GoFetchArrows;
MyEquipArrows(YouEquiped);
end;
end;
procedure FasterRandoms;
var R: Integer;
begin
for R := 1 to 5 + Random(3) do
begin
case R of
1: FindDemon;
2: SolveSandWich;
3: SolveBox;
4: SolveFrogSwamp;
5: FindTalk;
7: FindNormalRandoms;
end;
end;
end;
procedure HumanTab2(Tabs, LastTab: Integer);
var RealMouseSpeed, I: Integer;
begin
RealMouseSpeed := MouseSpeed;
MouseSpeed := (7 + Random(3));
for i := 1 to Tabs do
begin
GameTab(1 + random(13));
end;
GameTab(LastTab);
MouseSpeed := RealMouseSpeed;
end;
procedure NontiBan;
begin
case Random(7) of
1: CompassMMouse(1 + Random(550), 1 + Random(550), 200, 200, 180, Random(2), Random(2));
2: BoredHuman;
3: RandomMovement;
4: begin
if (CountColor(16777215, MMX1, MMY1, MMX2, MMY2) > 1) then
begin
RandomChat;
if (FindChatText('rang')) then
begin
SayCurrentLevels('Ranging');
end;
end;
end;
5: Wait(500 + Random(20));
6: HumanTab2(1 + Random(3), 1 + Random(13));
7: ImpatiencyEruption(1000 + Random(115));
end;
end;
procedure HpAction; forward;
function Shooting: Boolean; forward;
procedure FightStuff;
var I: Integer;
begin
if Shooting then
begin
for I := 1 to 4 do
begin
Wait(100 + Random(25));
case I of
1: NontiBan;
2: FasterRandoms;
4: HpAction;
5: HandleArrows;
end;
Wait(100 + Random(25));
end;
Wait(100 + Random(25));
end;
if (FindDead) then
begin
Logout;
NextPlayer(False);
end;
end;
function RapeChicken: Boolean;
var Ax, Ay, RealSpeed, Attempt: Integer;
begin
RealSpeed := MouseSpeed;
repeat
if (not (MonsterBusy(Ax, Ay, 'hicken', 858754, MSX1, MSY1, MSX2, MSY2, 10))) then
begin
MouseSpeed := 7 + Random(1);
Mouse(Ax, Ay, 0, 0, False);
if (ChooseOption(x, y, 'ttack')) then
begin
Writeln('Attacking chicken');
Result := True;
MarkTime(FightMark);
end;
end;
Attempt := Attempt + 1;
until (Attempt > 10) or (Result) or (not (LoggedIn));
end;
procedure HpAction;
begin
if (HpPercent < 10) then
begin
if (FindDTM(LandMark, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Logout;
Writeln('Current player has under 10% hp, changing player!');
NextPlayer(False);
end;
end;
end;
procedure SetStyle;
begin
GameTab(1);
case Style of
'accurate': begin
if (GetColor(635, 271) = 1777020) then
begin
Writeln('shooting in accurate mode');
end else
begin
Mouse(635, 271, 1, 1, True);
end;
end;
'rapid': begin
if (GetColor(718, 271) = 1777020) then
begin
Writeln('shooting in accurate mode');
end else
begin
Mouse(718, 271, 1, 1, True);
end;
end;
'longrange': begin
if (GetColor(718, 271) = 1777020) then
begin
Writeln('shooting in accurate mode');
end else
begin
Mouse(718, 271, 1, 1, True);
end;
end;
end;
end;
function NoArrows: Boolean;
begin
if (not (MyFindInvArrows(x, y))) then
begin
Wait(100 + Random(25));
GameTab(5);
if (GetColor(690, 265) = 2304814) then
begin
Result := True;
end; // Felt like explaining:
end; // I did not make there end else because I dont want any action
end; // taken if there still are arrows.
function Shooting: Boolean;
var A, B: Integer;
begin
GameTab(5);
try
A := StrToInt(GetTextAtEx(668, 242, 20, StatChars, False, False, 0, 0, -1, 50, False, tr_AllChars));
Wait(2000 + Random(220));
B := StrToInt(GetTextAtEx(668, 242, 20, StatChars, False, False, 0, 0, -1, 50, False, tr_AllChars));
if (not (B = A)) then Result := True;
except
Writeln('Could not receive arrow amount');
end;
end;
procedure Fight;
var Tries: Integer;
begin
repeat
RapeChicken;
Tries := Tries + 1;
if (Tries > 20) then
begin
Writeln('Tried 20 times to attack a chicken.');
Writeln('I think we are not around Champz guild?');
Writeln('Logging out. (NextPlayer(False); )');
Logout;
NextPlayer(False);
Break;
end;
until (RapeChicken) or (Tries > 20);
FightStuff;
Wait(100 + Random(25));
end;
function OutOfArrows: Boolean;
begin
if (PlayerArrows[1] and PlayerArrows[2] and PlayerArrows[3] and
PlayerArrows[4]) then
begin
Result := True;
end;
end;
procedure Setup;
begin
if (not (LoggedIn)) then
begin
LoginPlayer;
end;
PerfectNorth;
if (FindDeformed(x, y, LandMark, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x - (25 + Random(5)), y - 10, 3, 3, True);
Flag;
FreeBitmap(LandMark);
end;
MakeCompass('w');
HighestAngle;
SetStyle;
SetChat('on', 1);
SetChat('off', 2);
SetChat('off', 3);
MyEquipArrows(YouEquiped);
Writeln('Arrows equiped : ' + IntToStr(YouEquiped));
end;
begin
SetUpSRL;
MarkTime(ScriptStart);
LoadPAQ;
LoadMPA;
DeclarePlayers;
Load;
ActivateClient;
TypeSend('what are nice chickens like you doing in a place like this?');
repeat
Setup;
repeat
Fight;
if (NoArrows) then
begin
NextPlayer(False);
end;
until (NoArrows);
NextPlayer(False);
until (OutOfArrows);
end.