todamach Posted June 27, 2014 Posted June 27, 2014 Hey, maybe someone has a method that returns position in front of a player?
Extreme Scripts Posted June 27, 2014 Posted June 27, 2014 Hey, maybe someone has a method that returns position in front of a player? Why would you need this? If you're trying to find out if you're interacting with an entity then it can be found in the API, let me know and i'll point you to it Edit: Requested through pm- http://osbot.org/api/org/osbot/rs07/api/model/Character.html#getInteracting()
Botre Posted June 27, 2014 Posted June 27, 2014 (edited) get your position, get your rotation, remove or add 1 to your position's x and/or y coordinate based on that rotation. Edited June 27, 2014 by Botrepreneur
todamach Posted June 27, 2014 Author Posted June 27, 2014 Why would you need this? If you're trying to find out if you're interacting with an entity then it can be found in the API, let me know and i'll point you to it Edit: Requested through pm- http://osbot.org/api/org/osbot/rs07/api/model/Character.html#getInteracting() getInteractingpublic Character<?> getInteracting()Gets the character that this character is currently facing/interacting. Returns: The character. I scrolled throught this sooooo many times. What is character exactly? Isn't it player or smth?
Botre Posted June 27, 2014 Posted June 27, 2014 I scrolled throught this sooooo many times. What is character exactly? Isn't it player or smth?
todamach Posted June 27, 2014 Author Posted June 27, 2014 thanks. Method, if someone might be interested: public Position positionInFront(){ int dir = myPlayer().getRotation()/256; Position myPos = myPlayer().getPosition(); Position pos = null; if(dir == 0){ pos = new Position(myPos.getX(),myPos.getY()-1,myPos.getZ()); }else if(dir==2){ pos = new Position(myPos.getX()-1,myPos.getY(),myPos.getZ()); }else if(dir == 4){ pos = new Position(myPos.getX(),myPos.getY()+1,myPos.getZ()); }else if (dir == 6){ pos = new Position(myPos.getX()+1,myPos.getY(),myPos.getZ()); } return pos; }
Joseph Posted June 27, 2014 Posted June 27, 2014 thanks. Method, if someone might be interested: public Position positionInFront(){ int dir = myPlayer().getRotation()/256; Position myPos = myPlayer().getPosition(); Position pos = null; if(dir == 0){ pos = new Position(myPos.getX(),myPos.getY()-1,myPos.getZ()); }else if(dir==2){ pos = new Position(myPos.getX()-1,myPos.getY(),myPos.getZ()); }else if(dir == 4){ pos = new Position(myPos.getX(),myPos.getY()+1,myPos.getZ()); }else if (dir == 6){ pos = new Position(myPos.getX()+1,myPos.getY(),myPos.getZ()); } return pos; } i dont need it but nice
Pseudo Posted June 28, 2014 Posted June 28, 2014 I'm assuming you're writing a Sorceress' garden script then?