thelegacy0 Posted April 2, 2014 Share Posted April 2, 2014 (edited) Hey guys, I need some help with this. I don't babysit my bot, but it'll go for an hour or two easily (ran it up to 4 hours at once already). I don't know if it's coincidental, but it'll have no problems for those hours, then sometimes it'll eat an ent. I'm very new to this API but I'm doing my best to learn what I can. When I cut, I check for an ent: if(client.getMyPlayer().isAnimating() == false) { if(closestObjectForName("Willow").getId() != 1719) { Unless ents have different ID's... That might be my problem, but where could I find a list of those? In my onLoop(), I have this, because I don't know how to check the object I'm interacting with: if(client.getCurrentRegion().getObjects().contains(1719)) { walk(willowsArea); } This way, if there's an ent in the area, it'll walk away, and refresh my selected tree (first snippet). Also, another HUGE problem: it seems stop(); doesn't really work for me. public void logout() throws InterruptedException { if(!client.getMyPlayer().isUnderAttack()) { log("Rune axe was not equipped, logging out."); logoutTab.open(); sleep(random(1000,1500)); logoutTab.logOut(); } else { log("Player is under attacking, retrying."); while (client.getMyPlayer().isUnderAttack()) { sleep(1000); } logoutTab.logoutTab.open(); logoutTab.logoutTab.logOut(); } stop(); } All the thing does is logout, login, logout, login. Very freaking bot-like. Shouldn't the entire logout() method complete (as in pass stop() before the loginhandler activates? Kind've silly to implement that mid-task.. Then, how would I go about logging out and closing the script? Answer for ents: NPC ent = closestNPCForName("Willow"); Thank you, Reden. Edited April 2, 2014 by thelegacy0 Link to comment Share on other sites More sharing options...
Novak Posted April 2, 2014 Share Posted April 2, 2014 just check to make sure you are interacting with what you are supposed to (object not npc) Link to comment Share on other sites More sharing options...
thelegacy0 Posted April 2, 2014 Author Share Posted April 2, 2014 Like I said I'm very new, so bare with me. I found this: public boolean isFacing(Character<?> character) Returns whether this character is facing, or as you may call it interacting, with the specified Character. Parameters: character - The specified character. Returns: And that works for characters and NPCs, yes? How would I set this to look for an ent (the ent I encountered was ID 1719)? I'd imagine it'd be like if(isFacing(ent)) { //so on } But I don't know what needs to be implemented or how, like RS2Object ent = howeverYouDoIDs(1719); Sorry for the very late response, I'm trying to read through the api so I don't have to be spoonfed Link to comment Share on other sites More sharing options...
Reden Posted April 2, 2014 Share Posted April 2, 2014 I believe you can do it like this: NPC ent = closestNPCForName("Willow tree"); if (ent != null && myPlayer().isFacing(ent)) { walk(position); } 1 Link to comment Share on other sites More sharing options...
thelegacy0 Posted April 2, 2014 Author Share Posted April 2, 2014 I do believe that is what I'm looking for, thank you! Link to comment Share on other sites More sharing options...