Simba Code:
program CaveFighter;
{$DEFINE SMART}
{$i srl-6/srl.simba}
//{$I SPS/lib/SPS-RS3.Simba}
var
InTheCave,InTheLobby: TPointArray;
r: Integer;
const
basic = [1,2,3,4,5,6]; //Which actionbar slots do you have a basic ability in?
threshold = [7,8]; //Which actionbar slots do you have a threshold ability in?
UseUltimate = True;
ultimate = [9]; //Which actionbar slots do you have an ultimate ability in?
procedure DeclarePlayers;
// I stole this off some random script... logs you in and stuff.
begin
setLength(players, 1);
currentPlayer := 0;
with players[0] do
begin
loginName := '';
password := '';
isMember := True;
isActive := true;
world := -1;
end;
end;
function WhereAreWe(): String;
var
p: Tpoint;
begin
if (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) or (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Lobby';
if not (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds)) and not (minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds)) then
Result := 'Cave';
end;
procedure SetUpCharacter;
// Sets up the character to the script specifications
var
p: tpoint;
begin
Wait(3000+Random(300));
minimap.setAngle(MM_DIRECTION_EAST);
Wait(1000+Random(500));
TRSMainscreen.setAngle(MS_ANGLE_LOW);
mouseScroll(p, 50, False);
//WhereAreWe;
end;
function FindOpening: Boolean;
var
i, s, h: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
t: TTimeMarker;
p: Tpoint;
begin
WhereAreWe;
if (WhereAreWe = 'Cave') then
begin
Exit;
end;
if (WhereAreWe = 'Lobby') then
begin
mouse(p, MOUSE_LEFT);
FindColorsTolerance(TPA, 65793,MainScreen.GetBounds, 0, ColorSetting(2, 0.0, 0.0));
//FindColorsTolerance(TPA, 7449049,inttobox(65,267,520,333), 4, ColorSetting(2, 0.3, 0.3));
if (Length(TPA) < 1) then
begin
Writeln('nope');
Exit;
end;
ATPA := TPA.ToATPA(20, 20);
SortATPAFromMidPoint(ATPA, Point(randomRange(mainscreen.playerpoint.x - 100, mainscreen.playerpoint.x + 100), mainscreen.playerpoint.y));
h := High(ATPA);
for i := 0 to h do
begin
if (Length(ATPA[i]) < 50) then
Continue;
Mouse(ATPA[i][random(High(ATPA[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['ave', 'nter', 'ntrance'], 500) then
begin
fastclick(mouse_right);
Wait(500+Random(100));
chooseOption.select(['nter']);
Exit();
end;
end;
end;
end;
procedure NiceConvo;
begin
if (conversationBox.areTalking()) then
conversationBox.continue(true, true);
Wait(200+Random(100));
end;
function abilityReady(slot: integer): boolean;
begin
if not isLoggedIn then Exit;
result := false;
if actionBar.getAbilityCooldown(slot) = 1 then
result := true;
end;
function chooseAbility : integer;
begin
if not isLoggedIn then Exit;
if ((actionBar.getAdrenalinePercent() < 50) or (not (abilityready(threshold[0]) or abilityready(threshold[1])))) then
begin
for r := 0 to high(basic) do
begin
if abilityready(basic[r]) then
begin
result := basic[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if (actionBar.getAdrenalinePercent() >= 50) then
begin
for r := 0 to high(threshold) do
begin
if abilityready(threshold[r]) then
begin
result := threshold[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if useUltimate then
begin
if (actionBar.getAdrenalinePercent() = 100) then
begin
for r:= 0 to high(ultimate) do
begin
if abilityready(ultimate[r]) then
begin
result := ultimate[r];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
end;
end;
function InitQPrayer(): Boolean;
// If the prayer percent is lower than 90 percent, it will not toggle them as a failsafe. Otherwise it will toggle them.
begin
if (actionBar.getPrayerPercent()) < 99 then
begin
WriteLn('Prayer below 90%, not using Quickprayers');
Exit;
end;
MouseOval(306,323,3,3,Mouse_Left);
end;
procedure Fight;
var
NotFightingYet: Integer;
begin
if (WhereAreWe = 'Lobby') then
begin
Exit;
end;
repeat
actionbar.clickslot(chooseAbility);
writeln('Hitpoints %: ' +IntToStr(actionBar.getHPPercent()));
writeln('Adrenaline %: ' +IntToStr(actionBar.getAdrenalinePercent()));
writeln('Prayer %: ' +IntToStr(actionBar.getPrayerPercent()));
if (actionBar.getHPPercent()) = 100 then
begin
NotFightingYet := NotFightingYet+1; // Failsafe so that you don't get stuck out of a fight in fight mode with full health
end;
until actionBar.getHPPercent() < 2 or (NotFightingYet >= 100) or (WhereAreWe = 'Lobby');
if (NotFightingYet >= 100) then
begin
WriteLn('We were stuck in the lobby waiting to fight');
end;
Wait(6000+Random(1000));
end;
begin
smartPlugins := ['d3d9.dll'];
SetupSRL();
DeclarePlayers;
If Not Players[CurrentPlayer].Login Then
Players[CurrentPlayer].Login;
SetupCharacter;
repeat
FindOpening;
Wait(8000+Random(1000));
NiceConvo;
Wait(1000+Random(100));
InitQPrayer;
Fight;
Wait(6000+Random(300));
NiceConvo;
until not (isLoggedIn);
sixhourfix();
end.
Once the script is well ironed out, then I'll send it out as a download .simba file. Just for now you can read through it without having to download it and possibly learn something from it. If you got questions just ask me.