Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.util.*;
- import com.speljohan.rsbot.script.*;
- import com.speljohan.rsbot.bot.*;
- import com.speljohan.rsbot.script.wrappers.*;
- import com.speljohan.rsbot.event.listeners.*;
- import com.speljohan.rsbot.event.events.*;
- public class SorsaCutter extends Script{
- public int axeid = 6739;
- public int yewid = 1309;
- public int BankBoothID = 25808;
- RSTile[] banktoyews = new RSTile[] {new RSTile(2726, 3486), new
- RSTile(2728, 3472),
- new RSTile(2726, 3460), new RSTile(2731, 3449), new
- RSTile(2742, 3443)};
- public RSTile[] yewstobank = new RSTile[] {new RSTile(2735, 3444),
- new RSTile(2727, 3453),
- new RSTile(2727, 3465), new RSTile(2727, 3479), new
- RSTile(2726, 3492)};
- public String getName(){
- return "Yew Cutter";
- }
- public String getAuthor(){
- return "Sorsa";
- }
- public String getScriptCategory(){return "Cutting";
- }
- public double getVersion(){
- return 1.0;
- }
- public boolean onStart(Map<String, String> args) {
- return true;
- }
- public void onFinish(){
- return;
- }
- public boolean needToBank(){
- return isInventoryFull();
- }
- public boolean atyews() {
- RSObject yew = getNearestObjectByID(yewid);
- if(yew == null) return false;
- return tileOnScreen(yew.getLocation());
- }
- public boolean atBank() {
- RSObject bank = getNearestObjectByID(BankBoothID);
- if(bank == null) return false;
- return tileOnScreen(bank.getLocation());
- }
- public boolean handleBank(){
- RSObject bankBooth = getNearestObjectByID(BankBoothID);
- if(bank == null)
- return false; //We cannot find a bank booth.
- if(bank.isOpen()){
- bank.depositAll();
- }else{
- atObject(bankBooth, "quickly");
- }
- return true;
- }
- public boolean walkToBank(){
- RSTile[] randomizedPath = randomizePath(yewstobank, 2, 2);
- // We want to randomize the path. 2, 2 = max x deviation and y deviation.
- return walkPathMM(randomizedPath, 25);
- //always use 25 or higher here. Don't worry about what it does.
- }
- public boolean cutyew(){
- RSObject yew = getNearestObjectByID(yewid);
- if(yew == null)
- return false;
- return atObject(yew, "Chop down");
- }
- public int loop() {
- if(getMyPlayer().isMoving()) return random(800, 1600);
- if(needToBank()){
- if(atBank()){
- if(handleBank())
- return random(800, 1000);
- }else{
- if(walkToBank())
- return random(800, 1000);
- }
- }else{
- if(atyews()){
- if(cutyew())
- return random(800, 1000);
- }else{
- if(walktoyews())
- return random(800, 1000);
- }
- }
- return random(800, 1000);
- }
- public boolean walktoyews(){
- RSTile[] randomizedPath = randomizePath(banktoyews, 2, 2);
- return walkPathMM(randomizedPath, 25);
- }
- public int loop() {
- if(getMyPlayer().isMoving()) return random(800, 1600);
- if(needToBank()){
- if(atBank()){
- if(handleBank())
- return random(800, 1000);
- }else{
- if(walkToBank())
- return random(800, 1000);
- }
- }else{
- if(atyews()){
- if(cutyew())
- return random(800, 1000);
- }else{
- //we are not at the yew trees.
- //we need to walk there
- }
- }
- return random(800, 1000);
- }
- public int loop() {
- if(getMyPlayer().isMoving()) return random(800, 1600);
- if(needToBank()){
- if(atBank()){
- if(handleBank())
- return random(800, 1000);}else{
- if(walkToBank())
- return random(800, 1000);
- //if we walk, we want to stop
- }
- }else{
- //We dont need to bank.
- if(atyews()){
- //we are at the yew trees.
- //you cut some logs..
- }else{
- //we are not at the yew trees.
- //we need to walk there.
- }
- }
- return random(800, 1000);
- }
- public int loop() {
- if(needToBank()){
- //We need to bank. Anything past this point
- //Until the closing brackets is banking.
- if(atBank()){
- if(handleBank())
- return random(800, 1000);
- // If we successfully open the
- // bank, we want to start the loop
- // over.
- }else{
- //we need to walk to the bank.
- //because we are not inside the
- //bank
- }
- }else{
- //We dont need to bank.
- if(atyews()){
- //we are at the yews.
- //you cut some logs.
- }else{
- //we are not at the catherby yews.
- //we need to walk there}
- }
- return random(800, 1000); }}
- public int loop() {
- if(needToBank()){
- //We need to bank.
- if(atBank()){
- //we are inside the bank, and
- //we deposit everything we have except our axe.
- }else{
- //we need to walk to the bank.
- //because we are not inside the
- //bank
- }
- }else{
- //We dont need to bank.
- if(atyews()){
- //we are at the catherby yews
- //you cut some logs.
- }else{//we are not in the yew trees
- //we need to walk there
- }
- }
- return random(800, 1000);
- }
- }
Add Comment
Please, Sign In to add comment