Trentnz 1 Posted January 3, 2023 Wanting to start off with a simple Al Kahrid warrior killer please let me know what you think of my code import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.wrappers.interactive.Character; import org.dreambot.api.wrappers.interactive.NPC; public class AlKahridWarriorKiller extends AbstractScript { private static final int AL_KAHRID_WARRIOR_ID = 2634; private static final int LOBSTER_ID = 379; private static final int RUNE_SCIMITAR_ID = 4587; @Override public void onStart() { if (!getInventory().contains(RUNE_SCIMITAR_ID)) { log("You do not have a rune scimitar in your inventory. Stopping script."); stop(); } } @Override public int onLoop() { NPC alKahridWarrior = getNpcs().closest(AL_KAHRID_WARRIOR_ID); if (alKahridWarrior != null) { if (!alKahridWarrior.isInteractingWithLocalPlayer()) { if (getInventory().contains(LOBSTER_ID)) { getInventory().interact(LOBSTER_ID, "Eat"); } if (getCombat().getHealthPercent() < 50) { alKahridWarrior.interact("Attack"); } } } else { getWalking().walk(Calculations.random(3095, 3105), Calculations.random(3236, 3247)); } return Calculations.random(1000, 2000); } }
Pandemic 2853 Posted January 3, 2023 It reminds me of ChatGPT, haha. It's using the old API so it wouldn't work in the latest client, and I think your eating/attacking logic is backwards or something?
Trentnz 1 Author Posted January 3, 2023 1 hour ago, Pandemic said: It reminds me of ChatGPT, haha. It's using the old API so it wouldn't work in the latest client, and I think your eating/attacking logic is backwards or something? Haha well thats because it is chatGPT I’ve been playing around with it and I think thats actually a bad example of some of the code its spat out, but I was curious to see if it could actually spit something workable out
oh_my_goth 41 Posted January 6, 2023 Don't get it... If you're not in combat, you eat regardless of what your hp is? Also, you'd only attack the warrior, if you have UNDER 50%? That seems extremely bug-prone. Wastes food, and can never attack the warrior, if you accidentally over-ate due to your eat logic. Maybe do an HP check before eating (vs just eating regardless of hp), and correct the attack logic, to if your hp is ABOVE 50%?
pharaoh 135 Posted January 6, 2023 10 hours ago, oh_my_goth said: Don't get it... If you're not in combat, you eat regardless of what your hp is? Also, you'd only attack the warrior, if you have UNDER 50%? That seems extremely bug-prone. Wastes food, and can never attack the warrior, if you accidentally over-ate due to your eat logic. Maybe do an HP check before eating (vs just eating regardless of hp), and correct the attack logic, to if your hp is ABOVE 50%? chatgpt wrote the code good sir its using the outdated API methods
Recommended Posts
Archived
This topic is now archived and is closed to further replies.