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

    20 minutes ago, Cystic said:

    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));
    }

     

    I'm trying to detect if osrs marks the player as being on the tile before it lines up visually. The if statement at the bottom never returns true despite the cords matching up perfectly.

     

    17 minutes ago, Empyrean GB said:

    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));
    }

     

    This does not work. The distance to target is always -1.0

    Link to comment
    Share on other sites

    It's fixed now. I have no clue at all what the solution was, I re-attempted a proposed solution earlier in the thread and this time it miraculously works. I did not edit the script and I do not know what caused it to work this time.

    if (getLocalPlayer().getTile().equals(tile1)) {
        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.