Jump to content

[Guide] Simple guide about navigating through the API's documentation


Vilius

Recommended Posts

For some people looking at the API's documentation might be overwhelming

 

Reading the documentation is really easy and everyone can do it without an issue.

 

Simple explanation of what the documentation page has.

 

Getting to the documentation page is really simple you just simply click the API button on any page of the OSBot forums.

 

P3VVSUP.png

 

After we get there we are greeted with this page

 

EiKSSty.png

 

Marked in red we see the API's packages

Marked in blue we see the API's classes

Marked in green is the documentations of a class.

 

Basic know about's in the documentation of a class

RGv1jWB.png

 

Marked in red is the name of the class

Marked in blue is the classes it extends

Marked in green is a short description of a class

 

Scrolling down we see much more

 

tAOZw3J.png

 

Marked in green is the data type of the method

Marked in blue is the method and a short description

 

Clicking on any of those methods it will bring you down to a more in depth explanation of the method

 

enTv5i9.png

 

Marked in red we see the method and the parameters it can have

Marked in blue is the short description.

Marked in green is the parameter and a short description of what the parameter means.

Marked in yellow is the return type of the method

 

Looking back at the red we can see depositAll(int... ids)

int... is the datatype the method will accept as a parameter.

 

Simply put you can only pass an int variable to the parameter

which would look like this: depositAll(111);

 

 

A more detailed guide on how to find your needed methods and how to use them

 

Lets say we are making a woodcutting script and now you need to interact with the tree object.

 

You know its an RS2Object so you write:

RS2Object tree = getObjects().closest("Tree");

You defined the objects variable but you now want to interact with it, but you have no idea. 

You go to the chatbox and ask people how do I do it? They will just point you to the API, where you are met with this page

 

mfTgEAZ.png

 

Now you just really want to see what method you need to use to interact with the tree so you start at the obvious "search for RS2Object"

Simply press the hotkeys CTRL + F and enter "RS2Object", you will see a lot of matches, but you need to search it in the box called "All classes"

 

n0O9wpq.png

 

We open the found class documentation

 

FXXaPcc.png

 

We see a lot of stuff, which I'm going to go trough it.

 

A9VIgjhl.jpg

 

Marked red is the name of the class

Marked blue is the other classes the RS2Object class inherits/implements.

Marked in green is a short description of what the class does.

 

Moving on we see the methods the class has.

 

2rzYhZA.png

 

Marked in red is the RS2Objects classes own methods

Marked in pink is the methods it inherits from the class Entity

Marked in blue is the methods it inherits from the class Identifiable

Marked in green is the methods it inherits from the class Intractable

 

Well now you are asking why is the RS2Object class inheriting so many methods from other classes, but it only extends Entity?

Quickly looking at the Entity class docs we can see that it extends the class Identifiable and Intractable.

 

After this short gander at these methods one catches our eye called "Interact" which I think we are looking for, aren't we?

 

8P1dAv5.png

 

Now we are getting somewhere, after clicking on the interact method we are redirected to another page.

 

MdALFyh.png

 

We see the method details marked in red.

In blue we see it has parameters that we can pass in in a String form, which simply means we can do .interact("Action")

 

Remember how we made a variable?

RS2Object tree = getObjects().closest("Tree");

So we found our method and now we can interact with the object by doing 

RS2Object tree = getObjects().closest("Tree");

tree.interact("Action");

So after this long journey we know what methods RS2Object has and what we can use, we found out how to interact with the object too.

 

 

I hope this simple guide helped you to understand the documentation page more easily smile.png

Edited by Vilius
  • Like 12
Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...
  • 2 weeks later...
  • 9 months later...
  • 3 years later...
  • 1 year later...

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