Discussion in 'Developer Support' started by Exile, Aug 25, 2014.

  1. I'm stuck on this for already a week or 2 now, I've tried RegionPath, WebPath, BresenhamPath, PredefinedPath, everything.

    What happens is the following: the path is correctly generated, but the bot only clicks once on the minimap and when my player has reached that position, it doesn't move to the next position, it just sits there somewhere halfway the path.

    I use this code:
    Code (Text):
    2. Coordinate coord = new Coordinate(3189, 3241, 0); //A point somewhere in Lumbridge that I used for testing purposes
    3. final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(coord);
    4. path.step();
    The same happens when I replace the WebPath line by RegionPath.buildTo(coord);, or by BresenhamPath, or when I use a PredefinedPath.

    Do I need to add a loop somewhere?
  2. maybe make an area (if there is one) and then while(!area.contains(Players.getLocal().getPosition()))

  3. I'll try looping it, thanks
  4. Path.step takes a single step. So I guess you need another method.
  5. Well that explains alot :p

    I tried putting it in a loop and this seems to have worked :) Might want to include that in those walking tutorials
  6. I'm not sure.. i just looked at the docs. I've not yet experimented with the api just yet.
  7. Great :)
  8. If you're using a looping script bot it shouldnt need an extra loop.

    If you're using the Execution framework or whatever it's called, you've probably set the conditions in a way that it only calls it once and because it never reached the end just sits there. You'll want to fix that because it's best to not use extra loops if they're not needed.
    #8 Aidden, Aug 25, 2014
    Last edited: Aug 25, 2014
  9. But, it would need to check every Activate or whatever its called (boolean) to run this method again. So waste of RAM imo
  10. It's better practice to have each loop only perform one action rather than contain a nested loop performing actions over and over until the end condition, so it's best to sterr clear of extra loops where they're not absolutely necessary. It's also the best way to make the script bot stop as soon as the stop button is clicked as we don't force scripts bots to stop.
  11. I'm using Executor + my own framework :p but it's pretty complicated, anyways it's fixed :)
  12. This is spot on.

Share This Page