March 10, 20178 yr 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, 20178 yr by BotScaper
March 10, 20178 yr WTF First of all, why is your code in the onStart LOL. Go learn java before trying to write a script Edited March 10, 20178 yr by Juggles
March 10, 20178 yr Author I am taking a java course thats halfway done the semester I just wanted to try my hand at something different
March 10, 20178 yr Author 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, 20178 yr by BotScaper
March 10, 20178 yr 10 minutes ago, BotScaper said: thank you! I can turn foodname into a list to provide multiple options right? yes
March 10, 20178 yr Author 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)
March 10, 20178 yr This is not enough: if(kurask != null){ Should check if your player is not interacting, not in combat, etc.
March 10, 20178 yr Author 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()){
March 10, 20178 yr - 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.
March 10, 20178 yr Author 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()){
March 10, 20178 yr if(kurask != null && !players.myPlayer().isUnderAttack() && !players.myPlayer().isAnimating() && kurask.isVisible()){
Create an account or sign in to comment