Jump to content

Basic Function Names *Help Wanted*


Recommended Posts

Posted

Hi all. 


 


I've been wanting to get into making scripts for a while now. I have no classroom knowledge of Java, but I am familiar with C++. I have taken the introductory to C++ course, which taught me the basics (types, syntax, functions, if-statements, etc), and I just recently finished a course on Object Oriented Programming (it involved a lot of class types) and it looks very similar to this Java coding. 


 


I just started playing around with java and following Apaec's basic guide, I can now get my character to attack cows.


 


But here is where I feel I need exposure to:


 


I've been seeing bits of other example codes and I've seen functions such as "isUnderAttack()" or "myPlayer()" and I was wondering if there is a list of these functions I could view.


 


I am trying to incorporate eating in my basic cow killer, just to play around and get more familiarized with RS coding.


 


I assume it would be something like...



private static final int pike = 351; //pike
if (myPlayer.hitpoints() < 5)
{
inventory.pike.interact(pike);
}  

This is just an assumption. I don't know if there is a hitpoints() function, or if my syntax is correct. I hope I'm not confusing anyone.


 


Pretty much is there a list of functions that I can see that exists? Any steps in the right direction would greatly be appreciated as well.


 


Thank you all!


          


 


 


Posted (edited)

Most things are documented pretty well in the API

most base calls are pretty straight forward, Think as close as you can to english, but then allow for the fact it's a program

Your example in the most basic form in the OSBot api would look like
 

final int PIKE = 351;
if(myPlayer().getCurrentHealth() < 5){
    getInventory().getItem(PIKE).interact();
}

so most things you'd ever need to access are pretty straight foward , eg.
 

myPlayer()
getInventory()
getBank()
getGroundItems()

ect.
storing stuff is pretty straight foward too
 

Item itemExample = getInventory().getItem("Example name");
GroundItem groundItemExample = getGroundItems().closest("Example Name");
RS2Object objectExample = getObjects().closest("Example name");

ect
it's pretty straight forward, if in doubt, search api tongue.png

Edited by Isolate

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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