Jump to content

Simple Woodcutter Help (For Personal Use)


badboykenzie

Recommended Posts

The title states "For Personal Use" so no scripters feel threatned by this, im not trying to add another script to the SDN just wanna get this simple woodcutter down.

 

So my problem is that some functions like "getInventory" or "closestObjectForName()" doesnt work, even though i believe i have the right imports, if i dont then well... im sure ive done everything right to enable me to have the right imports from the API.

 

The tutorial i watched on how to import the right api files is a little outdated but i used some common sence and my very baisc understanding to find the right ones but im just not sure on how to read the API and get the right imports, im taking wild guesses and they seem to be working, although thats not the safest or correct way to do it.

 

So basically I just want a few people to hold my hand and walk me through this and some more people to join in and use this as an opportunity to learn some java coding for osbot!

 

QUESTIONS:

  • Is there a way to import all the API imports all at once..? && is this safe  <-- (See what i did there?)
  • Which imports are used for functions such as "getInventory" or "closestObjectForName" & are they still valid functions?
  • How do i correctly read the API knowing what code is used to Import the functions
  • Am i even using the term "Functions" correctly

ALL HELP APPRECIATED IN ADVANCE!

 

Link to comment
Share on other sites

1. use IntelliJ

2. add client as a library

3. objects.closest("Tree");

4. inventory.contains("Logs");

 

ill give intelliJ a try but im this new to this still im sure ill find my way around it. Ive added the client as the class library but ill give those two statements a go! thanks alot by the way for replying =)

 

closestObjectForName sounds like OSBot1 API.

Make sure you read up on the latest/updated API.

 

Yeah this is my problem i had no way of knowing that and im not 100% on how to read the api, im going through it now trying various things out.Thank for letting me know ill base the rest of my trials knowing that this was OSBot1 API and look for the newer functions to call!

 

Is the new API on osbot.org/api?

Link to comment
Share on other sites

ill give intelliJ a try but im this new to this still im sure ill find my way around it. Ive added the client as the class library but ill give those two statements a go! thanks alot by the way for replying =)

 

 

Yeah this is my problem i had no way of knowing that and im not 100% on how to read the api, im going through it now trying various things out.Thank for letting me know ill base the rest of my trials knowing that this was OSBot1 API and look for the newer functions to call!

 

Is the new API on osbot.org/api?

if you need any help with the setup/ect i can TV you are something

Link to comment
Share on other sites

That would be priceless thanks =) ill keep you posted, it seems to be working i was just calling the wrong methods to do actions! where can i find the latest list of all the api and more importantly how to i effectively read them?

http://osbot.org/api/

Find the thing you want to access on the left and click on it

Scroll down til you find the methods it has on the right.

EG Banking:

pQsLXXZ.png

then it brings up on the right

4Ikn0Qg.png

which you'd use like

 

bank.depositAll();
bank.isOpen();
bank.depositAllExcept(x):

ect

Edited by Isolate
Link to comment
Share on other sites

http://osbot.org/api/

Find the thing you want to access on the left and click on it

Scroll down til you find the methods it has on the right.

EG Banking:

pQsLXXZ.png

then it brings up on the right

4Ikn0Qg.png

which you'd use like

 

bank.depositAll();
bank.isOpen();
bank.depositAllExcept(x):

ect

 

Wow thats great and helps clear alot up! but say i needed to chop a tree i have this code, i just made it to spam click a tree just to see if it works from what everyone has replied to me with, thanks again all btw.

 

 public int onLoop() throws InterruptedException {

 

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

               

               tree.interact("Chop down");

                return 50;

        }

 

Now how would i go about finding

if (player is moving ){

    //dont click tree

}else{

//click tree

}

 

do i make a new entitiy play =myPlayer or something of the sort?

Link to comment
Share on other sites

Wow thats great and helps clear alot up! but say i needed to chop a tree i have this code, i just made it to spam click a tree just to see if it works from what everyone has replied to me with, thanks again all btw.

 

 public int onLoop() throws InterruptedException {

 

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

               

               tree.interact("Chop down");

                return 50;

        }

 

Now how would i go about finding

if (player is moving ){

    //dont click tree

}else{

//click tree

}

 

do i make a new entitiy play =myPlayer or something of the sort?

                          RS2Object tree = objects.closest("Tree");
                            //Overuse null checks if you need to, you can never have enough
                            if(tree != null){
                                //if the tree has been found by the client
                                if(!myPlayer().isAnimating()){
                                    //chop the tree
                                }
                            }

myPlayer();

is the base to access things to do with your character

Link to comment
Share on other sites

                          RS2Object tree = objects.closest("Tree");
                            //Overuse null checks if you need to, you can never have enough
                            if(tree != null){
                                //if the tree has been found by the client
                                if(!myPlayer().isAnimating()){
                                    //chop the tree
                                }
                            }
myPlayer();

is the base to access things to do with your character

 

 

Wow okey this is making sense, the tutorial i watched was so outdated it seems now that these methods are alot easier to call than before its going to take me alot of trial and error to get myself up to scratch! Can i add you on some form of social media or another i dont wanna keep pestering the whole community with a post everytime i have a problem lol and you clearly know your stuff =)

Link to comment
Share on other sites

Wow okey this is making sense, the tutorial i watched was so outdated it seems now that these methods are alot easier to call than before its going to take me alot of trial and error to get myself up to scratch! Can i add you on some form of social media or another i dont wanna keep pestering the whole community with a post everytime i have a problem lol and you clearly know your stuff =)

I have skype 'isolatepb'

the Australian one

Link to comment
Share on other sites

I'm not to sure how you're writing this, but if you're using enums/states I can help you a bit. So for mine basically I have a few states, chop,bank, bank_walk, chopw,chopo, a few more but thats not really important.

 

for lets say for my CHOPW state which stands for chop willow I have

if (wcLvl2 >= 30&&!inventory.isFull) //this will see if the woodcutting level is greater than or equal to 30,
//and if the inventory is not full
{
return State.CHOPW;//if these 2 statements go through, then it will return the state CHOPW
}
//so then after this state is returned it needs to know what to do
case CHOPW:
Entity willow = objects.closest("Willow");//gets the closest willow tree
if (wcLvl2 >= 30 && !myPlayer().isAnimating()&& !inventory.isFull())//this will check again to make sure the player has the //right wc level, and they're not animating
{
     willow.interact("Chop down");//this will interact with the closest will tree and use the option chop down
          sleep(random(500, 1000));//this will make it so the bot won't do anything for a second or so so the bot has time to //start animating
                break;
}

so basically that would be the most basic form to see if your inventory is not full, and you have a woodcutting level high enough to cut willows. and then check again to make sure, while also seeing if your character is animating or not.

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