Knowing the API is one of the most essential things when scripting, If you don't know where to look for things, or where the things you need are, how do you expect to be able to get anywhere?
Making a script is actually very easy
all you need to do is turn the actions required into a list... For example:
Basic woodcutter;
if im in the bank and my inventory isn't empty, empty inventory
if im in the bank and my inventory is empty, walk to the trees
if im at the trees and my inventory isn't full, chop the trees
if im at the trees and my inventory is full, walk to the bank
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.ui.Bank;
import org.osbot.script.rs2.utility.Area;
import java.awt.*;
/**
* User: Cory
* Date: 20/06/13
* Time: 22:06
*/
@ScriptManifest(name = "WoodCutter", author = "Cory", version = 1, info="")
public class WoodCutter extends Script {
private Area bank;
private Area trees;
@Override
public void onStart() {
try {
//anything that needs to be done before your script runs.
//We'll use this to initialise the areas.
bank = new Area(bottomLeftX, bottomLeftY, topRightX, topRightY);
trees = new Area(bottomLeftX, bottomLeftY, topRightX, topRightY);
//Obviously replace the values with correct info.
}
catch (Exception e){}
}
@Override
public int onLoop() throws InterruptedException {
boolean isInventoryEmpty = client.getInventory().isEmpty();
boolean isInventoryFull = client.getInventory().isFull();
//if im in the bank
if(bank.contains(myPlayer())) {
//my inventory isn't empty
if(!isInventoryEmpty) {
Bank bank = client.getBank();
//empty inventory
//...open bank
//deposit inventory
bank.depositAll();
//close bank
bank.close();
}
//my inventory is empty
if(isInventoryEmpty) {
//walk to the trees
walk(trees);
}
}
//if im at the trees
if(trees.contains(myPlayer())) {
//my inventory isn't full
if(!isInventoryFull) {
//chop the trees
}
//my inventory is full
if(isInventoryFull) {
//walk to the bank
walk(bank);
}
}
return 100;
}
@Override
public void onPaint(Graphics g){
//Draw anything you would like onto the client
//Such as a paint etc
}
}