legacyZZ Posted May 7, 2019 Share Posted May 7, 2019 Hello there, ive been stuck at this line of code im trying to create. So basically i want to hop P2P worlds but in order 302>303>304>305>306>307>309 etc.. Ive seen this line of code hopToP2PWorld() Hops to a random P2P server which is not full or is PvP. But this is used for random hopping and not what i need Any1 could help me out Quote Link to comment Share on other sites More sharing options...
FuryShark Posted May 7, 2019 Share Posted May 7, 2019 53 minutes ago, legacyZZ said: Hello there, ive been stuck at this line of code im trying to create. So basically i want to hop P2P worlds but in order 302>303>304>305>306>307>309 etc.. Ive seen this line of code hopToP2PWorld() Hops to a random P2P server which is not full or is PvP. But this is used for random hopping and not what i need Any1 could help me out hop(int world) Quote Link to comment Share on other sites More sharing options...
legacyZZ Posted May 7, 2019 Author Share Posted May 7, 2019 Just that? Quote Link to comment Share on other sites More sharing options...
EsotericRS Posted May 7, 2019 Share Posted May 7, 2019 1 hour ago, legacyZZ said: Just that? Here's some pseudo-ish code: get a list of all the worlds i.e. getWorlds.getAvailableWorlds() Iterate through this list and pick out the ones that are paid worlds using .isMembersWorld() and put them in your own list of worlds maybe call it membersWorldsList find the index of the current world within that membersWorldsList you just created hop to membersWorldsList[index+1] until the end then wrap around... maybe consider a linked list or something Havn't tested or tried this specific problem yet - but thats how Id go about solving it Quote Link to comment Share on other sites More sharing options...
Chris Posted May 7, 2019 Share Posted May 7, 2019 https://osbot.org/api/org/osbot/rs07/api/Worlds.html#getAvailableWorlds-boolean- Quote Link to comment Share on other sites More sharing options...
Sexybeast Posted May 7, 2019 Share Posted May 7, 2019 7 hours ago, legacyZZ said: Hello there, ive been stuck at this line of code im trying to create. So basically i want to hop P2P worlds but in order 302>303>304>305>306>307>309 etc.. Ive seen this line of code hopToP2PWorld() Hops to a random P2P server which is not full or is PvP. But this is used for random hopping and not what i need Any1 could help me out private int nextWorldInOrder(boolean members) { return getWorlds().getAvailableWorlds(true) .stream() .filter(world -> !world.isPvpWorld() && world.isMembers() == members && !world.getActivity().contains("skill") && !world.getActivity().contains("Deadman") && world.getId() > getWorlds().getCurrentWorld()) .min(Comparator.comparingInt(World::getId)) .map(World::getId) .orElseGet(() -> members ? 302 : 301); } and then getWorlds().hop(nextWorldInOrder(true)); should work for you, if u want to use total level worlds aswell then parseInt of world acrivity and check if ur total level > required 1 Quote Link to comment Share on other sites More sharing options...
legacyZZ Posted May 7, 2019 Author Share Posted May 7, 2019 Illegal modifier for parameter nextWorldInOrder; only final is permitted Quote Link to comment Share on other sites More sharing options...