I am looking at this script to try and understand the API: https://github.com/Explv/Tutorial-Island
I used the documentation and think I get it all now, but only part I cant find an answer to on the forums or really understand from reading the API documentation is exchangeContext(getBot()).
The main onLoop calls someSection.onLoop() on various sections, each section extends MethodProvider and is its own class.
In the onStart() part it calls someSection.exchangeContext(getBot()) on each of the sections.
My question is, what does exchangeContext() do?
The API says getBot() gets the bot instance, is that the individual bot if multiple are running in the osbot client, or am I misunderstanding?
Appreciate any help
public final class TutorialIsland extends Script {
public static final String VERSION = "v6.2";
private final TutorialSection rsGuideSection = new RuneScapeGuideSection();
private final TutorialSection survivalSection = new SurvivalSection();
private final TutorialSection cookingSection = new CookingSection();
private final TutorialSection questSection = new QuestSection();
private final TutorialSection miningSection = new MiningSection();
private final TutorialSection fightingSection = new FightingSection();
private final TutorialSection bankSection = new BankSection();
private final TutorialSection priestSection = new PriestSection();
private final TutorialSection wizardSection = new WizardSection();
@Override
public void onStart() {
rsGuideSection.exchangeContext(getBot());
survivalSection.exchangeContext(getBot());
cookingSection.exchangeContext(getBot());
questSection.exchangeContext(getBot());
miningSection.exchangeContext(getBot());
fightingSection.exchangeContext(getBot());
bankSection.exchangeContext(getBot());
priestSection.exchangeContext(getBot());
wizardSection.exchangeContext(getBot());
Sleep.sleepUntil(() -> getClient().isLoggedIn() && myPlayer().isVisible() && myPlayer().isOnScreen(), 6000, 500);
}
@Override
public final int onLoop() throws InterruptedException {
if (isTutorialIslandCompleted()) {
stop(true);
return 0;
}
switch (getTutorialSection()) {
case 0:
case 1:
rsGuideSection.onLoop();
.
.
.