elite sage1 1 Posted December 9, 2024 (edited) Grand exchange is not setup. You will have to buy the Raw food first. It will automatically progress to the next food when cooking level is met. The progression is not fine tuned and pretty much slapped together. You can adjust the progression of food fairly easily. Supports the following Raw foods. Quote if (cookingLevel >= 90) { currentFood = "Raw Shark"; } else if (cookingLevel >= 80) { currentFood = "Raw Monkfish"; } else if (cookingLevel >= 70) { currentFood = "Raw Swordfish"; } else if (cookingLevel >= 60) { currentFood = "Raw Lobster"; } else if (cookingLevel >= 50) { currentFood = "Raw Tuna"; } else if (cookingLevel >= 40) { currentFood = "Raw Salmon"; } else if (cookingLevel >= 30) { currentFood = "Raw Pike"; } else if (cookingLevel >= 15) { currentFood = "Raw Sardine"; } Full script below. Quote import org.dreambot.api.methods.container.impl.bank.Bank; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.methods.walking.impl.Walking; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.utilities.Sleep; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.skills.Skills; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.GameObject; import static org.dreambot.api.methods.interactive.Players.getLocal; import static org.dreambot.api.methods.widget.Widgets.getWidgetChild; @ScriptManifest(name = "Progressive Cooking Bot", author = "YourName", version = 1.0, description = "A progressive cooking bot", category = Category.COOKING) public class ProgressiveCookingBot extends AbstractScript { // Define cooking and bank areas private final Area LUMBRIDGE_COOKING_AREA = new Area(3206, 3212, 3212, 3217); private final Area LUMBRIDGE_BANK_AREA = new Area(new Tile(3207, 3217, 2), new Tile(3210, 3220, 2)); private String currentFood = "Raw Sardine"; // Default food @Override public void onStart() { log("Progressive Cooking Bot started!"); } @Override public int onLoop() { onSkillLevelUp(Skill.COOKING); if (Inventory.contains(currentFood)) { if (!isAtCookingSpot()) { goToCookingSpot(); } else { cook(); } } else if (shouldBank()) { goToBank(); } return 1000; // 1 second interval } private boolean shouldBank() { if (LUMBRIDGE_BANK_AREA.contains(getLocal()) && Inventory.isFull()) { Bank.depositAllItems(); Sleep.sleepUntil(() -> !Inventory.isFull(), 800); return true; } return !Inventory.contains(currentFood); } private void goToBank() { if (shouldBank() && !Bank.isOpen() && !LUMBRIDGE_BANK_AREA.contains(getLocal())) { Walking.walk(LUMBRIDGE_BANK_AREA.getRandomTile()); Sleep.sleepUntil(() -> LUMBRIDGE_BANK_AREA.contains(getLocal()), 800); } else if (shouldBank() && !Bank.isOpen()) { if (Bank.open()) { Sleep.sleepUntil(Bank::isOpen, 800); } } else if (Bank.isOpen() && (Bank.contains(currentFood))) { withdrawFoodFromBank(); } } private void goToCookingSpot() { if (Inventory.contains(currentFood)) { Walking.walk(LUMBRIDGE_COOKING_AREA.getRandomTile()); Sleep.sleepUntil(() -> LUMBRIDGE_COOKING_AREA.contains(getLocal()), 800); } } private void cook() { if (Inventory.contains(currentFood)) { GameObject cookingObject = GameObjects.closest(114); if (cookingObject != null && !getLocal().isAnimating()) { if (getWidgetChild(270, 14, 38) != null) { if (getWidgetChild(270, 14, 38).interact("Cook")) { log("Cooking " + currentFood + "..."); Sleep.sleepUntil(() -> !Inventory.contains(currentFood), 800); } } else if (cookingObject.interact("Cook")) { log("Cooking " + currentFood + "..."); Sleep.sleepUntil(() -> !Inventory.contains(currentFood), 800); } } } } private boolean isAtCookingSpot() { return LUMBRIDGE_COOKING_AREA.contains(getLocal()); } @Override public void onExit() { log("Progressive Cooking Bot stopped!"); } // Add a feature to progressively switch foods based on Cooking level public void onSkillLevelUp(Skill levelledSkill) { if (levelledSkill == Skill.COOKING) { int cookingLevel = Skills.getRealLevel(Skill.COOKING); String previousFood = currentFood; if (cookingLevel >= 90) { currentFood = "Raw Shark"; } else if (cookingLevel >= 80) { currentFood = "Raw Monkfish"; } else if (cookingLevel >= 70) { currentFood = "Raw Swordfish"; } else if (cookingLevel >= 60) { currentFood = "Raw Lobster"; } else if (cookingLevel >= 50) { currentFood = "Raw Tuna"; } else if (cookingLevel >= 40) { currentFood = "Raw Salmon"; } else if (cookingLevel >= 30) { currentFood = "Raw Pike"; } else if (cookingLevel >= 15) { currentFood = "Raw Sardine"; } if (!currentFood.equals(previousFood)) { log("Level up! Switching to " + currentFood + "."); } } } private void withdrawFoodFromBank() { if (!Inventory.contains(currentFood) && Bank.isOpen() && Bank.contains(currentFood)) { Bank.withdraw(currentFood, 28); Sleep.sleepUntil(() -> Inventory.contains(currentFood), 800); log("Withdrew " + currentFood + " from bank."); } } } ProgressiveCookingBot.java progressivecookingbot.jar Edited December 10, 2024 by elite sage1
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