Trentnz 1 Share 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); } } Link to comment Share on other sites More sharing options...
Pandemic 2709 Share 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? Link to comment Share on other sites More sharing options...
Trentnz 1 Author Share 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 Pandemic 1 Link to comment Share on other sites More sharing options...
oh_my_goth 41 Share 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%? Link to comment Share on other sites More sharing options...
pharaoh 130 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now