Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Can't get my bot to open castlewars door (Need Help)

Featured Replies

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.

 

Got a same like method won't work for me either opening a gate

 (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.

  • Author

There, Nice clean method loop untested but should work fine.

 

Wow Sponsor, thank you. I'll test this out asap.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.