Jump to content

importing class


Guangzhou

Recommended Posts

Hi guys i want to make a woodcutting script but I have problems with importing classes can somebody tell me what I´m doing wrong ?

Thanks in advance.

This is the first class:

package script;

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import tasks.GoChopTree;


@ScriptManifest(author = "GUANGZHOU", logo = "", info ="Cuts trees" , version = 1.0 , name = "Tree chopper")
public final class Main extends Script {

        private final GoChopTree goChopTree = new GoChopTree();

        @Override
        public void onStart() {


        }



        @Override
        public void onExit() {
            

        }

        @Override
        public int onLoop() {
            try {
                goChopTree.onLoop();
            } catch (InterruptedException e) {
                log("doesn´t work");
            }

            return 1000;

        }

    }

 

This is the second class:

package tasks;

import org.osbot.rs07.script.MethodProvider;


public final class GoChopTree extends MethodProvider {
    public final void onLoop() throws InterruptedException {
        long coinsininventory = inventory.getAmount(995);
        int coinsininv = Math.toIntExact(coinsininventory);
        log(coinsininv);
    }
}

 

Link to comment
Share on other sites

35 minutes ago, Guangzhou said:

Warning:(14, 19) java: exchangeContext(org.osbot.rs07.Bot) in org.osbot.rs07.script.MethodProvider has been deprecated

This is the warning that i am receiving + the script does not show up in my local files.

Try this instead:

@SuppressWarnings("deprecation")
@Override
public void onStart() {
    goChopTree.exchangeContext(getBot());
}

  • 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.
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...