Hello i am lepie and new here.
I dont have any experience with bots, so i try to make somthing. can some one help me. Sorry for my bad english.
thanks
Woodcutter;
import java.awt.Graphics;
import org.osbot.rs07.api.Camera;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
@ScriptManifest(author = "lepie1990", info = "wodcutter", logo = "", name = "woodcutter", version = 1.0)
public class Woodcutter extends Script {
int tree[] = { 1278, 1286, 1276 };
int oak[] = { 1751 };
int willow[] = { 1750, 1756, 1758, 1760 };
final Area tree_Varrock_Weast_area = new Area(3177, 3376, 3133, 3458);
final Area Bank_Varock_Weast_ex_area = new Area(3162, 3485, 3168, 3492);
final Area Bank_Varock_Weas_Great_area = new Area(3185, 3433, 3181, 3446);
final Area Bank_Varock_East_area = new Area(3254, 3420, 3251, 3422);
final String TREE_NAME1 = "Tree";
final String OAK_NAME = "Oak";
final String WILLOW_NAME = "Willow";
final int AnimationChop = 879;
final int AnimationStilStaan = -1;
final int Sleeptime = 5000;
final int BoothBank_Varock_Weas_Great_id = 7409;
Camera camera;
Player player;
// game loop
public int onLoop() throws InterruptedException {
// make tree a object
RS2Object CLOSEST_TREE = objects.closest(tree);
RS2Object BoothBank = objects.closest(BoothBank_Varock_Weas_Great_id);
// check is inventory is full
if (!inventory.isFull()) {
int CLOSEST_TREE_ID = CLOSEST_TREE.getId();// debug
String CLOSEST_TREE_NAME = CLOSEST_TREE.getName();// debug
logger.debug(CLOSEST_TREE_ID);// debug
logger.debug(CLOSEST_TREE_NAME);// debug
// chop the tree
LookForTreeToChop(CLOSEST_TREE);
} else {
// bank
logger.debug("bank or drop or bonfire");
Banking(Bank_Varock_Weas_Great_area, BoothBank);
}
return 10;
}
// paint info
public void onPaint(Graphics g) {
}
public void ChopDown(RS2Object CLOSEST_TREE_TO_CHOP) throws InterruptedException {
// check of player is bushy with tasks
if (myPlayer().getInteracting() == null) {
// check is player is moving
if (!myPlayer().isMoving()) {
// check is player do nothing
if (myPlayer().getAnimation() == AnimationStilStaan) {
// chop down the tree
CLOSEST_TREE_TO_CHOP.interact("Chop down");
sleep(Sleeptime);
logger.debug(myPlayer().getAnimation()); // debug
}
}
}
}
public void LookForTreeToChop(RS2Object CLOSEST_TREE_TO_CHOP) throws InterruptedException {
// check for nearby tree to chop
if (CLOSEST_TREE_TO_CHOP != null) {
logger.debug("tree not null");// debug
// check if tree is on screen
if (CLOSEST_TREE_TO_CHOP.isVisible()) {
logger.debug("tree is visble");// debug
// chop down the tree
ChopDown(CLOSEST_TREE_TO_CHOP);
} else {
// turn the camera towards the tree
camera.toPosition(CLOSEST_TREE_TO_CHOP.getPosition());
logger.debug("Turn camera");// debug
}
}
}
public void Banking(Area Bank, RS2Object BankBooth) {
// check if player is in the bank
if (Bank.contains(player)) {
logger.debug("Player is in the bank");// debug
// check for nearby Bankbooth
if (BankBooth != null) {
logger.debug("Bank is not null");// debug
if (BankBooth.isVisible()){
logger.debug("Bank is viable");// debug
BankBooth.interact("Bank");
}
}
} else {
// walking thwarts the bank
walking.walk(Bank);
}
}
public void onStart() {
}
// code to be executed at the end
public void onExit() {
}
}