SCAR Code:
{.Script Info:
# ScriptName = Pentti's Auto Fighter
# Author = Pentti
# Description = Auto fights, buries bones, auto evens skills, runs away at low hp.
# Version = 2. For SRL version 3.6
# Date = 14.01.2007
/Script Info}
program AutoFighter;
{.include srl/srl.scar}
{.include srl/srl/extended/xmapwalk.scar}
{.include srl/srl/skill/fighting.scar}
const
{Monster SetUp}
MColor1=6519188; //First monster color
Mcolor2=3357516; //Second monster color
Mcolor3=1848125; //Third monster color
MName=''; //Monster name. Can be leaved at ''.
{FightMode & EvenSkill SetUp}
FightMode=1 ; //Fight mode (1/2/3/4)
EvenSkills=False; //Evens strength,attack and defence levels (True/False)
{Eating SetUp}
Eat=False; //Eat food at low hp (True/False)
FoodC=0; //Food color If Eat=True
EatAtHP= 15; //Eat food at hp if Eat=True
{Runaway SetUp}
UseRunAway=False; //Use run away (True/False)
RunAtHP= 5; //Run away if hp is at this level
RunAwayDir='N'; //Runaway direction (N,S,E,W)
{Bone Burying SetUp}
BuryBones=True; //Bury bones (True/False)
BoneC=7631997; //bone color if BuryBones=True
{Anti-ban SetUp}
UseAntiBan=True; //Use anti ban? (True/False)
AntiBanRate=5; //1=Much antiban<-->10=Rarely
AutoRespond=False; //Use auto responder (True/False) (This may lag)
StopScript=10; //How many hours to run with script?
{//--------------Player SetUp------------------\\}
procedure DeclarePlayers;
begin
HowManyPlayers:=4;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;
Players[0].Name :='pk b e a r';
Players[0].Pass :=;
Players[0].Active:=True;
Players[0].Integer1:=10 //Time in minutes to fight
Players[1].Name :='Player Name 2';
Players[1].Pass :='Password';
Players[1].Nick :='Aar';
Players[1].Active:=True;
Players[1].Integer1:=10 //Time in minutes to fight
Players[2].Name :='Player Name 3';
Players[2].Pass :='Password';
Players[2].Nick :='yer Na';
Players[2].Active:=False;
Players[2].Integer1:=10 //Time in minutes to fight
Players[3].Name :='Player Name 4';
Players[3].Pass :='Password';
Players[3].Nick :='yer Na';
Players[3].Active:=False;
Players[3].Integer1:=10 //Time in minutes to fight
end;
{\\--------------End of All SetUps--------------//}
var waited:integer;
Someone:integer;
Killed:integer;
P:string;
BonesBuried:integer;
FightM:integer;
BonesBmp:integer;
times:integer;
CUAM:integer;
ReportTime:Integer;
PlayerTime:Integer;
procedure Report;
var A,B:String;
file:integer;
Def,Str,Att:integer;
begin
if(ScriptTime(2)<10)
then begin
A:='0'+inttostr(ScriptTime(2))
end;
if(ScriptTime(2)>9)
then begin
A:=inttostr(ScriptTime(2))
end;
if(ScriptTime(3)<10)
then begin
B:='0'+inttostr(ScriptTime(3))
end;
if(ScriptTime(3)>9)
then begin
B:=inttostr(ScriptTime(3))
end;
ClearReport;
addtoreport(inttostr(ScriptTime(1))+':'+A+':'+B)
addtoreport(inttostr(killed)+' Kills')
if(BonesBuried>0)then
addtoreport('Bones buried: '+inttostr(Bonesburied))
ClearDebug;
writeln('Killed: '+inttostr(killed)+' monsters')
if(BonesBuried>0)then
Writeln('Bones buried '+inttostr(Bonesburied)+' times')
writeln('Work time '+inttostr(ScriptTime(1))+':'+A+':'+B)
disguisescar('['+inttostr(ScriptTime(1))+':'+A+':'+B+'] '+inttostr(Killed)+' Kills')
if(Random(5)=1)then
begin
file:=rewritefile(apppath+'Pentti Autorighter V.1.Txt',false)
if(writefilestring(file,'Work time '+inttostr(ScriptTime(1))+':'+A+':'+B+
' Killed: '+inttostr(killed)+' monsters'))
then
CloseFile(file)
end;
end;
procedure ChatBoxRespond(FromText:String; SayText:String);
var GetFromText,GetName:String;
begin
GetFromText := Lowercase(Trim(GetTextAtEx(84, 417, 45, SmallChars, False, False, 0, 2, 16711680, 40, True, tr_NormalChars)));
if(pos(GetFromText,FromText)<>0) then
begin
GetName := Lowercase(Trim(GetTextAtEx(15, 417, 45, SmallChars, False, False, 0, 2, 0, 40, True, tr_NormalChars)));
TypeSend(SayText)
writeln('________________________________________________')
Writeln('|'+GetName+': '+FromText)
writeln('|'+Players[Currentplayer].Name+': '+SayText)
writeln('________________________________________________')
wait(10+random(50))
end;
end;
procedure Respond;
begin
if(not(Infight))then
Exit;
chatBoxrespond('Lol','Hehhe')
chatBoxrespond('Rofl','Hahha')
chatBoxrespond('auto','who is autoer?')
chatBoxrespond('Noob','Im not a noob')
chatBoxrespond('Bye','See you')
chatBoxrespond('Hi','Hi man')
chatBoxrespond('Hello','Hi there')
chatBoxrespond('Sup','nothing')
chatBoxrespond(':D','hehhe')
chatBoxrespond('Cool','really cool')
chatBoxrespond('No','why no?')
if(not(Infight))then
Exit;
chatBoxrespond('Yea','Yay')
chatBoxrespond('need','I need too')
chatBoxrespond('Kill','Ill kill him')
chatBoxrespond('How are','fine')
chatBoxrespond('What','That...')
chatBoxrespond('Why','stop asking questions')
chatBoxrespond('Where','Here')
chatBoxrespond('Here','Where')
chatBoxrespond('You','Me?')
chatBoxrespond('He','who?')
if(not(Infight))then
Exit;
chatBoxrespond('Look','look what?')
chatBoxrespond('Np','Ty.')
chatBoxrespond('Ty','np.')
chatBoxrespond('?','???')
chatBoxrespond('Nice','Very nice')
end;
procedure TalkingToMeTXT;
begin
Case Random(10)+1 of
1: TypeSend('Right...')
2: TypeSend('What?')
3: TypeSend('Sorry, i dont understand.')
4: TypeSend('What do yuo want?')
5: TypeSend('I have no time')
6: TypeSend('I dont like you')
7: TypeSend('You are getting my nervous')
8: TypeSend('is it possible to be quit for 2 minutes?')
9: TypeSend('yes? I am.')
10: TypeSend('No, its you again.')
End;
end;
procedure TalkingToMe;
var
tmpx, tmpy: Integer;
begin
If(FindBitmapMaskTolerance(NickNameBmp, x, y, 0, 24, 517, 338, 0, 40)) then
begin
FindNormalRandoms;
TalkingToMeTxt;
CUAM:=CUAM+1
writeln('Your Name has been spotted on the screen '+
'and you succesful answered.')
if(CUAM>3) then begin
TypeSend('Nice to talk, but now gtg. See you! :)')
LogOut;
Wait(20000+random(15000))
LogInPlayer;
CUAM:=0
end;
end;
end;
procedure SayLevel(Skill:string);
var LVLBmp,Lvl:integer;
tmpx, tmpy: Integer;
begin
if (FindColor(tmpx, tmpy, 65535, 10, 25, 511, 334)) then
begin
LvlBmp:=createbitmapmaskfromtext(skill,upchars)
If(FindBitmapMaskTolerance(LvlBmp, x, y, 0, 0, 516, 338, 0, 40))then
begin
Lvl:=GetSkillLevel(Skill)
TypeSend('My '+Skill+' Level is '+inttostr(Lvl)+'. yours?')
end;
FreeBitMap(LvlBmp)
end;
end;
procedure FightSkills;
var Skill:String;
b:integer;
begin
for b:=0 to 4 do
begin
case B of
0: Skill:='Attack'
1: Skill:='Defence'
2: Skill:='Strenght'
3: Skill:='Hitpoints'
4: Skill:='Magic'
end;
wait(25+random(50))
SayLevel(Skill)
end;
end;
procedure NextLvlEveryMins(Minutes:integer; Skill:string);
var NextLVL,LevelMark:integer;
begin
if ((TimeFromMark(LevelMark) / 1000) / 60 >= Minutes) then
begin
MarkTime(LevelMark);
NextLVL:=GetSkillLevel(Skill)
TypeSend('My next '+skill+' level is '+inttostr(NextLVL+1)+' cant wait till it')
end;
end;
procedure NextFightSkillsEv;
var Skill:String;
begin
case random(5) of
0: Skill:='Attack'
1: Skill:='Defence'
2: Skill:='Strenght'
3: Skill:='Hitpoints'
4: Skill:='Magic'
end;
NextLvlEveryMins(5+AntiBanRate,Skill)
wait(25+random(50))
end;
procedure randoms;
begin
wait(random(25)) FindNormalRandoms; Report;
wait(random(25)) SolvePinBall; Report;
wait(random(25))if(FindName)then FindTalk; Report;
wait(random(25))if(FindNewBox)then SolveBox;Report;
end;
Procedure AntiB;
begin
if(UseAntiBan)then
begin
RotateEvery(4+AntiBanRate+random(2))
RandomChatEvery(7+AntiBanRate+random(2))
RandomRClickEvery(8+AntiBanRate+random(2))
LeaveScreenEvery(11+AntiBanRate+random(2))
if(AutoRespond)then
FightSkills;
Wait((1+Random(3))*AntiBanRate)
end;
end;
function RunAwayIfNeed(AtHP:integer; Direction: string; waits:integer):boolean;
begin
if(UseRunAway=True)
then begin
if(GetHp<=AtHp)then
begin
ReportVars[2]:=1
report;
RunAwayDirection(Direction)
wait(200)
SRLRAndomsReport;
report;
flag;
Randoms;
wait(waits)
if(not(LoggedIn))
then begin
LogInPlayer;
end;
report;
RunBack;
report;
end;
end;
wait(1000)
end;
procedure EatF;
begin
if(Eat)
then begin
report;
RealEatIfNeeded(FoodC,EatAtHp,false)
wait(200+random(50))
ReportVars[3]:=1
Randoms;
report;
end;
end;
procedure EvenSkill;
var Att,Str,Def:Integer;
begin
Report;
if(EvenSkills=True)
then begin
Att:=GetSkillLevel('Attack')
Str:=GetSkillLevel('Strength')
Def:=GetSkillLevel('Defence')
writeln('Att: '+inttostr(Att))
writeln('Str: '+inttostr(Str))
writeln('Def: '+inttostr(Def))
if(Att>Str)
then begin
report;
writeln('Att>Str')
if(FightM=2)
then begin
report;
exit;
end;
FightM:=2
writeln('Setting fightmode 2')
SetFightMode(2)
Randoms;
exit;
end;
if(Str>Def)
then begin
report;
writeln('Str>Def')
if(FightM=4)
then begin
report;
exit;
end;
FightM:=4
writeln('Setting fightmode 4')
SetFightMode(4)
Randoms;
exit;
end;
if(Def>Att)
then begin
report;
writeln('Def>Att')
if(FightM=1)
then begin
report;
exit;
end;
FightM:=1
writeln('Setting fightmode 1')
SetFightMode(1)
Randoms;
report;
exit;
end;
end;
report;
end;
procedure WhileFighting;
begin
report;
repeat
report;
waited:=waited+1
RunAwayIfNeed(RunAtHp,RunAwayDir,45000)
wait(25+random(50))
report;
if(not(loggedin))
then begin
writeln(Players[CurrentPlayer].Name+' Logging out')
LogOut;
Wait(2000)
Players[CurrentPlayer].Active:=False;
SRLRandomsReport;
NextPlayer(True)
writeln(Players[CurrentPlayer].Name+' Logging in')
LogInPlayer;
wait(2000)
SetChat('on',1)
SetFightMode(FightMode);
if(EvenSkills=True)
then begin
EvenSkill;
end;
report;
setrun(true)
report;
MarkTime(PlayerTime)
end;
wait(25+random(50))
randoms;
if(AutoRespond)then
Respond;
report;
if(AutoRespond)then
TalkingToMe;
wait(25+random(50))
EatF;
until(not(infight))or(waited=200)
Killed:=killed+1
ReportVars[0]:=1
Report;
end;
function FightIt(Color1, Color2, Color3, Tolerance: Integer; MonsterName: String): Boolean;
var
x,y,MSpeed:Integer;
begin
report;
MSpeed:=MouseSpeed;
MouseSpeed:=5;
if(FindObj(x,y,MonsterName,Color1,5))or
FindObj(x,y,MonsterName,Color2,5)or
FindObj(x,y,MonsterName,Color3,5)
then begin
report;
MMouse(x,y,1,1)
wait(20)
getmousepos(x,y)
if(IsFightAt(x, y))
then begin
report;
MMouse(x-random(50)+random(50),y-random(50)+random(50),5,5)
FightIt(Color1,Color2,Color3,Tolerance,MonsterName)
end;
if(IsUpText('ack'))and(Isuptext(Monstername))and
not(IsFightAt(x,y))
then
begin
report;
result:= true;
GetMousePos(x, y);
Mouse(x+random(1)-random(1),y+random(1)-random(1),1,1,False);
wait(25+random(25));
report;
MouseSpeed:=MSpeed;
if(not(ClickOption('Att',1)))
then begin
Randoms;
MMouse(4+random(50),4+random(50),2,2)
wait(20)
report;
FightIt(Color1,Color2,Color3,Tolerance,MonsterName)
end;
clickoption('Att',1)
report;
Randoms;
wait(50)
flag;
wait(100)
report;
if(FindBitmapmasktolerance(Someone,x,y,10,400,185,437,0,20))
then begin
typeSend(' ')
report;
FightIt(Color1,Color2,Color3,Tolerance,MonsterName);
end;
repeat
report;
waited:=Waited+1
wait(450)
until(infight)or(Waited=20)
report;
wait(50)
waited:=0
report;
WhileFighting;
exit;
end;
end;
end;
procedure BuryBone;
begin
report;
if(BuryBones=True)
then begin
if(findobj(x,y,'Take',BoneC,6))then begin
Mouse(x,y,2,2,false)
wait(50+random(25))
if(not(Findbitmapmasktolerance(BonesBmp,x,y,1,1,500,400,3439060,20)))
then begin
exit;
end;
if(Findbitmapmasktolerance(BonesBmp,x,y,1,1,500,400,3439060,20))then
Mouse(x-random(2)+random(2),y-random(2)+random(2),4,4,True)
report;
wait(500)
flag;
wait(300)
gametab(4)
repeat
times:=times+1
wait(3000)
if(FindItemName('ones'))
then begin
GetMousepos(x,y)
Mouse(x,y,0,0,false)
wait(500)
report;
if(Not(ClickOption('ury',2)))
then begin
wait(500)
if(times>5)
then begin
times:=0
exit;
end;
wait(500)
BuryBone;
end;
if(Clickoption('ury',2))
then begin
wait(200)
ReportVars[1]:=1
FindNormalRandoms;
SRLRandomsReport;
wait(4000)
BonesBuried:=BonesBuried+1
report;
end;
wait(250)
end;
until(FindItemName('ones')=false)or(times>3)
times:=0
end;
end;
end;
procedure SRLRandomsReportM;
begin
if((TimeFromMark(ReportTime)/1000)/60>=1)then
begin
MarkTime(ReportTime)
SRLRandomsReport;
end;
end;
procedure ChangePlayer;
begin
if((TimeFromMark(PlayerTime)/1000)/60>=Players[CurrentPlayer].Integer1)then
begin
writeln(Players[CurrentPlayer].Name+' Logging out')
LogOut;
Wait(2000)
SRLRandomsReport;
NextPlayer(True)
writeln(Players[CurrentPlayer].Name+' Logging in')
LogInPlayer;
wait(2000)
SetChat('on',1)
SetFightMode(FightMode);
if(EvenSkills=True)
then begin
EvenSkill;
end;
report;
setrun(true)
report;
MarkTime(PlayerTime)
end;
end;
procedure Fight;
begin
EvenSkill;
Report;
EatF;
Report;
wait(200)
FightIt(Mcolor1,Mcolor2,mcolor3,5,Mname)
Randoms;
Report;
BuryBone;
if(UseAntiBan)then
AntiB;
Report;
SRLRandomsReportM;
ChangePlayer;
end;
procedure SetUp;
begin;
setupsrl;
ScriptID:='50'
cleardebug;
P:=CHR(80)+CHR(101)+CHR(110)+CHR(116)+CHR(116)+CHR(105)
writeln('Auto fighter By: ['+P+']')
wait(160)
cleardebug;
writeln('Auto fighter By: [ '+P+' ]')
wait(190)
cleardebug;
writeln('Auto fighter By: [ '+P+' ]')
wait(250)
cleardebug;
writeln('Auto fighter By: [ '+P+' ]')
wait(250)
cleardebug;
writeln('Auto fighter By: [ '+P+' ]')
wait(270)
cleardebug;
writeln('Auto fighter By: [ '+P+' ]')
wait(300)
cleardebug;
writeln('Auto fighter By: ['+P+']')
writeln(' ')
wait(1000)
Report;
mousespeed:=8
declareplayers;
report;
BonesBmp:=CreateBitMapMaskFromText('Take Bones',UpChars)
NickNameBMP:=CreateBitMapmaskfromtext(Players[0].Nick,UpChars)
Someone:=CreateBitMapMaskFromText('Someone',SmallChars)
activateclient;
wait(200)
report;
LoadGhostSpeakWords('Fighting')
report;
wait(1000)
report;
if(not(loggedin)) then begin
loginplayer;
wait(500+random(200))
end;
Randoms;
report;
Highestangle;
SetChat('on',1)
SetFightMode(FightMode);
if(EvenSkills=True)
then begin
EvenSkill;
end;
report;
setrun(true)
report;
MarkTime(ReportTime)
MarkTime(PlayerTime)
end;
begin
SetUp;
repeat
Fight;
until(ScriptTime(1)>=StopScript)
LogOut;
TerminateScript;
end.