I'll try and make this as quick and easy as possible.
The first thing you need to do is to get the variables of what you want to deposit or withdraw. I already taught you how to get variables in tutorial 1, so look back there if you need more help.
Once you have the item you need to withdraw or deposit, you need to get the bank booth ID. You can get this by viewing the object ID's in RSBot.
Here's an example that I made to show you how this works.
~~~~Example of banking~~~~Let's break this down a bit.
- Code:
-
RSObject booth = getNearestObjectByID(11402);
This is telling RSBot that the variable "booth" is an RSObject. The 11402 is the object ID of the bank booth.
- Code:
-
if (booth != null) {
atObject(booth, "Use-Quickly");
wait(random(400, 600));
}
This is saying that if the booth ID(11402) is not null
[null means that it doesn't exist or isn't there]then click on the bank booth and "Use-Quickly". wait(random(400, 600)); just tells it to wait for a random of 400-600 MS.
- Code:
-
if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()){
bank.withdraw(money, 0);
}
if(bank.getItemByID(money) == null) {
log("No more Money. Stopping Script.");
stopScript(true);
}
The top line and second line of this code basically says that if the bank is open, then withdraw all your money in the bank. (money, 0) <----[The 0 means withdraw-all.]
The third line says that if there is no money in the bank, stop the script, and logout.
- Code:
-
if(inventoryContains(money)){
bank.close();
}
This says that if your inventory contains money, and the bank is open, then close the bank.
Some of you may be saying, I don't need to withdraw anything though, so how do I make it just deposit things? Here's the method again, only without the withdraws:
~~~~Deposit Code~~~~
For the list of methods you can use to bank, view Bank.java in your RSBot Folder.
That's about it for now. Hopefully this is simple enough, but if you need some extra help, PM me.