Skip to content

Commit

Permalink
Break loop if travel log open
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesWilde committed Dec 11, 2023
1 parent efd2cb5 commit af2244e
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions osr/handlers/teleports/transport.simba
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,10 @@ begin
end;
if Inventory.ContainsItem(fairyTeleportStaff) then
canFairyTeleport := WaitUntil(Inventory.ClickItem(fairyTeleportStaff), 500, 2000);

if not canFairyTeleport then
canFairyTeleport := WaitUntil(Equipment.ContainsItem(fairyTeleportStaff), 500, 2000);;

Self.DebugLn('Is it equipped? ' + ToString(canFairyTeleport));
if not canFairyTeleport then
begin
Expand All @@ -460,38 +460,40 @@ begin
raise "You do not have a dramen/lunar staff. You can turn off fairy teleports";
end;
until canFairyTeleport;

Self.DebugLn('Getting walkable fairy ring');
walkableFairyRing := self.getWalkableFairyRing(500);

// try to use ardy cloak if available
if (not (ToString(self.ardougneCape) = '')) and (walkableFairyRing.worldPoint = [0,0]) then
begin
Self.DebugLn('Looking for ', ToString(self.ardougneCape));
if not Equipment.ClickItem(self.ardougneCape, 'Monastery') then
if not (Inventory.Open() and Inventory.ClickItem(self.ardougneCape, 'Monastery')) then
raise "Couldn't find " + self.ardougneCape + " in inventory or equipment";

Wait(SRL.TruncatedGauss(4000, 5500));
// set fairy ring to walk to after teleporting
walkableFairyRing := self.getWalkableFairyRing(500);
end;

// walk to nearest fairy ring
if (walkableFairyRing.worldPoint = [0,0]) then
raise 'Fairy ring ' + walkableFairyRing.destination + ' is not configured properly';

Self.DebugLn('We are going to walk to ' + ToString(walkableFairyRing.worldPoint));
ScriptWalker^.WebWalk(walkableFairyRing.worldPoint, 40);

// open fairy ring teleports
Self.DebugLn("opening fairy ring teleports");
repeat
repeat
Mouse.Move(findFairyRingMiddle(walkableFairyRing));
if not MainScreen.IsUpText("y ring") then
Antiban.RandomRotate();
until MainScreen.IsUpText("y ring");
until MainScreen.IsUpText("y ring") or (travelLogOpen := (SRL.FindColors(redTextPoints, redTextColors, travelLog) > 1));
if travelLogOpen then
Break;
Mouse.click(MOUSE_RIGHT);
Self.DebugLn('Selecting configure or previous ring');
// handle zanaris cause it's weird
Expand All @@ -501,14 +503,14 @@ begin
for fairyRingChooseOption in ChooseOption.GetOptions() do
if Between('(',')', fairyRingChooseOption.Text) = teleportLocation.destination.Replace(' ', '') then
usedChooseOptionTeleport := ChooseOption.Select(fairyRingChooseOption.Text);

if not usedChooseOptionTeleport then
ChooseOption.Select('Configure', MOUSE_LEFT);

Wait(SRL.TruncatedGauss(3000, 4500));
travelLogOpen := (SRL.FindColors(redTextPoints, redTextColors, travelLog) > 1);
until travelLogOpen or usedChooseOptionTeleport;

if not usedChooseOptionTeleport then
begin
Self.DebugLn('Scrolling to top of fairy rings');
Expand All @@ -531,10 +533,10 @@ begin
Mouse.move(fairyCodeTextBox);
until MainScreen.IsUpText(teleportLocation.destination) or (codeFindAttempt > 3);
until foundCode;

// click the given teleport in travel log
Mouse.click(fairyCodeTextBox, MOUSE_LEFT);

// click the confirm teleport in middle of screen
Mouse.move(self.getFairyDialTeleportBox());
WaitUntil(MainScreen.IsUpText("Confirm"), 200, 5000);
Expand Down

0 comments on commit af2244e

Please sign in to comment.