smh1 0 Posted January 4, 2021 import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.container.impl.bank.Bank; import org.dreambot.api.methods.dialogues.Dialogues; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.methods.interactive.NPCs; import org.dreambot.api.methods.item.GroundItems; import org.dreambot.api.methods.map.Area; 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 org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; import org.dreambot.api.wrappers.items.Item; import java.awt.*; @ScriptManifest( author = "smh1", description = "Cooker", category = Category.COOKING, version = 0.01, name = "Speed Cooker" ) public class Main extends AbstractScript { int dropOrder[] = {1,2,3,7,6,5,4,8,9,10,11,15,14,13,12,16,17,18,19,23,22,21,20,24,25,26,27}; public int uShark = 383; public int shark = 385; public int banker = 3194; public int fire = 26185; GroundItem uncookedShark = GroundItems.closest(383); State state; @Override public int onLoop() { switch (getState()) { case BANKING: NPC bankMan = NPCs.closest(banker); bankMan.interact("Bank"); sleepUntil(() -> Bank.isOpen(), Calculations.random(1000, 2000)); if (Bank.isOpen() && Inventory.isEmpty() || Bank.isOpen() && Inventory.containsAll(shark)) { Bank.depositAllItems(); sleepUntil(() -> Inventory.isEmpty(), 100, 250); Bank.withdraw(uShark, 28); sleepUntil(() -> Inventory.isFull(), Calculations.random(50, 120)); Bank.close(); sleep(1000); } break; case DROPPING: Inventory.dropAll(); break; case COOKING: Inventory.get(uShark).interact("Use"); sleepUntil(() -> Inventory.isItemSelected(), Calculations.random(10, 70)); GameObject firee = GameObjects.closest(fire); firee.interact("Use"); break; } return 0; } private enum State{ BANKING,DROPPING,COOKING } private State getState() { if (Inventory.isEmpty() || Inventory.containsAll(shark)) { state = State.BANKING; log("Banking"); } else if (Inventory.containsAll(uShark)){ state = State.DROPPING; log("Dropping"); } else if (Inventory.contains(uShark == 1)){ state = State.COOKING; log("Cooking"); } return state; } public void onStart(){ log("Bot has started"); } public void onExit(){ } } why isn't the bot switching to cooking state, I indicate that when he has only 1 shark left he must cook it.
smh1 0 Author Posted January 4, 2021 1 minute ago, Eclipseop said: can you explain what is wrong with this part? Please?
dream21 2 Posted January 4, 2021 lol....................... evaluate what this means uShark == 1 turns into 383==1; think about it if it was an if statement if(ushark ==1) what would happen? u basicly wrote Inventory.contains(uShark == 1) is Inventory.contains(false)
smh1 0 Author Posted January 4, 2021 Thanks, Dream21, for explaining my mistake. I found it really helpful, but can anyone help me out real quick?
Eclipseop 194 Posted January 4, 2021 6 minutes ago, smh1 said: Thanks, Dream21, for explaining my mistake. I found it really helpful, but can anyone help me out real quick? imagine getting spoonfed the answer and then being like "but can anyone help me out real quick?" L0l
smh1 0 Author Posted January 6, 2021 I've also tried this else if (Inventory.count(uShark) == 1) but it still doesn't work?.. Can anyone help me out? I'm stuck..
Recommended Posts
Archived
This topic is now archived and is closed to further replies.