KlaAz0r Posted August 22, 2015 Posted August 22, 2015 So I got banking working, fighting and other things, but I come across a problem, walking to stairs and then going up them. localWalker.walkPath(fromBankToStairs); Player player = myPlayer(); int x = player.getPosition().getX(); int y = player.getPosition().getY(); if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) { log("x : " + x + " y : " + y); log("we are at the stairs!"); objects.closest("Staircase").interact("Climb-down"); int z = player.getPosition().getZ(); if (z == 1) { objects.closest("Staircase").interact("Climb-down"); } } else { log("we are lost again.."); } What I did is walk to the stairs and if the player is near the stairs it should go down, but this does not working, does localWalker have a callback to see if the path is fully walked and then continue the script?
Bobrocket Posted August 22, 2015 Posted August 22, 2015 So I got banking working, fighting and other things, but I come across a problem, walking to stairs and then going up them. localWalker.walkPath(fromBankToStairs); Player player = myPlayer(); int x = player.getPosition().getX(); int y = player.getPosition().getY(); if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) { log("x : " + x + " y : " + y); log("we are at the stairs!"); objects.closest("Staircase").interact("Climb-down"); int z = player.getPosition().getZ(); if (z == 1) { objects.closest("Staircase").interact("Climb-down"); } } else { log("we are lost again.."); } What I did is walk to the stairs and if the player is near the stairs it should go down, but this does not working, does localWalker have a callback to see if the path is fully walked and then continue the script? if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) { Use area pls + getLocalWalker().waitUntilidle() is your best bet for the walking.
KlaAz0r Posted August 23, 2015 Author Posted August 23, 2015 (edited) if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) { Use area pls + getLocalWalker().waitUntilidle() is your best bet for the walking. Fixed the areas, but still seem to have a problem with walking, I get the bot to start walking when it is at the bank with an empty inventory but once it is at the stairs it stops localWalker.walkPath(fromBankToStairs); localWalker.waitUntilIdle(); Player player = myPlayer(); log(localWalker.toString()); if (UPPER_STAIRCASE_AREA.contains(myPlayer())) { log("we are at the stairs!"); objects.closest("Staircase").interact("Climb-down"); int z = player.getPosition().getZ(); if (z == 1) { objects.closest("Staircase").interact("Climb-down"); } } else { log("we are lost again.."); } Edited August 23, 2015 by KlaAz0r
FrostBug Posted August 23, 2015 Posted August 23, 2015 Fixed the areas, but still seem to have a problem with walking, I get the bot to start walking when it is at the bank with an empty inventory but once it is at the stairs it stops localWalker.walkPath(fromBankToStairs); localWalker.waitUntilIdle(); Player player = myPlayer(); log(localWalker.toString()); if (UPPER_STAIRCASE_AREA.contains(myPlayer())) { log("we are at the stairs!"); objects.closest("Staircase").interact("Climb-down"); int z = player.getPosition().getZ(); if (z == 1) { objects.closest("Staircase").interact("Climb-down"); } } else { log("we are lost again.."); } try changing if (UPPER_STAIRCASE_AREA.contains(myPlayer())) { to if (UPPER_STAIRCASE_AREA.contains(myPosition().getX(), myPosition().getY())) { This ignores whatever Z value the area might have (probably 0)
KlaAz0r Posted August 23, 2015 Author Posted August 23, 2015 try changing to This ignores whatever Z value the area might have (probably 0) figured that out, what I did was: if (BANK_AREA.contains(myPlayer().getPosition().getX(), myPlayer() .getPosition().getY(), 0) && inventory.isEmpty()) return State.WALKING_TO_UPPER_STAIRS; if (myPlayer().getPosition().getZ() == 1 && inventory.isEmpty()) return State.GOING_DOWN_STAIRS;