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
  • Can someone explain Walking, PathFinding, Obstacles, Collisions, etc?


    dlinkb
     Share

    Recommended Posts

    Feel free to touch on some or all of the questions I have about this subject. I'm trying to get into Runescape scripting, and a lot of the API is either clearly documented or self-explanatory, but I'm also new to learning APIs, so I'm having a hard time understanding all this stuff about walking, and collisions.

     

     

    Here are some questions I have:

    1) pathfinder.isReachable(tile) is deprecated. What should I be using instead?

    a) If I want to see if there's a closed door/other obstacle between me and a tile, should I be doing getWalking().getPathFinder().calculatePath(tile).needToGoThroughObstacle(getPlayers().myPlayer().getTile(), tile)?

    The specific case I'm thinking about is if I have a node-based smelting script, and I have a Smelting node and Walking node and am outside the Al-Kharid furnace, how do I know if I should be smelting or walking (to open the door).

    (Figured this one out while exploring the API to figure out what exactly to ask. I assume I should be using getMap().canReach(tile)

    New question: How would I check if a furnace is reachable? The tile of the furnace itself wouldn't be reachable (a furnace is on it!). Is there a easy way to do that without using tile flags to find a neighboring tile that can be walked on that's still inside the furnace room?

     

    2) How do I use and what does pathfinder.isBlocked(flag), pathfinder.isCardinalDirectionBlock, and isOrdidinalDirectionBlocked do?

    a. For the last two, how/when do I pick/use a specific tileflag?

    b. What do the parameters for those methods mean exactly?

    c) How do I even get the tileflag of a specific tile? (Use map.getTileReference(tile).getFlags() ?)

     

    d. Tileflags seem to be flags used w/ bitwise operations, so could a tile "be" multiple TileFlag types?

     

    3) The TileReference class has methods that return a BoundaryObject, FloorDecoration, ItemLayer, and WallObject.

    a. Are WallObjects just objects mounted on walls (like a mounter amulet of glory)?

    b. What exactly are those other things? 

    c. Can a Tile have all of these?

     

    4) What's the difference between map.isInRegion and map.isLocal?

     

    5) What is a CollisionMap, what are they used for, and when would I use one?

     

    6) How would I go about "adding" in my own custom obstacles? (Like what would I do if I wanted to go about creating a Puro-puro script or a Motherlode mine script?)

     

    Those are all the questions I have so far. Thanks for looking at them or answering them.

     

    Sorry if this seemed like you were taking a test. (P.S. you should make scripters pass this test if they want to apply for a rank kapaa)

    Edited by dlinkb
    Link to comment
    Share on other sites

    Feel free to touch on some or all of the questions I have about this subject. I'm trying to get into Runescape scripting, and a lot of the API is either clearly documented or self-explanatory, but I'm also new to learning APIs, so I'm having a hard time understanding all this stuff about walking, and collisions.

     

     

    1) If you use canReach, it will be able to help you determine if the door is shut, since it will return false if any sort of obstacle is blocking your path.

     

     

    2) This is used along with the Collision Map (TileFlag map) for the base of our path finding system.

    a.You can get the tile flag using getMap().getFlags(Tile tile);

     

    b. What do the parameters for those methods mean exactly?

    Well Cardinal Direction is N, E, S, W, while Ordinal is NE, SE, SW, NW

    And the method takes pretty much a (Direction (TileFlag), Current Tile Flag, Neighbor Tile Flag)

     

    c) Yes

     

    d. Yes

     

    3) The TileReference class has methods that return a BoundaryObject, FloorDecoration, ItemLayer, and WallObject.

    a. Yes

    b. Like Walls/Doors(Boundaries), Plants(Floor Decoration), and Ground Items (Item Layer);

    c. Tile is a basic wrapper, while TileReference has a MethodContext instance allowing it more methods.

     

    4) map.isInRegion will be depreciated next update, and will be replaced by isLocal! :)

     

    5) The collision map of RS is made of Tile Flags, like as explained above.

     

    6) Actually this will be included in the next update, I overlooked it, though when we push the next update you will be able to add obstacles using their actions.

    You will be able to do this using:

    @org.dreambot.api.methods.map.Map.addObstacleActions(String... actions)

    After you have added the actions needed they will be loaded inside of @org.dreambot.api.methods.map.Map.getObstacleLocations() (Which will also be loaded in the local pathfinder as well).

     

    I hope this helps a little bit! :)

    Link to comment
    Share on other sites

    Thanks so much =D . I've been wanting to start scripting for the past week, but every time I looked at the javadocs, a lot of this made it really daunting. 

     

    Just a follow up question:

    Will there be a way to specify the cost of an action? (eg at Motherlode mine, increasing the cost of mining through a rock vein: should I mine somewhere that's a bit further away or at a vein closer-by but I'll have to mine through a fallen rock?)

    Link to comment
    Share on other sites

    Thanks so much =D . I've been wanting to start scripting for the past week, but every time I looked at the javadocs, a lot of this made it really daunting. 

     

    Just a follow up question:

    Will there be a way to specify the cost of an action? (eg at Motherlode mine, increasing the cost of mining through a rock vein: should I mine somewhere that's a bit further away or at a vein closer-by but I'll have to mine through a fallen rock?)

    Yes, write your own algorithm.
    Link to comment
    Share on other sites

    Thanks so much =D . I've been wanting to start scripting for the past week, but every time I looked at the javadocs, a lot of this made it really daunting. 

     

    Just a follow up question:

    Will there be a way to specify the cost of an action? (eg at Motherlode mine, increasing the cost of mining through a rock vein: should I mine somewhere that's a bit further away or at a vein closer-by but I'll have to mine through a fallen rock?)

     

    It' not handled automatically yet, though say if you do make a path, it will include the the obstacle into the path as needed! Though like Swizz said above, you could write a simple algorithm, which using distances as a cost values to determines which would be the best option! :)

    Link to comment
    Share on other sites

     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.