Rylad Posted September 12, 2015 Posted September 12, 2015 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
empathy Posted September 12, 2015 Posted September 12, 2015 getSkills().getDynamic(Skill.HITPOINTS) getInventory().getItem("Food_Name").interact("Eat") Use the api docs.
Rylad Posted September 12, 2015 Author Posted September 12, 2015 getSkills().getDynamic(Skill.HITPOINTS) getInventory().getItem("Food_Name").interact("Eat") Use the api docs. i have been on that line for over an hour, the bit i dont understand is how to say for example if hp is below 5 all i can do is get hp
fixthissite Posted September 12, 2015 Posted September 12, 2015 i have been on that line for over an hour, the bit i dont understand is how to say for example if hp is below 5 all i can do is get hp You should look into control flow statements (https://docs.oracle.com/javase/tutorial/java/nutsandbolts/flow.html)
Rylad Posted September 12, 2015 Author Posted September 12, 2015 (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 September 12, 2015 by Rylad
empathy Posted September 12, 2015 Posted September 12, 2015 i have been on that line for over an hour, the bit i dont understand is how to say for example if hp is below 5 all i can do is get hp getSkills().getDynamic(Skill.HITPOINTS) < 5 lol
fixthissite Posted September 12, 2015 Posted September 12, 2015 (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 September 12, 2015 by fixthissite
Rylad Posted September 12, 2015 Author Posted September 12, 2015 >> 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
fixthissite Posted September 12, 2015 Posted September 12, 2015 (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 September 12, 2015 by fixthissite
Token Posted September 12, 2015 Posted September 12, 2015 whats your max hp on the acc you are testing it?