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

Script double clicking object - Help

Featured Replies

God day,

Note that i'm currently a complete beginner on scripting, but i have some strange behavior that when we can interact with deposit box it double clicks it every time. I don't know if this is intentional or something i'm doing wrong?

log("Invt full and we are at deposit area!");
                if(depositbox.isVisible() && deposit.contains(myPlayer().getPosition())) {
                    // Depositbox is visable and we are in the area
                    log("Deposit box visable and we are in area!");
                    if(!bank.depositBox.isOpen()) {
                        // Deposit box aint open
                        log("Depositbox aint open");
                        if(depositbox.interact("Deposit")) {
                            log("Clicking deposit box!");
                            // We can interact with the deposit box
                            new ConditionalSleep(5000) {
                                @Override
                                public boolean condition() {
                                    return bank.depositBox.open();
                                }
                            }.sleep();
                        } else {
                            // We cant interact with the deposit box!
                            log("We cant interact with deposit box!");
                        }
                    } else {
                        // Depositbox is open.
                        log("Depositbox is open!");
                    }
                } else {
                    // Deposit box not visable or we are not in area.
                    log("Depositbox or area not there.");
                }

 

Edited by Slakan

The reason this is happening is due to this:

new ConditionalSleep(5000) {
	@Override
	public boolean condition() {
		return bank.depositBox.open();
  }
}.sleep();

The line: return bank.depositBox.open(); is a function that tries to open the deposit box and returns true if it executes the action, so basically you are clicking to open the depositBox and then your conditional sleep is opening it again. What you want to do here instead is use the isOpen() function:

new ConditionalSleep(5000) {
	@Override
	public boolean condition() {
		return bank.depositBox.isOpen();
	}
}.sleep();

 

  • Author
17 hours ago, Delision said:

The reason this is happening is due to this:

new ConditionalSleep(5000) {
	@Override
	public boolean condition() {
		return bank.depositBox.open();
  }
}.sleep();

The line: return bank.depositBox.open(); is a function that tries to open the deposit box and returns true if it executes the action, so basically you are clicking to open the depositBox and then your conditional sleep is opening it again. What you want to do here instead is use the isOpen() function:

new ConditionalSleep(5000) {
	@Override
	public boolean condition() {
		return bank.depositBox.isOpen();
	}
}.sleep();

 

Thank you! You are absolute correct there, i didn't see the mistake i did, but i should have used isOpen() as you say. 

 

Much appreciated for the help!

11 hours ago, Slakan said:

Thank you! You are absolute correct there, i didn't see the mistake i did, but i should have used isOpen() as you say. 

 

Much appreciated for the help!

Also you could replace 

deposit.contains(myPlayer().getPosition())

with just deposit.contains(myPlayer()) or deposit.contains(myPosition())

Edited by minewarriors

  • Author
17 hours ago, minewarriors said:

Also you could replace 

deposit.contains(myPlayer().getPosition())

with just deposit.contains(myPlayer()) or deposit.contains(myPosition())

What is the benefit of the different versions? - If i understand my original one i access myPlayer() to get the position of my entity.

The deposit.contains(myPlayer()) would just check if my entity is within the spesific area and deposit.contains(myPosition()) would actually check the position of my entity?

20 minutes ago, Slakan said:

What is the benefit of the different versions? - If i understand my original one i access myPlayer() to get the position of my entity.

The deposit.contains(myPlayer()) would just check if my entity is within the spesific area and deposit.contains(myPosition()) would actually check the position of my entity?

all the 3 things do the same.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.