dirtrider478 12 Share Posted July 2, 2020 Im trying to get my script to save the current world that it logs into and cant quite figure it out. I know how to find out which world its currently in but dont know how to save it to come back and use that world number when trying to return to that world. Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Share Posted July 3, 2020 //Specific World public static final int HOUSE_PARTY_WORLD = 330; ctx.getWorldHopper().hopWorld(LocalConstants.HOUSE_PARTY_WORLD); //Random world (with lambda filter) world = ctx.getWorlds().getRandomWorld((w) -> !w.isF2P() && !w.isPVP() && !w.isDeadmanMode() && !w.isHighRisk()); ctx.getWorldHopper().hopWorld(world); Id also reccomend adding a catch in your loop to wait until the hop is complete: if (getClient().getGameState() == GameState.HOPPING) { log("Hopping worlds"); return 600; } Link to comment Share on other sites More sharing options...
Succulent 18 Share Posted July 3, 2020 What @thecloakdone said is what you want. I would just add a few more world checks such as !w.isBountyWorld() && !w.isTournamentWorld() && !w.isTwistedLeague() You can also use !(w.getMinimumLevel() >= 1250) To disable skill-total worlds (reduce to 250 if you're using F2P). Another option is working out the player's total level and only allowing worlds that have a total level requirement less than or equal to it. From your post it seems maybe you want to get your current world if a certain condition is met, and go back to it later in the script. To do this simply save your current world in a variable and hop to it directly later: // Saved world object private World savedWorld = null; // Save the current world if some condition is met // For example you just saw a dragon impling in it if (currentWorldHasDragonImpling()) { savedWorld = getWorlds().getMyWorld(); } ... // Later in the script... // We've stored the world that we hopped to earlier and want to go back to later on if (savedWorld != null) { getWorldHopper().hopWorld(savedWorld); } Link to comment Share on other sites More sharing options...
dirtrider478 12 Author Share Posted July 3, 2020 5 hours ago, Succulent said: What @thecloakdone said is what you want. I would just add a few more world checks such as !w.isBountyWorld() && !w.isTournamentWorld() && !w.isTwistedLeague() You can also use !(w.getMinimumLevel() >= 1250) To disable skill-total worlds (reduce to 250 if you're using F2P). Another option is working out the player's total level and only allowing worlds that have a total level requirement less than or equal to it. From your post it seems maybe you want to get your current world if a certain condition is met, and go back to it later in the script. To do this simply save your current world in a variable and hop to it directly later: // Saved world object private World savedWorld = null; // Save the current world if some condition is met // For example you just saw a dragon impling in it if (currentWorldHasDragonImpling()) { savedWorld = getWorlds().getMyWorld(); } ... // Later in the script... // We've stored the world that we hopped to earlier and want to go back to later on if (savedWorld != null) { getWorldHopper().hopWorld(savedWorld); } 6 hours ago, thecloakdone said: //Specific World public static final int HOUSE_PARTY_WORLD = 330; ctx.getWorldHopper().hopWorld(LocalConstants.HOUSE_PARTY_WORLD); //Random world (with lambda filter) world = ctx.getWorlds().getRandomWorld((w) -> !w.isF2P() && !w.isPVP() && !w.isDeadmanMode() && !w.isHighRisk()); ctx.getWorldHopper().hopWorld(world); Id also reccomend adding a catch in your loop to wait until the hop is complete: if (getClient().getGameState() == GameState.HOPPING) { log("Hopping worlds"); return 600; } Thanks guys I ended up just adding a private int and getclient getcurrent world on public void onstart. I will be using the code for checking if the client is hopping cause that will fix some of my problems. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.