Mancubus 8 Posted April 30, 2022 I want to hop was fast as possible, quickHop() logs me out so that doesnt work for me I dont think its much faster than hopWorld(). Anyone know of a fast way to hop to a random members world?
AsBakedAsCake 203 Posted May 1, 2022 8 hours ago, Mancubus said: I want to hop was fast as possible, quickHop() logs me out so that doesnt work for me I dont think its much faster than hopWorld(). Anyone know of a fast way to hop to a random members world? If you want to hop fast so you don't die or something, it might be better just to have the script log out, then choose the world from the actual menu screen.
Mancubus 8 Author Posted May 1, 2022 No Its not that I actually want it to hop as fast as possible, would be perfect if the client could send the hop request without scrolling through the entire worldhopper to find the world. Would this be possible?
Mancubus 8 Author Posted May 3, 2022 actually found a solution for it, just made sure hte bot never picks a world that it is so far down/up that is has to scroll to it.
420x69x420 73 Posted June 11, 2022 The quickHop() method is deprecated, leaving the only option being standard hopWorld() methods which use the middle mouse scroll effects to scroll slowly through the world list. To speed it up, I have written a method of worldhopping which opens the world hopper menu manually and then checks if the desired world is already visible, if not then it clicks the appropriate location on the scrollbar to instantly scroll to it, then clicks it. It does not check if the desired world is a valid world (like 1365) so there is a seperate method to grab a valid and random world. Also the code only works for fixed mode lol, and you have to change the sleeps to your own sleeps. public static List<World> worlds; public static void scrollHopWorld(int world) { if(Players.localPlayer().isInCombat() || Worlds.getCurrentWorld() == world) return; Timer timeout = new Timer(Sleep.calculate(8888, 1111)); while(Worlds.getCurrentWorld() != world && !timeout.finished() && Client.isLoggedIn() && !Players.localPlayer().isInCombat() && Skills.getRealLevel(Skill.HITPOINTS) > 0) { if(Widgets.getWidgetChild(69,2) != null && Widgets.getWidgetChild(69,2).isVisible() && Widgets.getWidgetChild(69,2).getText().contains("Loading...")) { Sleep.sleep(50, 1111); continue; } if(Widgets.getWidgetChild(182, 7) != null && Widgets.getWidgetChild(182, 7).isVisible() && Widgets.getWidgetChild(182, 7).getText().contains("World Switcher")) { Widgets.getWidgetChild(182, 3).interact("World Switcher"); Sleep.sleep(50, 1111); continue; } if(!Tabs.isOpen(Tab.LOGOUT)) { Tabs.open(Tab.LOGOUT); Sleep.sleep(50, 1111); continue; } //worlds are now loaded if(Widgets.getWidgetChild(69,2) != null && Widgets.getWidgetChild(69,2).isVisible() && Widgets.getWidgetChild(69,2).getText().contains("Current world - ")) { //establish correct WidgetChild of desired world's clickable bar int gc = -1; for(WidgetChild w : Widgets.getWidgetChildrenContainingText(Integer.toString(world))) { if(w.getX() == 563) // correct x position lineup for world number location **FIXED MODE** { gc = (w.getIndex() - 2); break; } } WidgetChild worldWidget = null; if(gc >= 0) worldWidget = Widgets.getWidgetChild(69,17,gc); if(worldWidget == null) { Sleep.sleep(10, 111); continue; } Rectangle worldRectangle = worldWidget.getRectangle(); WidgetChild worldListContainer = Widgets.getWidgetChild(69,17); if(worldListContainer == null) { Sleep.sleep(10, 111); continue; } if(worldRectangle.intersects(Widgets.getWidgetChild(69,15).getRectangle())) { //World widget is visible - clicking it Rectangle visibleWorldRectangle = worldRectangle.intersection(Widgets.getWidgetChild(69,15).getRectangle()); Mouse.click(visibleWorldRectangle); } else { //World list needs scrolling double yPos = worldRectangle.getCenterY(); double yMin = worldListContainer.getRectangle().getMinY(); double yMax = worldListContainer.getRectangle().getMaxY(); double offsetRatio = ((yPos - yMin) / (yMax - yMin)); WidgetChild scrollContainer = Widgets.getWidgetChild(69,18,0); if(scrollContainer == null) { Sleep.sleep(10, 111); continue; } double yScrollMin = scrollContainer.getRectangle().getMinY(); int xRand = (int) Calculations.random(scrollContainer.getRectangle().getMinX(), scrollContainer.getRectangle().getMaxX()); int yClickPos = (int) ((scrollContainer.getHeight() * offsetRatio) + yScrollMin); Mouse.click(new Point(xRand,yClickPos)); } Sleep.sleep(50, 1111); continue; } Sleep.sleep(50, 1111); } } public static int randomWorld(boolean members) { if(worlds == null || worlds.isEmpty()) worlds = Worlds.noMinimumLevel(); List<World> filteredWorlds = new ArrayList<World>(); if(filteredWorlds == null || filteredWorlds.isEmpty()) { for(World tmp : worlds) { if(members) { if(tmp.isMembers() && !tmp.isPVP() && !tmp.isTournamentWorld() && !tmp.isLeagueWorld() && !tmp.isDeadmanMode()) { filteredWorlds.add(tmp); } } else { if(!tmp.isMembers() && !tmp.isPVP() && !tmp.isTournamentWorld() && !tmp.isLeagueWorld() && !tmp.isDeadmanMode()) { filteredWorlds.add(tmp); } } } } return filteredWorlds.get(new Random().nextInt(filteredWorlds.size() - 1)).getWorld(); } Then when I want to hop to a random world in my script, just say scrollHopWorld(randomWorld(false)); and the void function returns when either a 9-second timeout runs out, or the world is hopped to the correct world, or you enter combat, or die, or logout.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.