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
  • Why does this not work?


    GenericMeme46

    Recommended Posts

    if (oofer == false) {
        log("HERE WE GO");
        Tile startingTile = getLocalPlayer().getTile();
        Tile tile1 = new Tile(startingTile.getX() - 2, startingTile.getY() - 2);
        Tile tile2 = new Tile(startingTile.getX() - 2, startingTile.getY() + 2);
        log("TILE1: " + tile1 + " | PLAYER TILE: " + getLocalPlayer().getTile());
        getMouse().move(tile1);
        sleep(5);
        getMouse().move(tile1);
        sleep(20);
        getMouse().click();
        getMouse().click();
        //Run it twice to guarantee no misclicks
        scriptBT = System.currentTimeMillis();
        oofer = true;
    }
    //sleepUntil(() -> getLocalPlayer().getTile() == tile1, 5000);
    if (getLocalPlayer().getTile() == tile1) {
        log("TIME IT TOOK REEEE - " + (scriptBT));
    }
    Link to comment
    Share on other sites

    It never hits true for this part even though the tile1 and player tile absolutely line up with the same values.

    if (getLocalPlayer().getTile() == tile1) {
        log("TIME IT TOOK REEEE - " + (scriptBT));
    }
    Link to comment
    Share on other sites

    If I were to assume the error here:

     

    in java when comparing objects you do not compare the values. You compare the object itself(so or the 2 objects refer to the same place in the ram memory)

    You are creating a new Tile yourself. this will never refer to the same Tile as the one used in the game context. because you don't compare the x/y values but rather the memory locations.

     

    You can either follow my advice in the chat box.

    Implement a .equals() method to use. 

    or compare the primitive types within the object in the if statement(thus compare the integers associated with the x/y/z levels.)

     

    Link to comment
    Share on other sites

    16 minutes ago, Empyrean GB said:

    If I were to assume the error here:

     

    in java when comparing objects you do not compare the values. You compare the object itself(so or the 2 objects refer to the same place in the ram memory)

    You are creating a new Tile yourself. this will never refer to the same Tile as the one used in the game context. because you don't compare the x/y values but rather the memory locations.

     

    You can either follow my advice in the chat box.

    Implement a .equals() method to use. 

    or compare the primitive types within the object in the if statement(thus compare the integers associated with the x/y/z levels.)

     

    if (getLocalPlayer().getTile().equals(tile1)) {
        log("TIME IT TOOK REEEE - " + (scriptBT));
    }

    Does not work either.

    Link to comment
    Share on other sites

    What does changing it to:

    log("Current distance to thile1 " + this.getLocalPlayer().getTile().distance(tile1));
    
    if(this.getLocalPlayer().getTile().distance(tile1) <= 1){
    	log("TIME IT TOOK REEEE - " + (scriptBT));
    }

    do?

    Link to comment
    Share on other sites

    What if you just try to make it

    if(tile1.distance(getLocalPlayer()) < 1){
    	log("TIME IT TOOK REEEE - " + (scriptBT));
    }

    Playing Leauge right now so it may be scuffed

    Link to comment
    Share on other sites

    50 minutes ago, Empyrean GB said:

    What does changing it to:

    
    log("Current distance to thile1 " + this.getLocalPlayer().getTile().distance(tile1));
    
    if(this.getLocalPlayer().getTile().distance(tile1) <= 1){
    	log("TIME IT TOOK REEEE - " + (scriptBT));
    }

    do?

    This does not work either.

    77bc52a80ebc91f40ff3116a5691b9b5.png

     

    if (this.getLocalPlayer().getTile().distance(tile1) < 1) {
        log("Time - " + (System.currentTimeMillis() - scriptBT + " | Tile " + getLocalPlayer().getTile()));
    }
    Link to comment
    Share on other sites

    16 minutes ago, GenericMeme46 said:

    This does not work either.

    77bc52a80ebc91f40ff3116a5691b9b5.png

     

    It's not matching your tile1 to your player tile in that example. I don't know exactly what you're trying to do but that's the reason it wouldn't run, you're telling it to run if the tiles are the same but they aren't

     

    If you're trying to walk onto a tile and have something happen use something like this.

    if (oofer == false) {
        log("HERE WE GO");
        Tile startingTile = getLocalPlayer().getTile();
        Tile tile1 = new Tile(startingTile.getX() - 2, startingTile.getY() - 2);
    
      	if(getLocalPlayer().getTile() != tile1) {
                getWalking().walkExact(tile1);
            }
      
        //Run it twice to guarantee no misclicks
        scriptBT = System.currentTimeMillis();
        oofer = true;
    }
    //sleepUntil(() -> getLocalPlayer().getTile() == tile1, 5000);
    if (getLocalPlayer().getTile() == tile1) {
        log("TIME IT TOOK REEEE - " + (scriptBT));
    }

     

    Link to comment
    Share on other sites

    1 hour ago, GenericMeme46 said:

    3fa268b9ac988e9cfd71ad8a389859d1.png

    Interesting negative values in the Current distance tile.

     

    Okay, if you change your 

    Tile tile1 = new Tile(startingTile.getX() - 2, startingTile.getY() - 2);

    to be -5 on both rather then -2.

     

    Does it start printing -5, then -4, etc.

     

    if so change the if statement to:

    log("distance to target: " + this.getLocalPlayer().getTile().distance(tile1));
    
    if(Math.abs(this.getLocalPlayer().getTile().distance(tile1)) <= 1){
    	log("TIME IT TOOK REEEE - " + (scriptBT));
    }

     

    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.