GenericMeme46 13 Author Share Posted August 24, 2019 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 More sharing options...
GenericMeme46 13 Author Share Posted August 24, 2019 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 More sharing options...
GenericMeme46 13 Author Share Posted August 25, 2019 Credits for help to @Cystic Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.