BotScaper Posted March 10, 2017 Posted March 10, 2017 (edited) So I took the skeleton from the topic in tutorials and I wanted to know what I have to do to make my bot eat under a certain hp This is the snippet of code. NPC kurask = npcs.closest("Kurask"); if(kurask != null){ kurask.interact("Attack"); getGroundItems().closest(loot).interact("Take"); if (getSkills().getDynamic(Skill.HITPOINTS) > random(20,getSkills().getStatic(Skill.HITPOINTS)-22)){ Also if you know a formula that works well for calculating what hp to eat at I would love to know. Edited March 10, 2017 by BotScaper
Juggles Posted March 10, 2017 Posted March 10, 2017 (edited) WTF First of all, why is your code in the onStart LOL. Go learn java before trying to write a script Edited March 10, 2017 by Juggles 2
BotScaper Posted March 10, 2017 Author Posted March 10, 2017 I am taking a java course thats halfway done the semester I just wanted to try my hand at something different
BotScaper Posted March 10, 2017 Author Posted March 10, 2017 (edited) 7 minutes ago, Keven said: getInventory().interact("Eat", "Foodname"); thank you! I can turn foodname into a list to provide multiple options right? Edited March 10, 2017 by BotScaper
Keven Posted March 10, 2017 Posted March 10, 2017 10 minutes ago, BotScaper said: thank you! I can turn foodname into a list to provide multiple options right? yes
BotScaper Posted March 10, 2017 Author Posted March 10, 2017 I think I fixed my code up if anyone would like to check, I have everything up to Banking done (which is just eat, loot, and attack)
Prolax Posted March 10, 2017 Posted March 10, 2017 This is not enough: if(kurask != null){ Should check if your player is not interacting, not in combat, etc.
BotScaper Posted March 10, 2017 Author Posted March 10, 2017 7 minutes ago, Prolax said: This is not enough: if(kurask != null){ Should check if your player is not interacting, not in combat, etc. would this work? if(kurask != null && !players.myPlayer().isUnderAttack()){
Prolax Posted March 10, 2017 Posted March 10, 2017 - Check if npc is visible - Check if npc not is null - Check if myplayer not in combat - Check if myplayer not interacting That should be it, just look in the API for the methods.
BotScaper Posted March 10, 2017 Author Posted March 10, 2017 36 minutes ago, Prolax said: - Check if npc is visible - Check if npc not is null - Check if myplayer not in combat - Check if myplayer not interacting That should be it, just look in the API for the methods. if(kurask != null && !players.myPlayer().isUnderAttack()||!players.myPlayer().isAnimating()||kurask.isVisible()){
Prolax Posted March 10, 2017 Posted March 10, 2017 if(kurask != null && !players.myPlayer().isUnderAttack() && !players.myPlayer().isAnimating() && kurask.isVisible()){ 1