Jump to content

Trouble compiling an edited script


GetBackToOSRS

Recommended Posts

Original thread

 

Just modified it..

 

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;
 
@ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "")
public class main extends Script {
 
 
 
@Override
public void onStart() {
 
 
}
 
private enum State {
BANK, SETTING_UP, WORKING
}
 
private State getState() {
 
 
if (bank.isOpen())
{
return State.BANK;
}
 
if (!players.inventory.contains("Clean Harralander") || !players.inventory.contains("Swamp Tar") || !players.inventory.contains("Pestle and Mortar"))
{
return State.SETTING_UP;
}
 
if (players.inventory.contains("Clean Harralander") || players.inventory.contains("Swamp Tar") || players.inventory.contains("Pestle and Mortar"))
{
return State.WORKING;
}
 
 
 
return null;
 
 
 
}
 
@Override
public int onLoop() throws InterruptedException 
{
 
switch(getState()) {
case BANK:
if (!players.getInventory().isEmpty()){
bank.depositAll();
}
bank.withdraw("Clean Harralander", 25);
bank.close();
break;
 
case SETTING_UP:
Entity bank = objects.closest("Bank Chest");
bank.interact("Use");
break;
 
case WORKING:
getInventory().getItem("Clean Harralander").interact("Use");
getInventory().getItem("Swamp Tar").interact("Use");
sleep(random(700, 950));
RS2Widget w = widgets.get(309, 2);
if (w != null)
w.interact("Make ALL");
sleep(random(10000, 18000));
 
 
 
}
 
return random(500, 800);
}
 
@Override
public void onExit() {
 
}
 
@Override
public void onPaint(Graphics2D g) {
  
}
 
}
Link to comment
Share on other sites

contains("Clean harralander")

 

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;
 
@ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "")
public class main extends Script {
 
 
 
@Override
public void onStart() {
 
 
}
 
private enum State {
BANK, SETTING_UP, WORKING
}
 
private State getState() {
 
 
if (bank.isOpen())
{
return State.BANK;
}
 
if  getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar")
{
return State.SETTING_UP;
}
 
if  getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar")
{
return State.WORKING;
}
 
 
 
return null;
 
 
 
}
 
@Override
public int onLoop() throws InterruptedException 
{
 
switch(getState()) {
case BANK:
if (!getInventory().isEmpty()){
bank.depositAll();
}
bank.withdraw("Clean Harralander", 25);
bank.close();
break;
 
case SETTING_UP:
Entity bank = objects.closest("Bank Chest");
bank.interact("Use");
break;
 
case WORKING:
getInventory().getItem("Clean Harralander").interact("Use");
getInventory().getItem("Swamp Tar").interact("Use");
sleep(random(700, 950));
RS2Widget w = widgets.get(309, 2);
if (w != null)
w.interact("Make ALL");
sleep(random(10000, 18000));
 
 
 
}
 
return random(500, 800);
}
 
@Override
public void onExit() {
 
}
 
@Override
public void onPaint(Graphics2D g) {
  
}
 
}
Link to comment
Share on other sites

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;
 
@ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "")
public class main extends Script {
 
 
 
@Override
public void onStart() {
 
 
}
 
private enum State {
BANK, SETTING_UP, WORKING
}
 
private State getState() {
 
 
if (bank.isOpen())
{
return State.BANK;
}
 
if  getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar")
{
return State.SETTING_UP;
}
 
if  getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar")
{
return State.WORKING;
}
 
 
 
return null;
 
 
 
}
 
@Override
public int onLoop() throws InterruptedException 
{
 
switch(getState()) {
case BANK:
if (!getInventory().isEmpty()){
bank.depositAll();
}
bank.withdraw("Clean Harralander", 25);
bank.close();
break;
 
case SETTING_UP:
Entity bank = objects.closest("Bank Chest");
bank.interact("Use");
break;
 
case WORKING:
getInventory().getItem("Clean Harralander").interact("Use");
getInventory().getItem("Swamp Tar").interact("Use");
sleep(random(700, 950));
RS2Widget w = widgets.get(309, 2);
if (w != null)
w.interact("Make ALL");
sleep(random(10000, 18000));
 
 
 
}
 
return random(500, 800);
}
 
@Override
public void onExit() {
 
}
 
@Override
public void onPaint(Graphics2D g) {
  
}
 
}

 

>Clean harralander

>Pestle and mortar

etc. item names arent both capitalized

Link to comment
Share on other sites

It still won't compile.

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;
 
@ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "")
public class main extends Script {
 
 
 
@Override
public void onStart() {
 
 
}
 
private enum State {
BANK, SETTING_UP, WORKING
}
 
private State getState() {
 
 
if (bank.isOpen())
{
return State.BANK;
}
 
if  getInventory().contains("Clean harralander") || getInventory().contains("Swamp tar") || getInventory().contains("Pestle and mortar")
{
return State.SETTING_UP;
}
 
if  getInventory().contains("Clean harralander") || getInventory().contains("Swamp tar") || getInventory().contains("Pestle and mortar")
{
return State.WORKING;
}
 
 
 
return null;
 
 
 
}
 
@Override
public int onLoop() throws InterruptedException 
{
 
switch(getState()) {
case BANK:
if (!getInventory().isEmpty()){
bank.depositAll();
}
bank.withdraw("Clean harralander", 25);
bank.withdraw("Swamp tar", 390);
bank.withdraw("Pestle and mortar");
bank.close();
break;
 
case SETTING_UP:
Entity bank = objects.closest("Bank Chest");
bank.interact("Use");
break;
 
case WORKING:
getInventory().getItem("Clean harralander").interact("Use");
getInventory().getItem("Swamp tar").interact("Use");
sleep(random(700, 950));
RS2Widget w = widgets.get(309, 2);
if (w != null)
w.interact("Make ALL");
sleep(random(10000, 18000));
 
 
 
}
 
return random(500, 800);
}
 
@Override
public void onExit() {
 
}
 
@Override
public void onPaint(Graphics2D g) {
  
}
 
}
Link to comment
Share on other sites

players.inventory.contains()

Is wrong. It should be:

getInventory().contains()

 

players.inventory.contains()  is not "wrong" at least it's not what's causing the compilation error.

 

players is an instance of Players which is a subclass of MethodProvider.

You can use players to access MethodProvider fields.

inventory is a MethodProvider field.

Therefore players.inventory is valid. 

 

@OP:

What do you mean with "trouble compiling" ?

I copy pasted the code in my IDE and had no trouble compiling it.

Please provide a screenshot of your error.

Edited by Botre
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

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