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.