Jump to content

Anyone wanna help a nub ?


Recommended Posts

Posted

hey guys, ive decided its about time i start making a script, i decided to make a flesh crawler killer, my idea was to have it go from edgville bank, down to the SHOS, get to the crawlers, eat, kill and possibly loot aswell ahah but yeah, my first wall ive hit is how do i check my player health and interact with my inventory to find and eat the food

 

 

 

a simple link to a relevant tutorial would be good enough

 

please no hate

please no " i cant help sorry " thats spam

 

 

 

if i end up getting this good enough to slap a price on it ill even offer the person that helps a few £

 

 

im doing this for RS07 nor RS2 btw

Posted (edited)

well, ive fucked about so much with it, this is how its ended up, not working of course, not even making sence

 

{
int Hitpoints = getSkills().getDynamic(Skill.HITPOINTS);
}
{
boolean Eat = getInventory().getItem("Trout").interact("Eat");
}
 
void Eat() {
   // the "if" clause: bicycle must be moving
   if (Hitpoints > 10){ 
 
 
EDIT
 
now changed to 
 
{
if((getSkills().getDynamic(Skill.HITPOINTS)) >> 10);
}
 
 
 
but i got my old enemy line again " cannot convert from int to boolean
 
 
 
help

 

Edited by Rylad
Posted (edited)

well, ive fucked about so much with it, this is how its ended up, not working of course, not even making sence

{

int Hitpoints = getSkills().getDynamic(Skill.HITPOINTS);

}

{

boolean Eat = getInventory().getItem("Trout").interact("Eat");

}

void Eat() {

// the "if" clause: bicycle must be moving

if (Hitpoints > 10){

EDIT

now changed to

{

if((getSkills().getDynamic(Skill.HITPOINTS)) >> 10);

}

but i got my old enemy line again " cannot convert from int to boolean

help

>> is a bitshift operation, > is the greater than comparison. When you do # > #, it will return true or false (a boolean). if you do # >> #, it will return an int. If statements require booleans. Edited by fixthissite
Posted

>> is a bitshift operation, > is the greater than comparison. When you do # > #, it will return true or false (a boolean). if you do # >> #, it will return an int. If statements require booleans.

 

 

ok ive got most of it sorted now

 

 

my only problem is

 

 

{
if((getSkills().getDynamic(Skill.HITPOINTS)) < 20);
getInventory().getItem("Trout").interact("Eat");
 
   }
 
 
 
it just eats trout over and over no matter what the hp is
Posted (edited)

ok ive got most of it sorted now

my only problem is

{

if((getSkills().getDynamic(Skill.HITPOINTS)) < 20);

getInventory().getItem("Trout").interact("Eat");

}

it just eats trout over and over no matter what the hp is

Thats because you ended your if statement with a ;, rather than opened it up with a { } to contain the trout eating code.

You are doing

if(...);
Eat

you should be doing

if(...) {
    Eat
}
Edited by fixthissite

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