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
  • Not walking to set area


    thiccbooty123

    Recommended Posts

    Posted

    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

    Posted

    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

    Posted
    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

    Posted
    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 ^^

    Posted
    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

    Posted
    3 minutes ago, thiccbooty123 said:

    image.png.b97294c2e84c2650d696a0c90fc5a635.png

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

    Posted
    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?

    Posted
    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 :)

    Posted
    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

    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.