atoo Posted November 18, 2017 Share Posted November 18, 2017 Not sure if there is anything in the api for it, or someone has posted it in the forums but i couldnt find anything. Reason im looking for some help is because i want my script to stop mining X rock when we cant mine it. Quote Link to comment Share on other sites More sharing options...
Alek Posted November 18, 2017 Share Posted November 18, 2017 https://osbot.org/api/org/osbot/rs07/api/model/Character.html getInteracting() 2 Quote Link to comment Share on other sites More sharing options...
atoo Posted November 18, 2017 Author Share Posted November 18, 2017 (edited) 10 minutes ago, Alek said: https://osbot.org/api/org/osbot/rs07/api/model/Character.html getInteracting() Smh, i was looking at that one yesterday but i didnt know if it would apply to rocks lol. edit- wait will this even work for rocks? Gets the character that this character is currently facing/interacting. Edited November 18, 2017 by atoo Quote Link to comment Share on other sites More sharing options...
Viston Posted November 18, 2017 Share Posted November 18, 2017 (edited) 10 minutes ago, Alek said: https://osbot.org/api/org/osbot/rs07/api/model/Character.html getInteracting() Retired, yet still helpful & helps out scripters Much love man Edited November 18, 2017 by Viston Quote Link to comment Share on other sites More sharing options...
Chris Posted November 18, 2017 Share Posted November 18, 2017 16 minutes ago, atoo said: Smh, i was looking at that one yesterday but i didnt know if it would apply to rocks lol. edit- wait will this even work for rocks? Gets the character that this character is currently facing/interacting. 3 public abstract class Character<C extends XCharacter<?>> extends Animable<C> implements Entity Entity All Known Implementing Classes: Character, GroundDecoration, GroundItem, InteractableObject, NPC, Player, WallDecoration, WallObject public interface Entity extends Identifiable, Interactable, Vector3D Represents an in-game model. do you even java docs bro Quote Link to comment Share on other sites More sharing options...
atoo Posted November 18, 2017 Author Share Posted November 18, 2017 Just now, Chris said: public abstract class Character<C extends XCharacter<?>> extends Animable<C> implements Entity Entity All Known Implementing Classes: Character, GroundDecoration, GroundItem, InteractableObject, NPC, Player, WallDecoration, WallObject public interface Entity extends Identifiable, Interactable, Vector3D Represents an in-game model. do you even java docs bro Didnt read the full page Quote Link to comment Share on other sites More sharing options...
Chris Posted November 18, 2017 Share Posted November 18, 2017 Just now, atoo said: Didnt read the full page public class InteractableObject extends Modeled<XInteractableObject> implements RS2Object Quote Link to comment Share on other sites More sharing options...
atoo Posted November 18, 2017 Author Share Posted November 18, 2017 1 minute ago, Chris said: public class InteractableObject extends Modeled<XInteractableObject> implements RS2Object Ye ********u i get it, i was replying to your last comment "do you even java docs bro" Quote Link to comment Share on other sites More sharing options...
Chris Posted November 18, 2017 Share Posted November 18, 2017 13 minutes ago, atoo said: Ye ********u i get it, i was replying to your last comment "do you even java docs bro" chill bro was just helping u. no mames Quote Link to comment Share on other sites More sharing options...
atoo Posted November 18, 2017 Author Share Posted November 18, 2017 4 minutes ago, Chris said: chill bro was just helping u. no mames I am chilled, just write that way hehe, appreciate the help though! Quote Link to comment Share on other sites More sharing options...
atoo Posted November 19, 2017 Author Share Posted November 19, 2017 Just a quick update: Seems like getInteracting is broken because it always returns null no matter what my character is doing? lol Even when mining its null. [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null Quote Link to comment Share on other sites More sharing options...
Viston Posted November 19, 2017 Share Posted November 19, 2017 (edited) 3 minutes ago, atoo said: Just a quick update: Seems like getInteracting is broken because it always returns null no matter what my character is doing? lol Even when mining its null. [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:50 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null [INFO][Bot #1][11/19 01:28:51 PM]: interacting: null Did you try it with another Entity to come to the conclusion it's broken? Maybe try another entity and see Edited November 19, 2017 by Viston Quote Link to comment Share on other sites More sharing options...
atoo Posted November 19, 2017 Author Share Posted November 19, 2017 1 minute ago, Viston said: Did you try it with another Entity to come to the conclusion it's broken? Maybe try another entity and see But it should work with objects so i dont see the issue? The only reason i wanted to use this is because i wanted to check the current rock we are mining Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted November 20, 2017 Share Posted November 20, 2017 The method works fine for interacting with other players for me. Quote Link to comment Share on other sites More sharing options...
Lemons Posted November 20, 2017 Share Posted November 20, 2017 Character.getInteracting() only works if the other Entity is a Character, aka a Player or NPC. To detect which rock is being mined, you can get a good guess via the players rotation. Note you can be mining a rock and not be near the rock under some circumstances, so don't consider this 100% reliable. private RS2Object getRock(Player p) { Position facing = p.getPosition(); int rotation = p.getRotation(); // Determine offset if (rotation < 256) facing = facing.translate( 0, -1); else if (rotation < 768) facing = facing.translate(-1, 0); else if (rotation < 1280) facing = facing.translate( 0, 1); else if (rotation < 1792) facing = facing.translate( 1, 0); else facing = facing.translate( 0, -1); // Search objects at facing position for "Rocks" return getObjects().get(facing.getX(), facing.getY()) .stream().filter(o -> "Rocks".equals(o.getName())) .findFirst().get(); } I haven't tested this code but should be a good start. 1 Quote Link to comment Share on other sites More sharing options...