pittasium Posted July 27, 2013 Share Posted July 27, 2013 As the title says I can't seem to get my bot to walk to the castlewars doors and open them if they are closed. Basically I need my guy to walk to the castlewars doors if my inventory is full and open them if they are closed. So far this is all I have after my code for banking. P.S: I'm just starting out so I might be making obvious/stupid mistakes please take it easy on me -------------------------------------------------------------- if (BANK_AREA.contains(player)) { Entity bankchest = closestObject(BANK_CHEST_ID); if (bank.isOpen()) { bank.depositAllExcept(STEEL_AXE); } else { if (bankchest != null) { if (bankchest.isVisible()) { bankchest.interact("Use"); sleep(random(700, 800)); } else { client.moveCameraToEntity(bankchest); } }else{ } walk(DOOR_AREA); Entity largedoor = closestObjectForName(LARGE_DOOR); if (largedoor != null) { if (largedoor.isVisible()) { largedoor.interact("Open"); sleep(random(600, 900)); } } I made a Door Area (the two squares in front of the doors) so that after the inventory is full it will walk to the Doors. However as you can see I don't have a way of saying something like: if (!largedoors.isOpen) largedoor.interact("Open"); so that if the doors are closed it will open them. If you read this far then thanks, I know it might be confusing but I've tried a few different things and can't seem to get it to work. Link to comment Share on other sites More sharing options...
riet Posted July 27, 2013 Share Posted July 27, 2013 Got a same like method won't work for me either opening a gate Link to comment Share on other sites More sharing options...
Sponsor Posted July 27, 2013 Share Posted July 27, 2013 (BANK_AREA.contains(player)) { Entity bankchest = closestObject(BANK_CHEST_ID); if (bank.isOpen()) { bank.depositAllExcept(STEEL_AXE); } else { if (bankchest != null) { if (bankchest.isVisible()) { bankchest.interact("Use"); sleep(random(700, 800)); } else { client.moveCameraToEntity(bankchest); } }else{ } walk(DOOR_AREA); Entity largedoor = closestObjectForName(LARGE_DOOR); if (largedoor != null) { if (largedoor.isVisible()) { largedoor.interact("Open"); sleep(random(600, 900)); } } One reason why it wont do anything, you have after one "} else {//nothing inbetween so it has no action to do here so it will not do anything. }" I'll rewrite this code for you as well. public int onLoop() throws InterruptedException { Area bankArea = new Area(2444, 3086, 2441, 3082); Area treeArea = new Area(2472, 3106, 2459, 3081); //Checks if your in bank area and inventory is full it will bank for you. if (client.getMyPlayer().isInArea(bankArea) && client.getInventory().isFull()) { RS2Object bankChest = closestObjectForName("Bank chest"); if (client.getBank().isOpen()) { client.getBank().depositAllExcept("Steel axe"); client.getBank().close(); } else { if (bankChest != null && bankChest.exists()) { if (bankChest.isVisible()) { bankChest.interact("Use"); sleep(random(700, 800)); } else { client.moveCameraToEntity(bankChest); } } } } //Checks if your inventory isn't full and if your not a tree area it will walk you there. //If the closed door it blocking you it will open it and walk threw otherwise ignores. if (!client.getMyPlayer().isInArea(treeArea) && !client.getInventory().isFull()) { RS2Object largeDoor = closestObject(2466, 2469); walk(treeArea); if (largeDoor != null && largeDoor.exists()) { if (largeDoor.getPosition().distance(client.getMyPlayer().getPosition()) <= 4) largeDoor.interact("Open"); sleep(random(600, 900)); } } //checks if in wcing area and area isn't full to woodcut if (client.getMyPlayer().isInArea(treeArea) && !client.getInventory().isFull()) { //Woodcutting method in here. } //will check if its not in bank area and inventory is full if (!client.getMyPlayer().isInArea(bankArea) && client.getInventory().isFull()) { //walking back to bank area here. } return 50; } } There, Nice clean method loop untested but should work fine. 1 Link to comment Share on other sites More sharing options...
pittasium Posted July 27, 2013 Author Share Posted July 27, 2013 There, Nice clean method loop untested but should work fine. Wow Sponsor, thank you. I'll test this out asap. Link to comment Share on other sites More sharing options...