Jump to content

Basic Function Names *Help Wanted*


DKoumane

Recommended Posts

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!


          


 


 


Link to comment
Share on other sites

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