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
  • Two major bugs that I can't seem to nail down


    crazykid080

    Recommended Posts

    Gosh I was hoping to only have to ask for help with one bug but looks like I need to ask for both.

    So one current bug that has been triggering for me is an issue where it doesn't world hop correctly. It seems to happens once, fails, tries again and then works fine

    Code related to it:

    case TRADE_SHOP:
    	utils.stateHandler(State.TRADE_SHOP);
        int itemCount = 0;
        boolean tempWH = true;
        for (String item : utils.itemList) {
            if (item.equals(annoyingItem)) itemCount = Shop.count(item);
                if (Shop.count(item) != 0) {
                    tempWH = false;
                    Shop.purchase(item, Shop.count(item));
                    sleep(100);
                }
            }
            if (itemCount < 2) {
            tempWH = true;
        }
    	sleepUntil(Shop::close, 5000);
    	utils.hopWorlds = tempWH;
    //.........
    if (hopWorlds) {
    	return State.HOP_WORLDS;
    }
    //..........
    case HOP_WORLDS:
    	utils.stateHandler(State.HOP_WORLDS);
    	sleep(Calculations.random(500, 2000));
        log("Hopping world");
        sleepUntil(WorldHopper::openWorldHopper, 5000);
        World newWorld = worlds.get(index);
        sleepUntil(() -> WorldHopper.hopWorld(newWorld), 10000);
        index++;
        sleepUntil(() -> Worlds.getCurrentWorld() == newWorld.getWorld(), 10000);
        utils.hopWorlds = false;
        sleep(Calculations.random(500, 2000));

     

    The second bug is in regards to my script not realizing it's in the bank and keeps trying to move around to get into the area to bank

    Code related:

    //init:
    utils.bankArea = BankLocation.LOCATION.getArea(5);
    //..............
    if (Inventory.contains(item -> item.getName().toLowerCase().contains(itemString)) && !bankArea.contains(localPlayer) && Walking.shouldWalk()) {
    	return State.MOVE_BANK;
    }
    //............
    case MOVE_BANK:
    	utils.stateHandler(State.MOVE_BANK);
    	sleepUntil(() -> Walking.walk(utils.bankArea.getRandomTile()), 3000);
    	return Calculations.random(400, 1000);

    I have tried endlessly to debug these myself, trying to iron out inefficiencies that may cause these bugs but I can't see anything that is causing issues.

    Link to comment
    Share on other sites

    For the bank one:

     

    while(!Bank.isOpen()){

    Bank.openClosest();

    sleep(Calculations.random(1200,1800);

    }

     

    OR

    while(!Bank.isOpen()){

    Walking.walk(bankarea.getRandomTile());

    sleep(Calculations.random(1200,1800);

    if(bankarea.contains(getLocalPlayer()){

    Bank.open();

    sleep(Calculations.random(400,800));

    }

    }

     

     

    The world hopper you can try this (it always work in my scripts):

     

    if(!WorldHopper.isOpen()){

    WorldHopper.Open();

    sleep(Calculations.random(400,800));

    }

    And I don't remember how to continue it from top of my head, just check out the docs and play around with WorldHopper class

    Link to comment
    Share on other sites

    17 hours ago, una_maquina said:

    For the bank one:

     

    while(!Bank.isOpen()){

    Bank.openClosest();

    sleep(Calculations.random(1200,1800);

    }

     

    OR

    while(!Bank.isOpen()){

    Walking.walk(bankarea.getRandomTile());

    sleep(Calculations.random(1200,1800);

    if(bankarea.contains(getLocalPlayer()){

    Bank.open();

    sleep(Calculations.random(400,800));

    }

    }

     

     

    The world hopper you can try this (it always work in my scripts):

     

    if(!WorldHopper.isOpen()){

    WorldHopper.Open();

    sleep(Calculations.random(400,800));

    }

    And I don't remember how to continue it from top of my head, just check out the docs and play around with WorldHopper class

    This is all done in states so I have a state if the bank is open, and a different state to see if I am in the bank area. The problem is even if the player is in the area, it doesn't seem to detect that (I did some boolean tests and all were true except bankArea#contains(localPlayer). It talks there fine but keeps walking around because it can't seem to detect that it is in fact inside that area

    As for your worldHopper#open code, the line sleepUntil(WorldHopper::openWorldHopper, 5000); does that for me. Looking at the docs it tells you that it returns a boolean, so if it successfully opens it, it returns true, meaning I don't need to check if it's open.

    Link to comment
    Share on other sites

    Here's some worldhopping code from one of my scripts. Feel free to look through it and use what works for you.

     

        @Override
        public int execute() {
    		setStatus("Too many players around us: " + Players.all(getConfig()::checkWorldHop).size());
            if (!WorldHopper.isWorldHopperOpen()) {
                WorldHopper.openWorldHopper();
                sleep(550,2000);
            }
            if (WorldHopper.isWorldHopperOpen()) {
    			
    			Filter<World> worldsF2P = world -> !world.isMembers() && (world.getMinimumLevel() == 0|| world.getMinimumLevel() <= Skills.getTotalLevel()) && !world.isHighRisk() && !world.isLastManStanding()&& !world.isTournamentWorld() && !world.isPVP();
    			Filter<World> worldsP2P = world -> world.isMembers() && (world.getMinimumLevel() == 0|| world.getMinimumLevel() <= Skills.getTotalLevel()) && !world.isHighRisk() && !world.isLastManStanding() && !world.isTournamentWorld() && !world.isPVP();
    			
                World w = Worlds.getRandomWorld(worldsF2P);
                if (Client.isMembers())
    				w = Worlds.getRandomWorld(worldsP2P);
    			if (w.getWorld() == 400) {
    			    log("Selected beta world 400, going with 399 instead");
                    w = Worlds.f2p().get(399);
                }
                WorldHopper.hopWorld(w);
                sleep(5000,8000);
                sleepWhile(() -> !Client.isLoggedIn() && !getLocalPlayer().isInCombat(), 12500);
            }
            return Calculations.random(350,3000);
        }

     

    Link to comment
    Share on other sites

    I think it is better to check if player is standing on tile like this :

     

    sleepUntil(() -> lumbridgeSpawn.equals(getLocalPlayer().getTile()), 99999);
    

    and maybe your bankarea coords is part of the coords outside, post the MOVE_BANK coords u have, is the bot picking the same tile over and over or is it randomized?

    Link to comment
    Share on other sites

    13 hours ago, darkvenus said:

    I think it is better to check if player is standing on tile like this :

     

    
    
    sleepUntil(() -> lumbridgeSpawn.equals(getLocalPlayer().getTile()), 99999);
    

    and maybe your bankarea coords is part of the coords outside, post the MOVE_BANK coords u have, is the bot picking the same tile over and over or is it randomized?

    It's randomized, both are areas so I'm not selecting a specific tile (Hence the getRandomTile method) 

    Link to comment
    Share on other sites

    13 hours ago, una_maquina said:

    In the second bug, could it be something with localPlayer variable? It should be defined like this getLocalPlayer(). Maybe you defined another entity or something

    Yes, in onStart I set it to getLocalPlayer. Just checked my code to be sure

    Link to comment
    Share on other sites

    6 minutes ago, crazykid080 said:

    Yes, in onStart I set it to getLocalPlayer. Just checked my code to be sure

    I see, then the only explanation is that you defined your bank area out of bounds or something, so it keeps trynna walk there, but it can't.

    Try redefining the bank area. Go to https://explv.github.io/ and there make the area.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.