Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • World hopper issue


    kamilo
     Share

    Recommended Posts

    getWorldHopper().hopWorld(e); // Used this statement to hop worlds
    sleepUntil(() -> getWorlds().getWorld(getClient().getCurrentWorld()) == e, Calculations.random(6000,7100)); 
    							

     

    my issue is that my bot tries to perform actions while the world is still loading, it throws an exception in the log

     

    it still works but i would like to fix it

    i tried this:
                                sleepUntil(() -> getWorlds().getWorld(getClient().getCurrentWorld()) == e, Calculations.random(6000,7100));
                                

    doesn't seem to resolve it 

     

    any suggestions?

    Link to comment
    Share on other sites

    That's because the world changes before the game fully loads.

    Which is also where the world hopper cuts out, when your world is the world that you're trying to hop to. That's also the criteria for returning true.

     

    Link to comment
    Share on other sites

    2 hours ago, Nuclear Nezz said:

    That's because the world changes before the game fully loads.

    Which is also where the world hopper cuts out, when your world is the world that you're trying to hop to. That's also the criteria for returning true.

     

    do you suggest a different line of code then

    Link to comment
    Share on other sites

    As @Nuclear Nezz mentioned, the world number is changed before the world loads, therefore you must find a way to pause any actions until the world loads.

    I suggest manually calculating how much sleep time it needs to resume activities, then just apply the calculations in the sleep method. You do not need to be too accurate with this, just positively deviate the sleep value and that should take care of network lags.

    Link to comment
    Share on other sites

    A way I thought of is the Camera View, I know for a fact that the Camera View changes after World loading is complete..

    So you could sleepUntil the Camera ViewPoint is different, like for an example:

    First: find out the original getX() & getY():
    
    int x = getCamera().getX();
    
    int y = getCamera().getY();
    
    Second: hop
    
    getWorldHopper().hop(int world);
    
    sleepUntil(()-> getCamera().getX() != x || getCamera().getY() != y, 7000);

    You could also check the pitch, Z axis, Yaw by

    getCamera().getYaw();
    
    getCamera().getZ();
    
    getCamera().getPitch();

    This is just an untested "test" I thought of, give it a try :)

    Programming is all about new ideas, trial and error!

    Edited by ItsDefiled
    Link to comment
    Share on other sites

    13 hours ago, ItsDefiled said:

    A way I thought of is the Camera View, I know for a fact that the Camera View changes after World loading is complete..

    So you could sleepUntil the Camera ViewPoint is different, like for an example:

    First: find out the original getX() & getY():
    
    int x = getCamera().getX();
    
    int y = getCamera().getY();
    
    Second: hop
    
    getWorldHopper().hop(int world);
    
    sleepUntil(()-> getCamera().getX() != x || getCamera().getY() != y, 7000);

    You could also check the pitch, Z axis, Yaw by

    getCamera().getYaw();
    
    getCamera().getZ();
    
    getCamera().getPitch();

    This is just an untested "test" I thought of, give it a try :)

    Programming is all about new ideas, trial and error!

    great idea i remember back in the day the camera would reset to north

    but that doesn't work, personally tested it out, camera values stay the same upon hop, good idea tho

    Link to comment
    Share on other sites

    The world switcher widget doesn't update the world text until loading is complete, in fact for a brief moment after loading is complete the text is "Loading..."
    image.png.575b7ad3f2512e9021c0edaa31bbf342.png
    this means we can set a sleepuntil that checks this widgets text, with a timeout that is sizeable

    public void hopToWorld(int world){
            String worldText = "Current world - ";
            getWorldHopper().hopWorld(world);
            sleepUntil(() -> getWidgets().getWidget(69).getChild(2).getText().equals(worldText + world), 20000);
        }

     

    Edited by HyperCrusher
    Link to comment
    Share on other sites

    6 hours ago, kamilo said:

    great idea i remember back in the day the camera would reset to north

    but that doesn't work, personally tested it out, camera values stay the same upon hop, good idea tho

    Oh, alright.

    I tried a very simple method on my end, and it worked.

    just sleep 1 to 2 secs before the hop, and 1 to 2 secs after the hop.. that worked wonderful for me :)

    Link to comment
    Share on other sites

    59 minutes ago, ItsDefiled said:

    Oh, alright.

    I tried a very simple method on my end, and it worked.

    just sleep 1 to 2 secs before the hop, and 1 to 2 secs after the hop.. that worked wonderful for me :)

    if you're running a laggy client, or client disconnects etc, it can effect that. i've noticed my time changes and it isnt fixed LOL

     

    guess nothing's perfect 

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.