Jump to content

Get Clipping Flags from Position


zasz

Recommended Posts

getMap().getRegion().getClippingPlanes()[POSITION.getZ()].getTileFlags()[POSITION.getLocalX(getBot())][POSITION.getLocalY(getBot())]

PS: Flags can only be accessed for the loaded region which is 104x104, throws indexoutofboundsexception otherwise as the localx/localy will not be from 0 to 103. Check that the positions localx and localy are within bounds.

Edited by Token
  • Like 2
Link to comment
Share on other sites

13 hours ago, Token said:

getMap().getRegion().getClippingPlanes()[POSITION.getZ()].getTileFlags()[POSITION.getLocalX(getBot())][POSITION.getLocalY(getBot())]

PS: Flags can only be accessed for the loaded region which is 104x104, throws indexoutofboundsexception otherwise as the localx/localy will not be from 0 to 103. Check that the positions localx and localy are within bounds.

Oops, I meant legitimate flags as if the position is an entity that gets its surrounding flags. 

Edited by Token
Link to comment
Share on other sites

53 minutes ago, zasz said:

Oops, I meant legitimate flags as if the position is an entity that gets its surrounding flags. 

I’ve edited your post to conform with the forum rules (discussing other communities is not allowed). Those are the flags for a position, if something is on the position, they will have values to indicate that. What exactly are you looking for?

Edited by Token
Link to comment
Share on other sites

18 minutes ago, Token said:

I’ve edited your post to conform with the forum rules (discussing other communities is not allowed). Those are the flags for a position, if something is on the position, they will have values to indicate that. What exactly are you looking for?

 

I figured when I noticed the stars, I thought since it wasn't advertising nor endorsing it would still be alright.

But exactly that, getting all for the client given a given position, regardless of my players flags. I thought it was clear enough of the intention in my first sentence on original, I do apologize the intention isn't coming across though.

 

Edit:

Example

	NPC fred = npcs.closest("Fred the Farmer");
	fredFlags = npcs.closest("Fred the Farmer").getPosition().FLAGS();
	

Edited by zasz
Link to comment
Share on other sites

4 minutes ago, zasz said:

 

I figured when I noticed the stars, I thought since it wasn't advertising nor endorsing it would still be alright.

But exactly that, getting all for the client given a given position, regardless of my players flags. I thought it was clear enough of the intention in my first sentence on original, I do apologize the intention isn't coming across though.

Entities do not have flags (including players), only positions have flags. You may be familiar with an API where it was presented wrong, but every position has corresponding flags that describe access to that certain position, eg. it cannot be walked from south, south east, north, it is completely blocked, blocked only from south etc. These are all coded in the bits of that number (the position/tile flag). Mentioning what you are trying to do with this would probably be better as you may not need these at all.

Link to comment
Share on other sites

I probably am wanting one thing thinking its associated with another, why I linked the other community hoping to get the intention.

Basically, building little more than a basic walking system,  I know localPathFinder has the from/to list as a API style to figure walkable for availability. But getting all tiles from a position on the map can let go relatively in depth for layers of doors/obstacles for a few check iterations.

For instance from above, if I am in freds house, it has a gate to get to the door for the house. i can  be in the house, get a Position pCoord[2] for right outside the fence, check for an objects starting closest to Player that pCoord[2] can reach, then do the Position opposite to gate, check if player can reach, if not do another check for the new Position for another object.

And have a iteration cutoff of course

So can dynamically walk out of any house and traverse through varrock castle if wanted with a single method parsing a Position[]

 

Otherwise I would be forced with a less accurate 

	    if(!map.canReach(t))
    if((canReach(t,obs.getPosition()) || obs.getPosition().distance(t)<4 || forceSteps) && map.canReach(obs))
	

Which would interact with all obstacles that can be reached hoping it would be the one to lead to the point on the map.

Edited by zasz
Link to comment
Share on other sites

31 minutes ago, zasz said:

I probably am wanting one thing thinking its associated with another, why I linked the other community hoping to get the intention.

Basically, building little more than a basic walking system,  I know localPathFinder has the from/to list as a API style to figure walkable for availability. But getting all tiles from a position on the map can let go relatively in depth for layers of doors/obstacles for a few check iterations.

For instance from above, if I am in freds house, it has a gate to get to the door for the house. i can  be in the house, get a Position pCoord[2] for right outside the fence, check for an objects starting closest to Player that pCoord[2] can reach, then do the Position opposite to gate, check if player can reach, if not do another check for the new Position for another object.

And have a iteration cutoff of course

