thiccbooty123 0 Posted May 26, 2020 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
wettofu 109 Posted May 26, 2020 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
thiccbooty123 0 Author Posted May 26, 2020 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
AsBakedAsCake 203 Posted May 26, 2020 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 ^^
thiccbooty123 0 Author Posted May 26, 2020 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);
AsBakedAsCake 203 Posted May 26, 2020 3 minutes ago, thiccbooty123 said: sleepUntil(() -> !getLocalPlayer().isMoving(), Calculations.random(2000,2500);
thiccbooty123 0 Author Posted May 26, 2020 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?
AsBakedAsCake 203 Posted May 26, 2020 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
thiccbooty123 0 Author Posted May 26, 2020 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.