Teehee.
I've developed a propper fighter from this now:
SCAR Code:
program SimpleFighter;
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\fighting.scar}
/////////////////////////////////////////////////////////////
///////////////////////Instructions//////////////////////////
/////////////////////////////////////////////////////////////
////////////////////Setup MonsterColor///////////////////////
//////////////////////Hold f12 to stop///////////////////////
/////////////////////////////////////////////////////////////
const MonsterColor = 2510699;
Const Tolerance = 5;
const MultiFight = False; //Can you attack a monster already fighting
Const RunDir = 'N';
Const StartPlayer = 0; // Determines who will play first
Procedure DeclarePlayers;
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=StartPlayer; // CurrentPlayer = Array Index
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Loc :='Loc1';
Players[0].Skill:='Mining';
Players[0].Active:=True;
writeln('You have currently ' +inttostr(HowManyPlayers)+' Players set to run. The starting player is '+ players[currentplayer].name);
End;
Var
Kills,RanMark,HpMark: integer;
Procedure Spin(Time: integer);
Var a : integer;
Begin
A := Random(3)
if (a = 0) then a := 1
if (a = 2) then a := 3
SendArrowSilentWait(a, Time);
end;
Function InFightAt(x, y: Integer):Boolean;
var
dx, dy: Integer;
begin
if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, 16728128, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, 192, x - 20, y - 10, x + 20, y + 10) ) then
Result:=True;
end;
Procedure WaitForHp;
Begin
Repeat
If Random(3) = 0 then Spin(200+random(500))
Wait(5000)
FindTalk
FindNormalRandoms
If Random(3) = 0 then RandomRClick
Until ((HpPercent > 50) or (TimeFromMark(HpMark) > 240000))
End;
Procedure Randoms;
Begin
Status(IntToStr(TimeFromMark(RanMark)) + 'ms since last randoms check')
FindNormalRandoms;
FindTalk;
If isfkeydown(12) then TerminateScript
If random(30) = 0 then
if(HpPercent < 30)then
Begin; MarkTime(HpMark); RunTo(RunDir,true); WaitForHp; End;
MarkTime(RanMark)
If Random(9) = 0 then Spin(200+random(500))
End;
begin
SetupSRL;
DeclarePlayers
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
SetRun(True)
repeat
Spin(200+random(500))
if InFight then Kills := Kills + 1
if (FindObj3(x, y, 'Attack', MonsterColor, Tolerance) and (InFight = false)) then
if ((not InFightAt(x,y)) or (MultiFight = true)) then
Begin
Mouse(x, y, 5, 5, true);
Wait(500)
Flag
Wait(500)
End
While Infight do Randoms
Randoms
AntiBan;
ClearDebug
Writeln('You have worked for ' + TimeRunning + '!')
Writeln('You have killed ' + inttostr(kills) + ' monsters!')
SRLRandomsReport
until (False)
end.
I'll release it after a 2 hour test.