SCAR Code:
{_________________________________________________________
[ Autofighter by Gofez0r aka. GoF ]
[ Set the info and start script logged in ]
[ Report errors and tell me what u think :D ]
[ ]
[ Enjoy :D ]
[ Version: 2.00 ]
[ Updates: ]
[ Now supports many players (tell me if bugs in that.) ]
[ Fightstyle choosing. ]
[ Eating bug SHOULD be fixed, tell me if something wrong ]
[ with it. But i used a SRL procedure for that. ]
[ Mousespeed changing... (better antibans). ]
[ And had to move some procedures around(errors cause ]
[ of the spots (unknown identifier.) ]
[ And that text over this box ( u noticed? :P) ]
[_________________________________________________________}
program MyAutoFighter;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Fighting.scar}
{.include SRL/SRL/Skill/Ranging.scar}
var x1,y1,Enemies :Integer;
//--------------SETUP UNDER THIS-----------------//
const
HowManyEnemies = 100; //Amount of enemies u want to fight at time before switching.
Startplayer = 0; //Player to start with.
Monstercol1 = 9278344; // A color from a enemy.
Monstercol2 = 7502715; // Another color from a enemy.
foodcol = 0; // Color of ur food.
HPtoeat = 10; // Hp to eat at
LogoutHP = 5; // HP to run and log out at.
HPToStopEat = 15; // HP to stop eating at.
Tolerance = 10; //Tolerance of finding the enemy
RunDir = 'N'; //Direction to run when low HP and no food
Fightwait = 2300; //Wait time for fighting.
PartName = 'Giant'; //Part of the monsters name. "arri" is from warrior.
Pickarrows = false; // Set to false if u dont use arrows.
Arrowcolor = 0; //Color of the arrow on ground.
FightStyle = 2; //NEW: From 1 to 4...
DoGambleBox = true; //NEW: Set to true if u lag when using solvenewbox.
SwitchPlayers = false; //NEW: Set to true if u want the script to change players.
LoggedInAtStart = true; //NEW: If u are logged in at start... Creates a pic of ur nick for
//Rands and doesnt set the fightinstyle.
{________
[[1] [2]]
[ ] <-- The spots for the number for FightStyle
[[3] [4]] As i wanted to do it myself, not use only SRL stuff :)
[_______}
//----------------^^ SETUP ^^--------------------//
procedure DeclarePlayers;
begin
HowManyPlayers :=8; //Note: 0 counts as a player too ;)
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;
Players[0].Name :='user';
Players[0].Pass :='pw';
Players[0].Nick :='nick'; //Few letters from the name for antirandoms.
Players[0].Active:=True;
Players[1].Name :='Namehere';
Players[1].Pass :='PassHere';
Players[1].Nick :='ame'; //Few letters from the name for antirandoms.
Players[1].Active:=True;
Players[2].Name :='Namehere';
Players[2].Pass :='PassHere';
Players[2].Nick :='ame'; //Few letters from the name for antirandoms.
Players[2].Active:=True;
Players[3].Name :='Namehere';
Players[3].Pass :='PassHere';
Players[3].Nick :='ame'; //Few letters from the name for antirandoms.
Players[3].Active:=True;
Players[4].Name :='Namehere';
Players[4].Pass :='PassHere';
Players[4].Nick :='ame'; //Few letters from the name for antirandoms.
Players[4].Active:=True;
Players[5].Name :='Namehere';
Players[5].Pass :='PassHere';
Players[5].Nick :='ame'; //Few letters from the name for antirandoms.
Players[5].Active:=True;
Players[6].Name :='Namehere';
Players[6].Pass :='PassHere';
Players[6].Nick :='ame'; //Few letters from the name for antirandoms.
Players[6].Active:=True;
Players[7].Name :='Namehere';
Players[7].Pass :='PassHere';
Players[7].Nick :='ame'; //Few letters from the name for antirandoms.
Players[7].Active:=True;
end;
//-----------------------------------------------//
procedure FindRandoms;
begin
FindLamp('hitpoints');
wait(5); //No need for random timers on these, jagex cant track when we are checking :)
ClickToContinue; //Just removes lag.
wait(5);
FindDead;
wait(5);
FindMod;
wait(5);
ClickToContinue;
wait(5);
CloseWindow;
end;
//-----------------------------------------------//
Procedure RandomRandoms;
var RNFR :Integer;
begin
writeln('Randomly choosing if a bigger random check is used.');
RNFR:=0;
begin
RNFR:=Random(8);
case RNFR of
3: FindNormalRandoms;
end;
end;
end;
//-----------------------------------------------//
function Arrowpickup: boolean;
begin
if (Pickarrows=true) then
begin
repeat
wait(400+random(210))
if(FindObj(x,y,'ake',arrowcolor,0))then
begin
mouse(x,y,3,2,true)
flag;
end;
until(not(FindObj(x,y,'ake',arrowcolor,0)))
end;
end;
//-----------------------------------------------//
function PutArrowsOn: Boolean; //By Freddy1990 .. Edited a bit.
var
xx, yy: Integer;
begin
if (Pickarrows=true) then
begin
Result := FindInvArrows(xx, yy);
Wait(100 + Random(250));
Mouse(xx, yy, 0, 0, True);
end;
end;
//-----------------------------------------------//
Procedure SetFightingStyle;
Begin
Gametab(1);
Wait(500+Random(500))
Begin
if (FightStyle=1) then
begin
Mouse(600,270,10,10,true)
Wait(1000+Random(500))
writeln('Fightstyle chosen.');
End;
if (FightStyle=2) then
Begin
Mouse(695,270,10,10,true)
Wait(1000+Random(500))
End;
if (FightStyle=3) then
Begin
Mouse(610,325,10,10,true)
Wait(1000+Random(500))
End;
if (FightStyle=4) then
Begin
Mouse(690,320,10,10,true)
Wait(1000+Random(500))
End;
End;
End;
//-----------------------------------------------//
procedure AntiBans;
begin
LeaveScreenEvery(5 + random(5));
RotateEvery(4 + random(3));
BoredEvery(50+random(10));
PickUpMouseEvery(64+random(13));
RandomRClickEvery(15 + random(5));
end;
//-----------------------------------------------//
procedure ProgressReport;
begin
ClearDebug;
Writeln(' ______________________________________________ ');
Writeln('| Autofighter v1.00 by Gofez0r. |');
Writeln('| |');
Writeln('| Killed '+IntToStr(Enemies)+' Enemies |');
Writeln('|______________________________________________|');
end;
//-----------------------------------------------//
procedure setupzz;
begin
writeln('Changing mousespeed...')
MouseSpeed := 6 +random(3)
if (random (3)= 0) then
MouseSpeed:= 6 + random(4);
HighestAngle;
end;
//-----------------------------------------------//
procedure SetUpPlayer;
begin
wait(4500+random(1000));
writeln('Setting up player');
SetFightingStyle;
setupzz;
writeln('Done.');
writeln('');
writeln('Now starting to fight.');
end;
//-----------------------------------------------//
procedure login;
begin
if (loggedIn=true) then
begin
exit;
end;
wait(125+random(45))
if LoggedIn=false then
LoginPlayer;
SetUpPlayer;
end;
//-----------------------------------------------//
function Attackenemy1: boolean;
begin
if (not (LoggedIn))then
Login;
If (InFight) then
result:= True
if (result = true) then
exit;
repeat
FindRandoms;
Findtalk;
if (FindColorTolerance(x1,y1,Monstercol1,197,61,384,204,Tolerance))Then
MMouse(x1,y1,3,3);
until (FindObj(x1,y1,partname,Monstercol1,Tolerance))
if (FindObj(x1,y1,partname,Monstercol1,Tolerance))then
repeat
FindObj(x1,y1,partname,Monstercol1,Tolerance)
Mouse(x1,y1,2,3,true)
wait(1000+random(364))
if (InFight) then
Result:= true;
until (result = true)
end;
//-----------------------------------------------//
function Attackenemy2: boolean;
begin
if (not (LoggedIn))then
Login;
If (InFight) then
result:= True
if (result = true) then
exit;
repeat
Findtalk;
if (FindColorTolerance(x,y,Monstercol1,197,61,384,204,Tolerance))or
(FindColorTolerance(x,y,Monstercol2,197,61,384,204,Tolerance))then
MMouse(x1,y1,3,3);
until (FindObj(x,y,partname,Monstercol2,Tolerance))
if (FindObj(x,y,partname,Monstercol2,Tolerance))then
repeat
RealEatIfNeeded(foodcol,HPToEat,true)
FindObj(x,y,partname,Monstercol2,Tolerance)
Mouse(x,y,2,3,true)
Findtalk;
wait(2000+random(364))
if (InFight) then
Result:= true;
until (result = true)
end;
//-----------------------------------------------//
function WaitForEnd: boolean;
var WaitTime :Integer;
begin
if (Attackenemy1=true) or
(AttackEnemy2=true) then
begin
If (InFight) Then
Marktime(WaitTime)
If (not (InFight)) Then
result := true;
if (result = true) then
Attackenemy1;
repeat
AntiBans;
wait(131 + random(63));
Findrandoms;
until(not(InFight))
Enemies:= Enemies +1;
end;
end;
//-----------------------------------------------//
procedure mainloop;
begin
if (LoggedInAtStart=true) then
begin
Writeln('As u start the script logged in theres no need for setting the fightinstyle.');
Writeln('');
Writeln('So i assume u have set it urself.');
end;
repeat
Attackenemy1;
wait(45 + random(45));
WaitForEnd;
wait(45+random(73));
Attackenemy2;
wait(130 + random(145));
WaitForEnd;
wait(120+random(33));
Attackenemy2;
WaitForEnd;
AntiBans;
FindRandoms;
RandomRandoms;
if (pickarrows=true) then
begin
ArrowPickup;
PutArrowsOn;
end;
progressreport;
mainloop;
FindNormalRandoms;
until(Enemies = HowManyEnemies)
writeln ('Done... Switching players...');
logout;
if (SwitchPlayers=false) then
begin
writeln('Apparently u dont want to change players.');
writeln('')
writeln('But still all done. Now terminating.');
terminatescript;
if (SwitchPlayers=true) then
begin
NextPlayer(true);
if (not (LoggedIn)) then NextPlayer(False);
Wait(9000+random(5500));
writeln('Switched player, now doing setup.');
SetUpPlayer;
mainloop;
end;
end;
end;
//-----------------------------------------------//
begin
activateclient;
MouseSpeed:= 7;
ChatsOff
SetUpSRL;
ClearDebug;
HighestAngle
SetUpSRL;
DeclarePlayers;
Mainloop;
end.
//-----The end.-----//
SCAR Code:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Ranging routines --//
//-----------------------------------------------------------------//
//
// * function arrowamount: Integer;
// * function getarrowcolor: Boolean; // *??/Freddy1900
// * function findinvarrows(var arrowx, arrowy: Integer): Boolean;
// * function invarrows: Integer;
// * function EquipArrows: Boolean; // * Freddy1990
var
headcolorar, tailcolor: Integer;
{*******************************************************************************
function ArrowAmount: Integer;
By: masquerader
Description: Returns the number of equiped arrows.
*******************************************************************************}
function ArrowAmount: Integer;
begin
GameTab(5);
Result := GetAmount(673, 249);
end;
{*******************************************************************************
function GetArrowColor: Boolean;
By: masquerader | Fixed by Freddy1990
Description: Returns the number of equiped arrows.
*******************************************************************************}
function GetArrowColor: Boolean;
begin
if (ArrowAmount > 0) then
begin
Result := True;
headcolorar := GetColor(700, 257);
tailcolor := GetColor(688, 271);
WriteLn('arrow head color: ' + IntToStr(headcolorar));
WriteLn('tail color: ' + IntToStr(tailcolor));
end;
end;
{*******************************************************************************
function FindInvArrows(var arrowx, arrowy: Integer): Boolean;
By: masquerader
Description: Returns true if arrows are found in the inventory and the coordinates.
*******************************************************************************}
function FindInvArrows(var arrowx, arrowy: Integer): Boolean;
var
tailcoords: TPointArray;
i, headx, heady: Integer;
begin
GameTab(4);
tailcoords := ItemCoordsColor('inv', tailcolor, 0); //finds all arrow stacks
if (GetArrayLength(tailcoords) > 0) then
begin
for i := 0 to GetArrayLength(tailcoords) - 1 do
begin
if (FindColor(headx, heady, headcolorar, tailcoords[i].x, tailcoords[i].y,
tailcoords[i].x + 36, tailcoords[i].y + 42)) then
begin //only one stack of headcolorar :)
Result := True;
arrowx := tailcoords[i].x;
arrowy := tailcoords[i].y;
Exit;
end;
end;
end;
end;
{*******************************************************************************
function InvArrows: Integer;
By: masquerader
Description: Returns the number of arrows in the inventory.
*******************************************************************************}
function InvArrows: Integer;
var
arrowx, arrowy: Integer;
begin
if (FindInvArrows(arrowx, arrowy)) then
Result := GetAmount(arrowx, arrowy);
end;
{*******************************************************************************
function EquipArrows: Boolean;
By: Freddy1990
Description: Equips arrows if they are found in the inventory.
*******************************************************************************}
function EquipArrows: Boolean;
var
xx, yy: Integer;
begin
Result := FindInvArrows(xx, yy);
Wait(100 + Random(250));
Mouse(xx, yy, 0, 0, True);
end;