Jump to content

OakCutting Bot Help


CAPTWINGO
 Share

Recommended Posts


I am using Apaecs guide, but added wood cutting instead of thieving tea from stalls. I am trying to bank the oak logs that I have chopped. Any ideas?

package sixshots2;

import org.osbot.rs07.api.Bank;

import org.osbot.rs07.api.*;

import org.osbot.rs07.api.model.Entity;

import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

@ScriptManifest(author = "CaptWingo", info = "My first script", name = "OakCutting", version = 1.01, logo = "")

public class sixshots extends Script {

@Override

public void onStart() {

}

private enum State {

Chop, Wait, Bank

};

private State getState() {

Entity Oak = objects.closest("Oak");

if (!inventory.isEmpty())

return State.Bank;

if (Oak != null)

return State.Chop;

return State.Wait;

}

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case Chop:

Entity Oak = objects.closest("Oak");

if (Oak != null) {

Oak.interact("Chop-down");

}

break;

case Bank:

inventory.store.Deposit(OakLogs);

break;

case Wait:

sleep(random(500, 700));

break;

}

return random(200, 300);

}

@Override

public void onExit() {

}

@Override

public void onPaint(Graphics2D g) {

}

  • Like 1
Link to comment
Share on other sites

I am using Apaecs guide, but added wood cutting instead of thieving tea from stalls. I am trying to bank the oak logs that I have chopped. Any ideas?



package sixshots2;

import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.*;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

@ScriptManifest(author = "CaptWingo", info = "My first script", name = "OakCutting", version = 1.01, logo = "")
public class sixshots extends Script {

	@Override
	public void onStart() {
		
	}

	private enum State {
		Chop, Wait, Bank
	};

	private State getState() {
		Entity Oak = objects.closest("Oak");
		if (!inventory.isEmpty())
			return State.Bank;
		if (Oak != null)
			return State.Chop;
		return State.Wait;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case Chop:
			Entity Oak = objects.closest("Oak");
			if (Oak != null) {
				Oak.interact("Chop-down");
			}
			break;
		case Bank:
			inventory.store.Deposit(OakLogs);
			break;
		case Wait:
			sleep(random(500, 700));
			break;
		}
		return random(200, 300);
	}

	@Override
	public void onExit() {
		
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

} 

 

You need 4 states. Bank, WalkToBank, Chop, and WalkToTrees. They should be as follows

if(inventory.isFull()&&!BANKAREA.contains(myPlayer())
return State.WALKTOBANK;
if(inventory.isFull()&&BANKAREA.CONTAINS(myPlayer())
return State.BANK;
if(!inventory.isFull()&&TREEAREA.contains(myPlayer())
return State.CHOP;
if(!inventory.isFull()&&!TREEAREA.conntains(myPlayer())
return State.WALKTOTREES;

So you're going to need to make paths for walking to the bank, walking to tthe trees, and areas for the bank and the area you want to cut oaks.

 

Then for banking, it should look something like this

if(bank.isOpenn())
{
Entity bankBooth = objects.closest("Bank booth")
bankBooth.interact("Bank");
bank.depositAll("Oak logs");
sleep(random(500,1000));
bank.close;
}
else
bankBooth.interact("Bank");
sleep(random(500,1000));
Edited by Twin
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

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