May 18, 201510 yr So basically ALL it does, kills a few cows, doesn`t pick up any cowhides and runs to bank, and back. States: private enum State { KILL, LOOT, WALK_TO_BANK, BANK, WALK_TO_KILL, WAIT }; private State getState() { NPC cow = npcs.closest("Cow", "Cow calf"); if (!myPlayer().isUnderAttack() && cow !=null && !myPlayer().isAnimating() && !cow.isUnderAttack()) return State.KILL; GroundItem cowhide = groundItems.closest("Cowhide"); if (!myPlayer().isUnderAttack() && cowhide !=null) return State.LOOT; if (inventory.isFull() && KILL_AREA.contains(myPlayer())) return State.WALK_TO_BANK; if (!inventory.isFull() && BANK_AREA.contains(myPlayer())) return State.WALK_TO_KILL; if (inventory.isFull() && BANK_AREA.contains(myPlayer())) return State.BANK; return State.WAIT; } onLoop: @Override public int onLoop() throws InterruptedException { if(myPlayer().getInteracting() != null) { return random(453, 999); } switch (getState()){ case KILL: Player player = myPlayer(); NPC cow = npcs.closest("Cow","Cow calf"); if (!player.isUnderAttack() && (cow != null) && (cow.isAttackable()) && (!player.isMoving())) { cow.interact("Attack"); return random(323, 532); } else { camera.toEntity(cow); } break; case LOOT: GroundItem cowhide = groundItems.closest("Cowhide"); if(!inventory.isFull() && !myPlayer().isUnderAttack() && groundItems.equals(cowhide) && cowhide.isOnScreen()) { cowhide.interact("Take"); return random(212, 326); } else { camera.toEntity(cowhide); } case WALK_TO_BANK: traversePath(path, false); sleep(random(1230,2452)); break; case WALK_TO_KILL: traversePath(path, true); sleep(random(1343,2212)); break; case WAIT: return random(121,212); case BANK: RS2Object bankBooth = objects.closest("Bank booth"); if (bankBooth != null && bankBooth.isVisible()) { if (bankBooth.interact("Bank")) { while (!bank.isOpen()) sleep(random(465, 863)); bank.depositAll(); } } break; } return random(243, 411); } Doesnt work so no need for full source. Can anybody give any tips?
May 18, 201510 yr Why not: if (inventory.isFull() && !BANK_AREA.contains(myPlayer())) return State.WALK_TO_BANK; if (!inventory.isFull() && !KILL_AREA.contains(myPlayer())) return State.WALK_TO_KILL; ??
May 19, 201510 yr Author Thanks. ;P That fixed the wierd walking thing. Really nice support, thank you. My logic does not yet work. Still not picking up hides, hmm, ima try find the reason. Couldn`t the problem be? cowhide.interact("Take"); Is there a different option in API? Im really confused about the API, still, but will try to find. just made the filter for the loot just to check for nulls and thats it. if(cowhide != null) { cowhide.interact("Take"); A guy was picking up bones and beef, leaving only cowhidees on the ground and my script started to pick them up.So the problem is it doesnt recognize cowhide when there is bones and beef on it. Wierd, huh?
May 21, 201510 yr make it just GroundItem cowhide = groundItems.closest("Cowhide"); if(cowhide != null && !myPlayer.isUnderAttack()) { cowhide.interact("Take"); sleep(1000); } Not sure is it 100% working as I'm writing it by hand without any spell checker Edited May 21, 201510 yr by pitoluwa