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
  • Try asking for help in the chatbox
  • Not walking to set area


    thiccbooty123
     Share

    Recommended Posts

    Hi, so my script seems to run well (that is interacting with npcs and such), however, it is unable to walk to area i have set in my script.

     

    This is what my code looks like:

    public static final Area Barbvillage = new Area(3078, 3423,  3085,  3417);

     

    public static final Area Edgeville = new Area(3091, 3497, 3094, 3488);

     

    if (Edgeville.contains(getLocalPlayer()) && getInventory().isEmpty()) {
        getWalking().walk(Barbvillage.getCenter());
        checkRunEnergy();
        sleepUntil(() -> Barbvillage.contains(getLocalPlayer()), 30000);

     

    https://streamable.com/ka8f9l

    Link to comment
    Share on other sites

    Well you're saying that if your player is in Edgeville, walk to somewhere but if your character isn't in Edgeville and isn't in barb village, then do nothing, once your character is no longer in edgeville, that line is no longer being looped

    Edited by wettofu
    Link to comment
    Share on other sites

    1 hour ago, wettofu said:

    Well you're saying that if your player is in Edgeville, walk to somewhere but if your character isn't in Edgeville and isn't in barb village, then do nothing, once your character is no longer in edgeville, that line is no longer being looped

    Though the code should make it walk to barb village (my specified area) from edgeville if i have an empty invo. I think i might be missing a webwalker, if there is no built in web walker on the client. Im not too sure how to add one

    Link to comment
    Share on other sites

    Quote
    if (Edgeville.contains(getLocalPlayer()) && getInventory().isEmpty()) {
        getWalking().walk(Barbvillage.getCenter());
        checkRunEnergy();
        sleepUntil(() -> Barbvillage.contains(getLocalPlayer()), 30000);

    This code isn't right. The way you currently have the code, it will only walk to barbarian village if edgeville contains the player. Which makes no sense (obviously)

    You should change this to:

    if (!Barbvillage.contains(getLocalPlayer()) && getInventory().isEmpty()) {
        getWalking().walk(Barbvillage.getCenter());
        sleepUntil(() -> !getlocalplayer()).isMoving, Calculations.Random(2000,2500);

    The above ^ reads: if barbarian village does not contain the player and inventory is empty, walk to barbarian village.

    The sleepUntil you had before, will just walk once every 30 seconds until the player reaches destination. This is a much better use of sleepUntil ^^

    Edited by AsBakedAsCake
    Link to comment
    Share on other sites

    4 minutes ago, AsBakedAsCake said:

    This code isn't right. The way you currently have the code, it will only walk to barbarian village if edgeville contains the player. Which makes no sense (obviously)

    You should change this to:

    if (!Barbvillage.contains(getLocalPlayer()) && getInventory().isEmpty()) {
        getWalking().walk(Barbvillage.getCenter());
        sleepUntil(() -> !getlocalplayer()).isMoving, Calculations.Random(2000,2500);

     

    image.png.b97294c2e84c2650d696a0c90fc5a635.png

    Link to comment
    Share on other sites

    5 minutes ago, AsBakedAsCake said:

    sleepUntil(() -> !getLocalPlayer().isMoving(), Calculations.random(2000,2500);

    Ah yes, i see. Basically if the destination error does not have my player there, and if my inventory is empty it should walk there.

    Rather than my code suggesting that i should remain within edgeville but walk to barb village and hence the bot gets stuck because my code wants it to stay within edgeville but be at barb village, right?

    Link to comment
    Share on other sites

    29 minutes ago, thiccbooty123 said:

    Ah yes, i see. Basically if the destination error does not have my player there, and if my inventory is empty it should walk there.

    Rather than my code suggesting that i should remain within edgeville but walk to barb village and hence the bot gets stuck because my code wants it to stay within edgeville but be at barb village, right?

    Exactly. The way you originally had the code, you would only be walking to barbarian area if your edgeville area contained the player. (Which is impossible, hence the getting stuck)

    You'll get better with the logic as you improve with scripting :)

    Link to comment
    Share on other sites

    8 hours ago, AsBakedAsCake said:

    Exactly. The way you originally had the code, you would only be walking to barbarian area if your edgeville area contained the player. (Which is impossible, hence the getting stuck)

    You'll get better with the logic as you improve with scripting :)

    Gotcha, thank you so much for the help <3

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

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