Jump to content

Starting a Basic script, need some help


highball

Recommended Posts

Whats up y'all finally started to make a script =D as I posted in the tutorials, I needed some help, and I got a bit but most of it was done by myself...(; Just got some questions if any scripter can answer feel free to post/pm me your skype. Thanks!

 

Here is the code I have questions about:

 

 

package woodcutter;

 
import java.awt.Graphics;
 
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.model.Player;
import org.osbot.script.rs2.ui.Bank;
import org.osbot.script.rs2.ui.Inventory;
import org.osbot.script.rs2.utility.Area;
 
 
@ScriptManifest(author = "Highball", info = "Chops Willow Trees in Drynor", name = "Woodcutter", version = 0)
public class WoodCutter extends Script{
 
 
final String WILLOW_NAME = "willow";
final Area BANK_AREA = new Area(3092,3240,2097,3246);
final Area WILLOW_AREA = new Area(3081,3223,3092,3239);
final int BANK_BOOTH_ID = 2196;
 
 
 
// code used at start
public void onStart(){
 
 
}
 
// code to be executed at the end
public void onExit(){
 
}
 
// code in loop
public int onLoop() throws InterruptedException {
 
Inventory inven = client.getInventory();
Player player = myPlayer();
Bank bank = client.getBank();
 
if(!inven.isFull()){
// chop
 
 
if(WILLOW_AREA.contains(player)){
org.osbot.script.rs2.model.Entity willow = closestObjectForName(WILLOW_NAME); 
 
if (willow != null) 
if (willow.isVisible()) {
if (!player.isAnimating()) {
if(!player.isMoving()) {
willow.interact("chop down");
sleep(random(700,800));
}
}
}else{
client.moveCameraToEntity(willow);
 
}
}
}else{
walk(WILLOW_AREA);
}
 
 
 
// bank
if(BANK_AREA.contains(player)){
Entity bankbooth = closestObject(BANK_BOOTH_ID);
 
 
if(bank.isOpen()) {
bank.depositAll();
 
 
}else{
if(bankbooth != null){
if(bankbooth.isVisible()) {
bankbooth.interact("bank");
sleep(random(700,800));
}else{
client.moveCameraToEntity(bankbooth);
}
 
}
 
}
 
} else {
walk(BANK_AREA);
}
 
 
 
return 50;
 
 
}
 
// paint
public void onPaint(Graphics g) {
}
}
 

 

Edited by highball
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...