crazykid080 14 Share Posted October 19, 2020 I asked about this is chat and got a decent answer that set me on the right track but I'm currently stuck, not sure what I'm doing wrong here, what I'm trying to do is make sure my bot starts on world X as it iterates through worlds WorldHopper.openWorldHopper(); sleepUntil(new Condition() { @Override public boolean verify() { return WorldHopper.isWorldHopperOpen(); } }, 5000); worldHopper = new Widget(69); log(worldHopper); //returns 69, that means it got the right widget... right? WidgetChild currentWorld = worldHopper.getChild(2); log(currentWorld); //says null, this is the issue I'm facing if (!currentWorld.getText().contains(X)) { WorldHopper.hopWorld(worlds[index]); } index++; Link to comment Share on other sites More sharing options...
bloodwi11 2 Share Posted October 19, 2020 Your creating your own widget instead of getting the one from the client Widget worldHopper = getWidgets().getWidget(69); I can't check for sure if this is correct since I'm not at my desk, but this should put you on the right path Link to comment Share on other sites More sharing options...
bloodwi11 2 Share Posted October 19, 2020 Updated since the old method is deprecated Widget worldHopper = Widgets.getWidget(69); Link to comment Share on other sites More sharing options...
Hmm 31 Share Posted October 19, 2020 Hi there, Any reason why you can't use Worlds.getCurrentWorld() to make sure your bot starts on the X world? Is there a specific reason why you need to iterate through worlds? If no, you should consider using Worlds.getRandomWorld(w -> w != null && w.isf2p() && w.noMinimumLevel()) - Apply whatever filters you need for your specific script. Check the Worlds class in Javadocs - very useful for world hopping. Hope this helps. Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted October 20, 2020 The world hopper class is only applicable to in game hopping iirc. If you intend on hopping at the login screen you shall need to create your own method. Link to comment Share on other sites More sharing options...
Hmm 31 Share Posted October 20, 2020 8 minutes ago, Pseudo said: The world hopper class is only applicable to in game hopping iirc. If you intend on hopping at the login screen you shall need to create your own method. Hi, I believe what @crazykid080 is trying to do is get the current world, (his desired starting world) and then increment the hop each time by one. This is more than possible using the Worlds class however he will have to add additional logic once the world he is attempting to hop is a p2p, high risk, pvp, or high total level world, (depending on his needs for his script). Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted October 20, 2020 Oh I see, must've misinterpreted what OP was getting at. Client.getCurrentWorld returns your current logged in world, from there just filter the worlds however you should need. Iirc when I did something similar I cached all 'valid worlds' on start up by filtering out those that didn't qualify my criteria, then hopping to world in my array that is next after my current worlds index. Link to comment Share on other sites More sharing options...
crazykid080 14 Author Share Posted October 21, 2020 Apologies for the lateness, let's get through this one by one On 10/19/2020 at 6:38 AM, bloodwi11 said: Your creating your own widget instead of getting the one from the client Updated since the old method is deprecated Widget worldHopper = Widgets.getWidget(69); Well shoot that explains it, I don't know why I didn't catch that! On 10/19/2020 at 12:42 PM, NEWPROG said: Hi there, Any reason why you can't use Worlds.getCurrentWorld() to make sure your bot starts on the X world? Is there a specific reason why you need to iterate through worlds? If no, you should consider using Worlds.getRandomWorld(w -> w != null && w.isf2p() && w.noMinimumLevel()) - Apply whatever filters you need for your specific script. Check the Worlds class in Javadocs - very useful for world hopping. Hope this helps. So I was looking in the wrong class! That explains a lot! I was wondering why I couldn't find a getCurrentWorld! Thank you all for your replies and explanations, this helps immensely Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.