diff --git a/src/script/TutorialIsland.java b/src/script/TutorialIsland.java index 3d5ce53..a930b76 100644 --- a/src/script/TutorialIsland.java +++ b/src/script/TutorialIsland.java @@ -3,7 +3,6 @@ import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import sections.*; -import utils.Sleep; @ScriptManifest(author = "Explv", name = "Explv's Tutorial Island", info = "Completes Tutorial Island", version = 5.3, logo = "") public final class TutorialIsland extends Script { @@ -29,16 +28,13 @@ public void onStart() throws InterruptedException { bankSection.exchangeContext(getBot()); priestSection.exchangeContext(getBot()); wizardSection.exchangeContext(getBot()); - - // prevents script from skipping character customization - Sleep.sleepUntil(() -> getClient().isLoggedIn() && myPlayer().isVisible() && myPlayer().isOnScreen(), 6000, 600); } @Override public final int onLoop() throws InterruptedException { if (isTutorialIslandCompleted()) { - stop(true); - return 0; + stop(true); + return 0; } switch (getTutorialSection()) { diff --git a/src/sections/BankSection.java b/src/sections/BankSection.java index 8c3ebc6..bddca28 100644 --- a/src/sections/BankSection.java +++ b/src/sections/BankSection.java @@ -4,7 +4,9 @@ import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; +import utils.CachedWidget; import utils.Sleep; +import utils.WidgetActionFilter; import java.util.Arrays; import java.util.List; @@ -12,6 +14,8 @@ public final class BankSection extends TutorialSection { + private final CachedWidget accountManagementWidget = new CachedWidget(new WidgetActionFilter("Account Management")); + private static final Area BANK_AREA = new Area( new int[][]{ {3125, 3121}, @@ -105,12 +109,9 @@ private boolean openDoorAtPosition(final Position position) { } private void openAccountManagementTab() { - if (accountManagementWidget().isPresent() && accountManagementWidget().get().interact()) { + if ( accountManagementWidget.get(getWidgets()).isPresent() && accountManagementWidget.get(getWidgets()).get().interact()) { Sleep.sleepUntil(() -> getProgress() == 532, 5000, 600); } } - private Optional accountManagementWidget() { - return getWidgets().containingActions(548, "Account Management").stream().findFirst(); - } } diff --git a/src/sections/RuneScapeGuideSection.java b/src/sections/RuneScapeGuideSection.java index f903796..f83ff10 100644 --- a/src/sections/RuneScapeGuideSection.java +++ b/src/sections/RuneScapeGuideSection.java @@ -18,7 +18,7 @@ public final class RuneScapeGuideSection extends TutorialSection { - private final CachedWidget creationScreenWidget = new CachedWidget("Welcome to RuneScape"); + private final CachedWidget creationScreenWidget = new CachedWidget("Head"); private final CachedWidget experienceWidget = new CachedWidget("What's your experience with Old School Runescape?"); private boolean isAudioDisabled; @@ -35,12 +35,12 @@ public final void onLoop() throws InterruptedException { switch (getProgress()) { case 0: + case 1: + case 2: if (creationScreenIsVisible()) { createRandomCharacter(); - } else if (experienceWidget.get(getWidgets()).isPresent()) { - if (getDialogues().selectOption(random(1, 3))) { - Sleep.sleepUntil(() -> !experienceWidget.get(getWidgets()).map(widget -> !widget.isVisible()).orElse(true), 2000); - } + } else if (experienceWidget.get(getWidgets()).isPresent() && getDialogues().selectOption(random(1, 3))) { + Sleep.sleepUntil(() -> !experienceWidget.get(getWidgets()).map(widget -> !widget.isVisible()).orElse(true), 2000, 600); } else { talkToInstructor(); } @@ -77,6 +77,9 @@ private boolean creationScreenIsVisible() { } private void createRandomCharacter() throws InterruptedException { + // letting all the widgets show up + sleep(2000); + if (new Random().nextInt(2) == 1) { getWidgets().getWidgetContainingText("Female").interact(); }