1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Walking

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

  1. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    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):
    1.  
    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();
    5.  
    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. Qosmiof2

    Qosmiof2 I've been called a god before.

    Joined:
    Aug 5, 2014
    Messages:
    3,212
    Likes Received:
    924
    maybe make an area (if there is one) and then while(!area.contains(Players.getLocal().getPosition()))

    cheers
     
  3. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    I'll try looping it, thanks
     
  4. Mmaaikel

    Joined:
    Mar 11, 2014
    Messages:
    448
    Likes Received:
    106
    Path.step takes a single step. So I guess you need another method.
     
  5. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    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. Mmaaikel

    Joined:
    Mar 11, 2014
    Messages:
    448
    Likes Received:
    106
    I'm not sure.. i just looked at the docs. I've not yet experimented with the api just yet.
     
  7. Qosmiof2

    Qosmiof2 I've been called a god before.

    Joined:
    Aug 5, 2014
    Messages:
    3,212
    Likes Received:
    924
    Great :)
     
  8. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    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. Qosmiof2

    Qosmiof2 I've been called a god before.

    Joined:
    Aug 5, 2014
    Messages:
    3,212
    Likes Received:
    924
    But, it would need to check every Activate or whatever its called (boolean) to run this method again. So waste of RAM imo
     
  10. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    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. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    I'm using Executor + my own framework :p but it's pretty complicated, anyways it's fixed :)
     
  12. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    This is spot on.
     

Share This Page

Loading...