{6} Positions, areas and moving the player
The RuneScape world is split into tiles, each tile has an (x, y, z) coordinate associated with it:
To get the (x, y, z) coordinate of a tile, or create a path or area you have a few options:
In the OSBot API (x, y, z) coordinates are represented with the Position class.
You can create a new Position like so:
You can retrieve the Position of the Player by calling the myPosition() method in the MethodProvider class:
All Entities such as NPCs, Players, RS2Objects, GroundItems have a method to get their position called getPosition():
An Area is a polygon consisting of one or more Positions.
You can create an Area in a few different ways:
Areas are typically used to determine if an entity is in a certain location in the RuneScape world or for walking to a certain location.
For example, to determine if your player is in the Varrock West bank you would write:
To move your player to an Area or Position, you can use the Walking class. To access the Walking instance you use the getWaking() method in the MethodProvider class.
There are three main methods of walking in the Walking class, either walking to a nearby position with the same z coordinate as the player's position using the walk method, note that the destination must be close to your Player otherwise it will not be able to find a path:
Walking along a fixed path (all positions must have the same z coordinate as the player's current position):
Or for long distances, where the destination tile is not visible to the player, and creating a fixed path would be inappropriate, you can use web walking:
When using web walking, common obstacles such as staircases and gates will be handled for you, which also means you can web walk to positions with different z coordinates to the player's current position.
Due to the nature of web walking, in some less commonly traveled locations in the RuneScape world, the web walker may not be able to find a path to your destination, when this occurs, you can use a different walking method to a location where you can web walk from, and also request that web walking links be added: https://osbot.org/forum/forum/335-web-walking-links/