So can dynamically walk out of any house and traverse through varrock castle if wanted with a single method parsing a Position[]

 

Otherwise I would be forced with a less accurate 


	    if(!map.canReach(t))
    if((canReach(t,obs.getPosition()) || obs.getPosition().distance(t)<4 || forceSteps) && map.canReach(obs))
	

Which would interact with all obstacles that can be reached hoping it would be the one to lead to the point on the map.

So what you describe is constructing a path by chaining paths between obstacles, this can easily be achieved with the LocalPathWalker. There are many implementations available for findPath, some of them are like this

LocalPathFinder lpf = new LocalPathFinder(getBot());
lpf.findPath(entity); // path from player's position to an entity
lpf.findPath(startPosition, endPosition); // path between 2 positions
lpf.findPath(endPosition); // path from player's position to a position
lpf.findPath(startPosition, entity); // path from a position to an entity

You you will probably need the last one. Start with player position and build a path to the destination position, if none is found, iterate through all entities that can be reached and determine whether the position past that entity (use rotation/orientation do determine the position after the entity) can get you closer to the destination. If it still doesn't reach the destination, iterate through all entites that can be reached from the position after the first entity and do the steps above for n iterations. Then simply add up all the paths to create the main path (include the entities that have to be interacted with on the way).

There is no need for flags for the above as there are many high level methods already provided in the API that wrap everything needed, but the main problem you will encounter here is that the game only loads in 104x104 blocks, meaning that you can't dynamically access information about entities or flags outside the loaded region without having all this preprocessed and cached. You can do this around fred's house to open gates/doors, but varrock is not loaded and you can't find doors around the castle for example.

 

I strongly suggest you take a look at webwalking, it may save you a lot of time by just calling 

getWalking().webWalk(destination);

Which will automatically walk anywhere on the map, handle all obstacles (not just doors and gates). This can also walk between planes, use teleports, enchanted jewelry, spirit trees, gnome gliders, ships and pretty much everything available in runescape. OSBot's webwalker has been continuously developed for the last 4 years and provided support for advanced scripts like questing, slayer, automated farms and many more. It already has information about obstacle requirements everywhere on the map, including things like passing through the Al Kharid gate depending on whether the user has coins in inventory or the quest completed to pass for free, and would take the longer path otherwise.

PS: See WebWalkEvent in the API docs for advanced usage and configuring options like teleports

Link to comment
Share on other sites

10 minutes ago, Token said:

So what you describe is constructing a path by chaining paths between obstacles, this can easily be achieved with the LocalPathWalker. There are many implementations available for findPath, some of them are like this


LocalPathFinder lpf = new LocalPathFinder(getBot());
lpf.findPath(entity); // path from player's position to an entity
lpf.findPath(startPosition, endPosition); // path between 2 positions
lpf.findPath(endPosition); // path from player's position to a position
lpf.findPath(startPosition, entity); // path from a position to an entity

You you will probably need the last one. Start with player position and build a path to the destination position, if none is found, iterate through all entities that can be reached and determine whether the position past that entity (use rotation/orientation do determine the position after the entity) can get you closer to the destination. If it still doesn't reach the destination, iterate through all entites that can be reached from the position after the first entity and do the steps above for n iterations. Then simply add up all the paths to create the main path (include the entities that have to be interacted with on the way).

There is no need for flags for the above as there are many high level methods already provided in the API that wrap everything needed, but the main problem you will encounter here is that the game only loads in 104x104 blocks, meaning that you can't dynamically access information about entities or flags outside the loaded region without having all this preprocessed and cached. You can do this around fred's house to open gates/doors, but varrock is not loaded and you can't find doors around the castle for example.

 

I strongly suggest you take a look at webwalking, it may save you a lot of time by just calling 


getWalking().webWalk(destination);

Which will automatically walk anywhere on the map, handle all obstacles (not just doors and gates). This can also walk between planes, use teleports, enchanted jewelry, spirit trees, gnome gliders, ships and pretty much everything available in runescape. OSBot's webwalker has been continuously developed for the last 4 years and provided support for advanced scripts like questing, slayer, automated farms and many more. It already has information about obstacle requirements everywhere on the map, including things like passing through the Al Kharid gate depending on whether the user has coins in inventory or the quest completed to pass for free, and would take the longer path otherwise.

PS: See WebWalkEvent in the API docs for advanced usage and configuring options like teleports

I appreciate the informational reply. When I was testing Webwalking it didn't handle a door properly but I could'v done something wrong. I'll look back at taking a crack at using it tomorrow in my next session. Again thank you for the effort at getting me information

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...