Jump to content
Sign in to follow this  
TheGengar

Method of determining where the player is when position is not always the same?

Recommended Posts

Elaborating, I'm making a Temple Trekking script right now and I noticed that the same event (instanced) is in a "different area" (i.e. the position is not the same as it was before by a large margin). I was initially going to make the script understand where the player is by position, but since this won't work, I went with looking for unique objects (as high as like 15 tiles away) to allow the bot to know what event it is on.

Was wondering if there was any other way to go about this issue?

Share this post


Link to post
Share on other sites
13 minutes ago, TheGengar said:

Elaborating, I'm making a Temple Trekking script right now and I noticed that the same event (instanced) is in a "different area" (i.e. the position is not the same as it was before by a large margin). I was initially going to make the script understand where the player is by position, but since this won't work, I went with looking for unique objects (as high as like 15 tiles away) to allow the bot to know what event it is on.

Was wondering if there was any other way to go about this issue?

Are you using dax walker? And if you are, are you sure it is supported? With that being asked, have you tried possibly 

public static RSTile getPosition()

Share this post


Link to post
Share on other sites
4 minutes ago, gosubear said:

Are you using dax walker? And if you are, are you sure it is supported? With that being asked, have you tried possibly 

public static RSTile getPosition()

I may be explaining this incorrectly. Let's use NMZ for example. If you go in NMZ, the tile you're on may be (1000, 2000, 3), but if you leave and go into nmz again it could be (2500, 1700, 3). That's what I mean by different

Share this post


Link to post
Share on other sites

I don't come across this much but I've usually just searched for something that could tell me what I'm doing, usually a unique object nearby as you said - I've done this for construction to ensure I used the same location after re-entering.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Naton said:

I don't come across this much but I've usually just searched for something that could tell me what I'm doing, usually a unique object nearby as you said - I've done this for construction to ensure I used the same location after re-entering.

Yeah this.

This is what people do for other areas like this (pest control)

Share this post


Link to post
Share on other sites

The 'anchor point' method is a bit outdated and unreliable.

The best/easiest way to do this is by using local tiles. Which is simply a relative tile based on the chunk's base tile. See example below:

 

RSTile somePosition = new RSTile(10,40,0, RSTile.TYPE.LOCAL); // You can get this by calling #toLocalTile() on any RSTile while ingame. Like Player.getPosition().getLocalTile().


// grabbing an object
RSObject[] someObjects = Objects.getAt(somePosition.toWorldTile());

 

  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, Laniax said:

The 'anchor point' method is a bit outdated and unreliable.

The best/easiest way to do this is by using local tiles. Which is simply a relative tile based on the chunk's base tile. See example below:

 

RSTile somePosition = new RSTile(10,40,0, RSTile.TYPE.LOCAL); // You can get this by calling #toLocalTile() on any RSTile while ingame. Like Player.getPosition().getLocalTile().


// grabbing an object
RSObject[] someObjects = Objects.getAt(somePosition.toWorldTile());

 

What's the difference between a local tile and a regular tile?

Share this post


Link to post
Share on other sites
5 hours ago, Laniax said:

The 'anchor point' method is a bit outdated and unreliable.

The best/easiest way to do this is by using local tiles. Which is simply a relative tile based on the chunk's base tile. See example below:

 

RSTile somePosition = new RSTile(10,40,0, RSTile.TYPE.LOCAL); // You can get this by calling #toLocalTile() on any RSTile while ingame. Like Player.getPosition().getLocalTile().


// grabbing an object
RSObject[] someObjects = Objects.getAt(somePosition.toWorldTile());

 

This is unreliable for instances that take up more than one map chunk.

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, TheGengar said:

What's the difference between a local tile and a regular tile?

Let me try to explain:

 

For simplicity sake, let's say that the runescape map is a perfect square, ranging from X = 0 and Y= 0 all the way to X = 10000 and Y = 10000. Now the game doesn't load this all at once, but it loads a 'region' of 256x256 tiles at a time around your player. If you run around in game and you get the 'Loading, please wait' screen, it is actually loading a new region.

A 'regular tile' as you called them, is what we call a world tile. It is the absolute position on the 0-10000 scale. So tile X = 5000, Y = 5000 would be at the center of the entire world.

A 'local tile', is a tile relative to the current region. So it might be X = 25, Y = 30. Which means that it is 25 tiles to the right and 30 tiles up from the bottom left corner of the current region, whichever one you are currently on.

Basically when you enter a instanced area like Pest Control, you enter a random region, but all the relative positions stay the same. Now as @Encoded said, this might cause issues if the instanced area is larger than one single region, but if you understand the math it is trivial to work around. (There are methods to get the current regions base tile)

 

If you want to read up on how runescape maps work in general, this is a good resource: https://rswiki.moparisthebest.com/Map-Region-System.html

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Our picks

    • This release will:

      Add support for using custom F key bindings to switch between game tabs (Thanks @erickho123)


      Fix tab opening for "Skills" and "Kourend Tasks" (Thanks @erickho123)



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 30 replies
    • This release will:

      Fix an issue where breaks would stop firing


      Fix Combat#getWildernessLevel, use dynamic search for text and cache ID for later calls


      Fix an NPE in the Combat API


      Fix Mouse#leaveGame bug where the mouse wouldn't actually leave the game screen
      • 21 replies
    • This release will:

      Add LG support for Runelite


      Fix NPCChat issues


      Fix a bug where the camera angle setter would just hold down a key for 5 seconds (the timeout)


      Slightly adjust the rotation via keys to be more accurate


      Add the ability for asynchronous camera movement via keys


      Make Camera rotation via mouse more fluid, with more antiban, and work much better in resizable mode


      Add a "Camera#setCamera" method, allowing the rotation and angle to be set in parallel


      Increase the likelihood of using the mouse for camera movements


      Add support for adjusting the camera to positionable entities (Positionable#adjustCameraTo)



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 59 replies
    • This update will:

      Allow for clicking through the chat box when possible (Thanks @Todd)


      Fix Combat#selectIndex (Thanks @Encoded)


      Ensure worlds stay sorted and added a check to avoid misclicks in the in-game world hopper (Thanks @erickho123)


      Fix out-dated Options API interface indices (Thanks @Todd)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 12 replies
    • This release will:

      Fix login bot after today's game update (Thanks @JoeDezzy1)


      Fix latest in-game world hopping issues (Thanks @erickho123)


      Compact Settings UI and set location relative to TRiBot (Thanks @JoeDezzy1)


      Fix an older implementation of GrandExchange#getWindowState (Thanks @JoeDezzy1)


      Improve the preformance of NPCChat by only searching in certain interface parents (Thanks @JoeDezzy1)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      LG support for RuneLite


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 16 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×