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.

I'm having a withdrawing issue.

Featured Replies

Okay so i'm having an issue withdrawing more jewelry with this script im writing.

 

i have my variable which stores the ID of the jewelry.

public int getAllJewelryID;
public Entity bank;

in my onStart i have:

public void onStart() {
this.getAllJewelryID = this.client.getInventory().getItemForNameThatContains(new String[] { "ring", "necklace", "bracelet", "amulet" }).getId();
}

and the method i'm using for the script to bank is:


bank = this.closestObjectForName("Bank booth");

		if (!this.client.getBank().isOpen()) {
			if (bank != null) {
				bank.interact("Bank");
			}
		} else {
			this.client.getBank().depositAllExcept("Cosmic rune");
			this.sleep(MethodProvider.random(900, 1000));
			if (this.client.getBank().contains(getAllJewelryID)) {
				this.client.getBank().withdrawAll(getAllJewelryID);
				sleep(MethodProvider.random(900, 1000));
				this.client.getBank().close();
			}
		}

 it just opens and closes the bank like my bank doesn't have the jewelry in it. but this is the same type of method i use in other scripts i've made and it works fine.i've even tried just making a test script and in my onLoop() i just tried to make it withdraw a specific ID of an emerald ring just to try, but it didnt work. but it works with all other items.

Refer to my thread here:

http://osbot.org/forum/topic/42524-clientgetbankisopen-true-returning-too-early/

 

I think you are having problem because the bank isOpen() method is returning true, but it is not yet visible, so it is impossible to interact with it. Try checking the actual bank interface:

//pre-condition: Bank booth is on screen
public void openBankBooth(int timeout) throws InterruptedException
{
    while(client.getInterface(12) == null)
    {
        Thread.sleep(5);
        Entity bankBooth = closestObjectForName("Bank booth");
 
        if(bankBooth != null)
        {
            if(bankBooth.interact("Bank"))
            {
                long markTime = System.currentTimeMillis();
 
                while((client.getInterface(12) == null) && ((System.currentTimeMillis()-markTime) < timeout))
                    Thread.sleep(5);
            }
        }
    }
}

That is the current method I use. I also suggest you use dynamic sleeps instead of static sleeps to improve the efficiency of your script.

 

 

Here is what I personally use to withdraw a charge item (array):

//pre-condition: Bank is open
public void withdrawChargeItem(int[] itemID, int timeout) throws InterruptedException
{
    boolean done = false;
 
    while(!done)
    {
        for(int i = 0; i < itemID.length; i++)
        {
            if(client.getInventory().contains(itemID[i]))
            return;
        }
 
        for(int i = 0; i < itemID.length; i++)
        {
            if(client.getBank().contains(itemID[i]))
            {
                if(client.getBank().withdraw1(itemID[i]))
                {
                    long markTime = System.currentTimeMillis();
 
                    while((!client.getInventory().contains(itemID[i])) && ((System.currentTimeMillis()-markTime) < timeout))
                        Thread.sleep(5);
 
                    break;
                }
            }
        }
    }
}

Edited by KMJT

  • Author

 

Refer to my thread here:

http://osbot.org/forum/topic/42524-clientgetbankisopen-true-returning-too-early/

 

I think you are having problem because the bank isOpen() method is returning true, but it is not yet visible, so it is impossible to interact with it. Try checking the actual bank interface:

//pre-condition: Bank booth is on screen
public void openBankBooth(int timeout) throws InterruptedException
{
    while(client.getInterface(12) == null)
    {
        Thread.sleep(5);
        Entity bankBooth = closestObjectForName("Bank booth");
 
        if(bankBooth != null)
        {
            if(bankBooth.interact("Bank"))
            {
                long markTime = System.currentTimeMillis();
 
                while((client.getInterface(12) == null) && ((System.currentTimeMillis()-markTime) < timeout))
                    Thread.sleep(5);
            }
        }
    }
}

That is the current method I use. I also suggest you use dynamic sleeps instead of static sleeps to improve the efficiency of your script.

 

 

Here is what I personally use to withdraw a charge item (array):

//pre-condition: Bank is open
public void withdrawChargeItem(int[] itemID, int timeout) throws InterruptedException
{
    boolean done = false;
 
    while(!done)
    {
        for(int i = 0; i < itemID.length; i++)
        {
            if(client.getInventory().contains(itemID[i]))
            return;
        }
 
        for(int i = 0; i < itemID.length; i++)
        {
            if(client.getBank().contains(itemID[i]))
            {
                if(client.getBank().withdraw1(itemID[i]))
                {
                    long markTime = System.currentTimeMillis();
 
                    while((!client.getInventory().contains(itemID[i])) && ((System.currentTimeMillis()-markTime) < timeout))
                        Thread.sleep(5);
 
                    break;
                }
            }
        }
    }
}

 

Okay thank you for the reply, i will try this!

 

EDIT: tried this and it did the exact same thing. but only for jewelry like an emerald ring.for example i tried making it withdraw maple logs and it's fine. but with any jewelry it doesn't. it's weird.

Edited by Shnocky

  • Author

I think your casing is wrong.

 

I don't understand how it could be wrong. it interacts fine after storing the jewelry ID in that variable, but when i try and withdraw it wont. but if i try to withdraw other items it works fine. i made sure that i spelled everything right too. I'm just confused now lol.

 

  • Author

Yeah, i've tried the specific ID of most of the types of jewelry like i've tried all sapphire and emerald jewelry. and it just wont withdraw jewelry im stumped lol

 

You should use names instead of ID's.

so like

Item ring = client.getBank().getItemForName("Sapphire ring");
if(ring != null){
    int ringId = ring.getId();
    client.getBank().withdrawAll(ringId);
    sleep(random(200,300));
}
else{
    log("Ring is not in bank!");
    stop();
}

Also if you want your script to support entering PIN's you should do something like

RS2Object bankBooth = closestObjectForName("Bank booth");
if(bankBooth != null){
    while(!client.getBank().isOpen()){
        bankBooth.interact("Bank");
        sleep(random(200,400));
    }
    sleep(random(300,500));
    rest of banking stuff
}

Just my thoughts.

You could use a for loop instead of a while to avoid an infinite loop.

  • Author

Okay, so i got it to withdraw any jewelry. but it's only when it's in the top of the bank. good enough for now haha thanks for all the help!

You should use names instead of ID's.

so like

Item ring = client.getBank().getItemForName("Sapphire ring");if(ring != null){    int ringId = ring.getId();    client.getBank().withdrawAll(ringId);    sleep(random(200,300));}else{    log("Ring is not in bank!");    stop();}
Also if you want your script to support entering PIN's you should do something like
RS2Object bankBooth = closestObjectForName("Bank booth");if(bankBooth != null){    while(!client.getBank().isOpen()){        bankBooth.interact("Bank");        sleep(random(200,400));    }    sleep(random(300,500));    rest of banking stuff}
Just my thoughts.

You could use a for loop instead of a while to avoid an infinite loop.

Object ID's never change :p plus static sleeps should be avoided.

Object ID's never change tongue.png plus static sleeps should be avoided.

Also, that'll click the bank booth several times since a tick is .6 seconds, so it can click it for like 5-6 times in a row if you're unlucky.

Object ID's never change :p plus static sleeps should be avoided.

I'm pretty sure object ids do change. Item ids do not.
Guest
This topic is now closed to further replies.

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.