Pwnd
2006-04-16 22:12:13
//Help from neon.
program AutoFighter;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/Fighting.scar}
const
MCol1 = 0;
MCol2 = 0;
MCol3 = 0;
Times = 0;
EatB = False;
FoodCol = 0;
Direction = '';
NickName = ''; //4 letters.
var
Kills: integer;
procedure FindRandoms;
begin
FindNormalRandoms;
CloseWindow;
ClickToContinue;
FindLamp('mining');
FindMod;
FindMime;
FindMaze;
FindQuiz;
FindCerter;
FindDoctor;
FindDemon;
if(FindNewBox)then
Logout;
end;
procedure Eat(FoodCol: integer; Dir: string);
var
Sex, Sey: integer;
begin
Sex:= 594;
Sey:= 149;
if(FindColorSpiral(Sex, Sey, FoodCol, MIX1, MIY1, MIX2, MIY2))then
begin
Mouse(Sex, Sey, 0, 0, True);
end else
begin
WriteLn('No food!');
SetRun(True);
RunAwayDirection(Dir);
LogOut;
end;
end;
procedure RWait(Base, Rand: integer);
begin
if((Base > 100) and (Rand > 100))then
begin
Wait(Base + Random(Rand));
end else
Wait(Base * 100 + Random(Rand * 100));
end;
procedure Fight(Color1, Color2, Color3, FoodColor: integer; Dir: string);
var
Sex, Sey: integer;
begin
Sex:= 259;
Sey:= 196;
if((FindColorSpiral2(Sex, Sey, Color1, MSX1, MSY1, MSX2, MSY2)) or
(FindColorSpiral2(Sex, Sey, Color2, MSX1, MSY1, MSX2, MSY2)) or
(FindColorSpiral2(Sex, Sey, Color3, MSX1, MSY1, MSX2, MSY2)))then
begin
MMouse(Sex, Sey, 0, 0);
RWait(1, 2);
if(GetHP < 10)then
begin
if(EatB)then
begin
Eat(FoodColor, Dir);
end else
begin
SetRun(True);
RunAwayDirection(Dir);
RWait(50, 50);
LogOut;
end;
end else
if(IsUpText('Attack'))then
begin
Mouse(Sex, Sey, 1, 1, True);
RWait(1, 2);
Flag;
while(InFight and (GetHP > 10))do
begin
RWait(5, 5);
FindTalk;
end;
Kills := Kills + 1;
end else
begin
Mouse(Sex, Sey, 1, 1, False);
if(ClickOption('Attack', 1))then
begin
Flag;
while(InFight and (GetHP > 10))do
begin
RWait(5, 5);
FindTalk;
end;
Kills:= Kills + 1;
end else
RWait(1, 1);
end;
end else
RWait(1, 1);
end;
procedure ProgressReport;
var
Counter: integer;
begin
ClearDebug;
Counter:= 0;
repeat
WriteLn('');
Counter:= Counter + 1;
until(Counter = 3)
WriteLn('///////////////////////////');
WriteLn('//// Progress Report ////');
WriteLn('///////////////////////////');
WriteLn('//// Killed: ' + IntToStr(Kills) + ' ////');
WriteLn('//// ' + ScriptTime2(2) + ' ////');
WriteLn('////////////////////////////');
if(talks>0)then
WriteLn(' Talked to ' + IntToStr(talks) + ' Random event[s].');
if(lamps>0)then
WriteLn(' Used lamps ' + IntToStr(lamps) + ' Time[s].');
if(doctors>0)then
WriteLn(' Solved ' + IntToStr(doctors) + ' Fords[s].');
if(frogs>0)then
WriteLn(' Solved ' + IntToStr(frogs) + ' Frog[s].');
if(newboxes>0)then
WriteLn(' Solved ' + IntToStr(newboxes) + ' Box[es].');
if(demons>0)then
WriteLn(' Solved ' + IntToStr(demons) + ' Demon[s].');
if(logs>0)then
WriteLn(' Logged in ' + IntToStr(logs) + ' Time[s].');
WriteLn('<=====================================================>');
end;
procedure Setup;
begin
SetupSRL;
NickNameBMP:= CreateBitmapMaskFromText(NickName, UpChars);
SetChat('Off', 1);
SetChat('Off', 2);
SetChat('Off', 3);
Kills:= 0;
end;
begin
Setup;
repeat
Fight(MCol1, MCol2, MCol3, FoodCol, Direction);
if(Kills mod 5 = 0)Then
FindRandoms;
if(Kills mod 10 = 0)then
ProgressReport;
until((Times = Kills) or WeAreDead)
end.
Should work.Eatb is if you want to eat.. or if you just want to run away.
Thanks <3