Simba Code:
program FightCaveTrainer;
{$DEFINE SMART}
{$i SRL-OSR/Srl.simba}
Const
caveTol = 2;
version = '0.6';
Var
counter, caveEntrances: Integer;
caveEntranceWhite: TIntegerArray;
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
End;
Function FightCaveSleep(sleepx, sleepy: Integer; retaliate: Boolean): Boolean;
Var
x , y, sleepTime: Integer;
loop : Boolean;
Begin
loop := true;
counter := 0;
sleepTime := RandomRange(sleepx, sleepy);
While loop Do
Begin
If FindObjCustom(x, y, [' '], caveEntranceWhite, caveTol) Then
Begin
Result := false;
loop := false;
WriteLn('We see cave entrance!');
End Else If (not (InRange(Length(GetFightBarTPA(IntToBox(MSX1, MSY1, MSX2, MSY2))), 30, 150))) and (retaliate) Then
Begin
Result := false;
loop := false;
End Else If (sleepTime - counter > 0) and loop = true Then
Begin
wait(10);
counter := (counter + 10);
End Else
Begin
Result := True;
loop := False;
End;
End;
End;
Procedure FightCaveLoop;
Var
x, y : Integer;
Begin
If FindObjCustom(x, y, ['nter'], caveEntranceWhite, caveTol) Then
Begin
WriteLn('Found correct cave!');
ClickMouse2(True);
While FindObjCustom(x, y, ['nter'], caveEntranceWhite, caveTol) Do
Begin
ClickMouse2(true);
Wait(RandomRange(500, 1000));
End;
If RandomRange(1, 10) > 8 Then
Begin
SetRun(true);
GameTab(tab_Stats);
End;
caveEntrances := (caveEntrances + 1);
WriteLn('Entered cave.');
ClearDebug;
WriteLn('-* FightCaveTrainer v'+version);
WriteLn('-* ');
WriteLn('-* Entered: ' + intToStr(caveEntrances));
WriteLn('-* Runtime: ' + TimeRunning);
Wait(RandomRange(4000, 5000));
SetAngle(0);
End Else
If (Not FindObjCustom(x, y, ['nter'], caveEntranceWhite, caveTol)) and (CountDots('yellow') > 0) Then
Begin
FightCaveSleep(200,500,False);
If InRange(Length(GetFightBarTPA(IntToBox(MSX1, MSY1, MSX2, MSY2))), 30, 150) Then
Begin
If (FightCaveSleep(3000,5000,True)) Then
Begin
If InRange(Length(GetFightBarTPA(IntToBox(MSX1, MSY1, MSX2, MSY2))), 30, 150) Then
Begin
Retaliate(False);
Wait(RandomRange(500,700));
Retaliate(True);
GameTab(tab_Stats);
FightCaveSleep(3000,5000,False);
End;
End;
End;
End Else MakeCompass(185);
End;
Begin
SetupSRL;
DeclarePlayers;
SetRun(True);
GameTab(tab_Stats);
caveEntranceWhite := [7763583, 8553356];
MouseSpeed := 15;
While(True) Do
Begin
If not LoggedIn Then
Begin
LogInPlayer;
SetRun(True);
GameTab(tab_Stats);
MakeCompass(185);
SetAngle(0);
End;
FightCaveLoop;
End;
End.