Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • trtl

    Members
    • Posts

      14
    • Joined

    • Last visited

    Recent Profile Visitors

    The recent visitors block is disabled and is not being shown to other users.

    trtl's Achievements

    1. Now I'm curious what the script is about if knowing the exact tick is critical to it...
    2. Sounds like this is meant to be a project thread, so this would be a more relevant section: https://dreambot.org/forums/index.php?/forum/97-projects/ Edit: maybe not, would love to see your script's code @lacergunn if you could post it!
    3. I definitely do need to change this up, it's getting very confusing & heavy-handed trying to continue developing the script. I originally started with the node layout but I felt like I needed to simplify what I was doing as it was getting convoluted and confusing me, but maybe now I know a little more and that will be better for me. This is definitely a script with more steps than the first couple I made... It was more or less working well until I got to trying to detect the status of the store's raw shrimps/anchovies stock, and implementing some hopping functionality. Totally borked things up lol. If you want to see the complete mess of if's I ended up with: final Area NEARREDBEARD = new Area(3048,3254,3055,3251); final Area NEARDEPOSITBOX = new Area(3044,3235,3046,3234); final Area NEARBOATS = new Area(3026,3225,3029,3212); final Area NEARFISHSHOP = new Area(3011,3229,3017,3222); final Area GPFISHSPOT = new Area(2986,3179,2998,3144); final Area GPFISHSPOT1 = new Area(2987,3178,2988,3174); final Area GPFISHSPOT2 = new Area(2997,3160,2998,3157); public boolean piratesTreasureDone; public boolean hopped; public boolean storeFull; int storeShrimps; int storeAnchovies; Widget fishShopWindow = Widgets.getWidget(300); public final String REDBEARD = "Redbeard Frank"; public final Filter<NPC> REDBEARD_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(REDBEARD); } }; public final String GPFISHNPC = "Fishing spot"; public final Filter<NPC> GPFISHNPC_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(GPFISHNPC); } }; public final String FISHSHOPNPC = "Gerrant"; public final Filter<NPC> FISHSHOPNPC_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(FISHSHOPNPC); } }; public void onStart() { log("Welcome to trtlFisher!"); if (!Tab.QUEST.isOpen()) { Tabs.openWithMouse(Tab.QUEST); } if (FreeQuest.PIRATES_TREASURE.isFinished()) { boolean piratesTreasureDone = true; } else { boolean piratesTreasureDone = false; } } public void onExit() { log("Fine, fuck you too."); } @Override public int onLoop() { boolean nearRedbeard = NEARREDBEARD.contains(getLocalPlayer()); boolean nearGPFishSpot = GPFISHSPOT.contains(getLocalPlayer()); boolean nearGPFishSpot1 = GPFISHSPOT1.contains(getLocalPlayer()); boolean nearGPFishSpot2 = GPFISHSPOT2.contains(getLocalPlayer()); boolean nearFishShop = NEARFISHSHOP.contains(getLocalPlayer()); if (!piratesTreasureDone) { boolean piratesTreasureStarted; piratesTreasureStarted = FreeQuest.PIRATES_TREASURE.isStarted(); if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { return Calculations.random(800, 1200); } else if (!piratesTreasureStarted && !nearRedbeard) { Walking.walk(NEARREDBEARD.getRandomTile()); log("Walking towards Redbeard"); return Calculations.random(800, 1200); } NPC redbeard = NPCs.closest(REDBEARD_FILTER); if (!Dialogues.inDialogue() && !piratesTreasureStarted) { log("Talking to Redbeard"); redbeard.interact("Talk-to"); return Calculations.random(1250, 1500); } final String[] OPTIONS = {"I'm in search of treasure.", "Ok, I will bring you some rum"}; if (Dialogues.inDialogue() && !Dialogues.continueDialogue()) { for(String option : OPTIONS) { sleep(420, 840); if (Dialogues.chooseOption(option)) { break; } } } else if (Dialogues.continueDialogue()) { sleep(250, 500); Dialogues.continueDialogue(); return Calculations.random(10, 100); } if (piratesTreasureStarted && nearFishShop && (Inventory.contains("Raw shrimps") || Inventory.contains("Raw anchovies"))) { log("Checking shop inventory..."); if (fishShopWindow.isVisible()) { storeShrimps = Shop.get("Raw shrimps").getAmount(); log(storeShrimps); storeAnchovies = Shop.get("Raw anchovies").getAmount(); log(storeAnchovies); if (storeShrimps == 50 || storeAnchovies == 50) { log("Shop full, hopping worlds"); storeFull = true; World world = Worlds.getRandomWorld(w -> w.isF2P() && !w.isPVP() && w.getMinimumLevel() == 0); WorldHopper.hopWorld(world); hopped = true; return Calculations.random(10, 100); } else if (storeShrimps < 50 && storeAnchovies < 50) { storeFull = false; return Calculations.random(10, 100); } return Calculations.random(10, 100); } return Calculations.random(10, 100); } if (Inventory.count("Coins") > 30 && piratesTreasureStarted && !Inventory.isFull() && !hopped) { //will need to flip condition once fully tested if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { return Calculations.random(800, 1200); } else if (!nearGPFishSpot) { Walking.walk(GPFISHSPOT.getCenter().getRandomizedTile()); log("Walking towards GP fishing spot"); return Calculations.random(800, 1200); } NPC gpFish = NPCs.closest(GPFISHNPC_FILTER); if (nearGPFishSpot && !Inventory.isFull() && getLocalPlayer().getAnimation() != 621 && gpFish != null) { log("Fishing..."); gpFish.interact("Small Net"); sleep(1000,5000); if (!Tab.INVENTORY.isOpen()) { Tabs.openWithMouse(Tab.INVENTORY); } return Calculations.random(4000, 6000); } else if (getLocalPlayer().getAnimation() == 621) { // Do nothing return Calculations.random(10000, 15000); } else if (nearGPFishSpot && gpFish == null) { if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { return Calculations.random(800, 1200); } else if (nearGPFishSpot && !nearGPFishSpot1) { Walking.walk(GPFISHSPOT1.getRandomTile()); log("No spot detected, Walking towards GP fishing spot 1"); return Calculations.random(3000, 6000); } else if (nearGPFishSpot && !nearGPFishSpot2) { Walking.walk(GPFISHSPOT2.getRandomTile()); log("No spot detected, Walking towards GP fishing spot 2"); return Calculations.random(3000, 6000); } } } if ((Inventory.count("Coins") > 30 && piratesTreasureStarted && nearFishShop && (Inventory.isFull() || Inventory.contains("Raw shrimps") || Inventory.contains("Raw anchovies"))) || (nearFishShop && hopped)) { log("Done fishing for GP!"); NPC fishShopNPC = NPCs.closest(FISHSHOPNPC_FILTER); if (!Dialogues.inDialogue()) { log("Trading with fishing shop NPC"); fishShopNPC.interact("Trade"); sleep(3000,5000); if (fishShopWindow != null) { if (Inventory.contains("Raw shrimps")) { log("Selling raw shrimp"); Inventory.interact("Raw shrimps", "Sell 50"); return Calculations.random(10, 100); } if (Inventory.contains("Raw anchovies")) { log("Selling raw anchovies"); Inventory.interact("Raw anchovies", "Sell 50"); return Calculations.random(10, 100); } } return Calculations.random(2000, 3000); } } else if (Inventory.count("Coins") > 30 && piratesTreasureStarted && !nearFishShop && Inventory.isFull()) { if (Walking.getDestinationDistance() <= Calculations.random(4, 6)) { Walking.walk(NEARFISHSHOP.getCenter().getRandomizedTile()); log("Walking towards fishing shop"); } return Calculations.random(800, 1200); } } I was in a bit of a rush since I don't get too much time to work on scripting, but I think next time I'll completely rework it into a state or node based layout again, including what I've learned since the last time. What you said about using progress ints sounds like it will be key to keeping it from blowing up in size & dirtiness like this script. Do you have any recommendations for specific script sources I could look at with excellent documentation? I'm not a Java developer (obviously LOL) and that would be a major help I think. Also what does 0-max mean? Thanks again @Axolotl!
    4. I was aware the boolean can't be used like that (after trying that out), was just showing my attempt to help illustrate what I was trying to accomplish. Thank you, that bit about doing it within onStart is exactly what I needed, I hadn't thought to use that yet and that'll be a bit of info that will help me a ton moving forward! This is an interesting bit of code I hadn't though of either, although I think it would also result in a bit of an apparent bot-like maneuver. (keeping the quest tab open all the time seems strange to me and might be a potential way to trigger a bot flag if detection methods continue to evolve. Probably not the case now I'm sure though) For the return value, you're referring to my usage of sleep right? I'll definitely keep that in mind as I continue learning how to script, makes a lot of sense. PS: Thanks again for your help with the quest detection code! Edit: Looks like I can't use sleep within the return value (returns void instead of an int) but I guess it works the same way without it so no big deal. Edit2: Didn't have much time today to work on this further but here's where I got on this portion of the script. If you see anything else wrong or done poorly I'd greatly appreciate any more advice you guys might have for me. So far it seems to be working well enough. public boolean piratesTreasureDone; public void onStart() { log("Welcome to trtlFisher!"); Tabs.openWithMouse(Tab.QUEST); if (FreeQuest.PIRATES_TREASURE.isFinished()) { boolean piratesTreasureDone = true; } else { boolean piratesTreasureDone = false; } } ... public final String REDBEARD = "Redbeard Frank"; public final Filter<NPC> REDBEARD_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(REDBEARD); } }; final Area NEARREDBEARD = new Area(3052,3254,3055,3252); ... @Override public int onLoop() { boolean nearRedbeard = NEARREDBEARD.contains(getLocalPlayer()); if (!piratesTreasureDone) { boolean piratesTreasureStarted = false; if (FreeQuest.PIRATES_TREASURE.isStarted()) { piratesTreasureStarted = true; } else { piratesTreasureStarted = false; } if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { return Calculations.random(900, 1500); } else if (!nearRedbeard) { Walking.walk(NEARREDBEARD.getRandomTile()); log("Walking towards Redbeard"); return Calculations.random(1080, 1240); } NPC redbeard = NPCs.closest(REDBEARD_FILTER); if (!Dialogues.inDialogue() && !piratesTreasureStarted) { log("Talking to Redbeard"); redbeard.interact("Talk-to"); return Calculations.random(1250, 1500); } final String[] OPTIONS = {"I'm in search of treasure.", "Ok, I will bring you some rum"}; if (Dialogues.inDialogue() && !Dialogues.continueDialogue()) { for(String option : OPTIONS) { sleep(420, 840); if (Dialogues.chooseOption(option)) { break; } } } else if (Dialogues.continueDialogue()) { sleep(250, 500); Dialogues.continueDialogue(); } // Next: need to script steps after getting quest started } return Calculations.random(320, 480); }
    5. Here's my snippet: public int onLoop() { boolean nearRedbeard = NEARREDBEARD.contains(getLocalPlayer()); boolean questCheck; if (questCheck == null) { Tabs.openWithMouse(Tab.QUEST); } if (!FreeQuest.PIRATES_TREASURE.isFinished()) { questCheck = true; if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { sleep(Calculations.random(900, 1500)); } else if (!nearRedbeard) { Walking.walk(NEARREDBEARD.getRandomTile()); sleep(Calculations.random(1080, 1240)); } NPC redbeard = NPCs.closest(REDBEARD_FILTER); ... This gives me an error for the uninitiated bool variable questCheck, although I'm not sure how I should be checking if I've already looked at the quest tab. I'm trying to prevent it from constantly moving to open the quest tab onLoop... Thoughts?
    6. AHHH of course haha I completely missed that. Thank you! Hopefully will have the kinks worked out soon enough.
    7. Thank you for the suggestion. That makes a lot of sense. I've reworked it with that in mind (the goal of starting from the top of onLoop) and it's working much better now. I can make it a cycle or two before it messes something up so it's getting there. I was hoping you could elaborate on why the script might get stuck in something like the following: // Loot any lingering feathers if (Inventory.isFull() && featherLoot && !inCookingBox) { log("Looting feathers"); while (featherLoot) { GroundItem feathers = GroundItems.closest("Feather"); if (feathers != null) { feathers.interact("Take"); sleep(640, 1650); } } } This is one of the hang-ups currently, and I know you said to try to avoid them, but I don't know if I can sometimes, and it would be helpful to understand the issue at hand a little better. Do I just need to handle the feathers declaration in a specific way? To me it seems like it should loop again and null out the variable, breaking the loop, but that doesn't seem to be happening right now.
    8. So I ended up scrapping my existing script so I could rebuild it as a state script. Hoping that will simplify things considering I generally only want to make simple scripts right now. Now I'm having a new issue where it doesn't leave the kill or loot state when it's in there. I've tried a few different things (code is probably a bit bloated/redundant now) and can't seem to figure out why it's not getting out of the loops. Any suggestions? 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.filter.Filter; 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.methods.walking.impl.Walking; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.Category; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; import javax.swing.*; @ScriptManifest(author = "trtl", name = "Chicken Slayer", version = 1.0, description = "kill & loot chickens, bury bones, cook & bank", category = Category.COMBAT) public class main extends AbstractScript { public static final String CHICKEN = "Chicken"; public static final Filter<NPC> CHICKEN_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(CHICKEN) && !npc.isHealthBarVisible(); } }; final Area KILLBOX = new Area(3225, 3287, 3236, 3301); final Area COOKINGPOT = new Area(3225,3289,3226,3291); final Area BANKBOX = new Area(3207,3219,3210,3220,2); boolean lootVisible = KILLBOX.contains(GroundItems.closest("Feather", "Bones", "Raw chicken")); boolean playerInBox = KILLBOX.contains(getLocalPlayer()); public void onStart() { log("Welcome to Chicken Slayer by trtl"); } private enum State { KILL, LOOT, BURY, COOK, BANK, RETURN, ERROR }; private State getState() { if (!Inventory.isFull() && playerInBox && !lootVisible) { return State.KILL; } if (!Inventory.isFull() && playerInBox && lootVisible) { return State.LOOT; } if (Inventory.isFull() && Inventory.contains("Bones")) { return State.BURY; } if (Inventory.isFull() && Inventory.contains("Raw chicken") && !Inventory.contains("Bones")) { return State.COOK; } if (Inventory.isFull() && !Inventory.contains("Raw chicken")) { return State.BANK; } if (Inventory.isEmpty() && !playerInBox) { return State.RETURN; } else { return State.ERROR; } } public void onExit() { log("Collected x feathers and gained x experience!"); } @Override public int onLoop() { switch (getState()) { case KILL: log("in kill state"); while (!lootVisible) { NPC chicken = NPCs.closest(CHICKEN_FILTER); boolean lootVisible = KILLBOX.contains(GroundItems.closest("Feather", "Bones", "Raw chicken")); log(lootVisible); if (getLocalPlayer().isInCombat()) { log("in combat, doing nothing"); sleep(1000); } else if (chicken != null) { log("attacking chicken"); sleep(1000); chicken.interact("Attack"); sleep(2500); } } break; case LOOT: log("in loot state"); while (!Inventory.isFull() && lootVisible) { log("looting items"); boolean lootVisible = KILLBOX.contains(GroundItems.closest("Feather", "Bones", "Raw chicken")); log(lootVisible); sleep(1000); GroundItem drops = GroundItems.closest("Feather", "Bones", "Raw chicken"); if (drops != null) { drops.interact("Take"); sleep(640, 1650); } } break; case BURY: log("in bury state"); while (Inventory.contains("Bones")) { log("burying bones"); sleep(1000); Inventory.interact("Bones", "Bury"); sleep(960, 1250); } break; case COOK: log("in cook state"); if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { sleep(Calculations.random(900, 1500)); } else { Walking.walk(COOKINGPOT.getRandomTile()); } // need to code out cooking portion, dropping burnt chicken break; case BANK: log("in bank state"); if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { sleep(Calculations.random(900, 1500)); } else { Walking.walk(BANKBOX.getRandomTile()); } if (Bank.openClosest()) { Bank.depositAllItems(); } else { Bank.openClosest(); sleep(960, 1250); } case RETURN: log("in return state"); if (Walking.getDestinationDistance() > Calculations.random(4, 6)) { sleep(Calculations.random(900, 1500)); } else { Walking.walk(KILLBOX.getRandomTile()); } case ERROR: log("in error state"); } return Calculations.random(360, 640); } }
    9. Figured I should update with my progress. Here is the script currently... Right now working through issues with the cooking portion, I think I'll need to rework it as it's very buggy, but just wanted to leave the script code here in case anyone wanted to drop a few tips. Main file package src; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.skills.SkillTracker; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.impl.TaskScript; import tasks.Chickens; import tasks.BuryBones; import tasks.CookMeat; import java.awt.*; @ScriptManifest(name = "Chicken Chaser", description = "This Cheekin Chaysa hunts down chickens, picks up all their drops, buries bones, cooks chicken, banks, and returns to do it all over again.", author = "trtl", version = 1.0, category = Category.COMBAT, image = "VVeN1Lv.png") public class ChickenChaser extends TaskScript { @Override public void onStart() { // Start DreamBot's skill tracker for the hitpoints skill, so we can later see how much experience we've gained SkillTracker.start(Skill.HITPOINTS); log("Starting script"); // Now add our three tasks so the client knows what to do addNodes(new Chickens(), new BuryBones(), new CookMeat()); } @Override public void onPaint(Graphics g) { String experienceGainedText = String.format( "HP Exp: %d (%d per hour)", // The paint's text format. '%d' will be replaced with the next two arguments. SkillTracker.getGainedExperience(Skill.HITPOINTS), SkillTracker.getGainedExperiencePerHour(Skill.HITPOINTS) ); // Now we'll draw the text on the canvas at (5, 35). (0, 0) is the top left of the canvas. g.drawString(experienceGainedText, 5, 35); } } Chickens subtask package tasks; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.filter.Filter; 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.methods.walking.impl.Walking; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; public class Chickens extends TaskNode { final Area KILLBOX = new Area(3225, 3287, 3236, 3301); public static final String CHICKEN = "Chicken"; public static final Filter<NPC> CHICKEN_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(CHICKEN) && !npc.isHealthBarVisible(); } }; @Override public boolean accept() { // If our inventory is not full, and we're in the right area return !Inventory.isFull() && (KILLBOX.contains(getLocalPlayer())); } @Override public int execute() { log("In Chickens task"); GroundItem drops = GroundItems.closest("Feather", "Bones", "Raw chicken"); if (getLocalPlayer().isInCombat()) { // Do nothing } else if (KILLBOX.contains(getLocalPlayer())) { // If player is in the box NPC chicken = NPCs.closest(CHICKEN_FILTER); if (chicken != null && drops == null) { // If chickens are present and drops are not log("In Chickens task, attacking"); chicken.interact("Attack"); } if (drops != null) { // If chicken drops are present log("In Chickens task, drops found, picking up"); drops.interact("Take"); sleep(640, 1650); } } else { Walking.walk(KILLBOX.getRandomTile()); } return Calculations.random(300, 600); } } BuryBones subtask package tasks; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; public class BuryBones extends TaskNode { @Override public boolean accept() { // If our inventory is full we should bury the bones return Inventory.isFull() && Inventory.contains(526); } @Override public int execute() { log("In BuryBones task"); // Bury bones while (Inventory.contains(526)) { Inventory.interact("Bones", "Bury"); sleep(960, 1250); } return Calculations.random(300, 600); } } CookMeat subtask package tasks; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; 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.methods.walking.impl.Walking; import org.dreambot.api.methods.widget.Widget; import org.dreambot.api.methods.widget.Widgets; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.Item; import org.dreambot.api.wrappers.widgets.WidgetChild; public class CookMeat extends TaskNode { final Area NEARSTAIRS = new Area(3207, 3227, 3213, 3228); // Area to move to access staircase in Lumbridge castle @Override public boolean accept() { // If our inventory is full and contains 26 raw chicken return Inventory.isFull() && Inventory.count("Raw chicken") == 26; } @Override public int execute() { log("In CookMeat task"); // go to Lumbridge bank area, make fire with logs outside, cook raw chicken, drop burnt chicken // if (getLocalPlayer().isAnimating(COOKING_ANIMATION)){ // // Do nothing // } else { if (NEARSTAIRS.contains(getLocalPlayer())) { // If player is near the first set of stairs log("In CookMeat task, climbing first set of stairs"); GameObjects.closest("Staircase").interact("Climb-up"); } else if (getLocalPlayer().getTile().getZ() == 0) { log("In CookMeat task, walking toward stairs"); if (Walking.getDestinationDistance() > Calculations.random(2, 5)) { sleep(Calculations.random(900, 2750)); } else { Walking.walk(NEARSTAIRS.getRandomTile()); } } else if (getLocalPlayer().getTile().getZ() == 1) { log("In CookMeat task, climbing second set of stairs"); GameObjects.closest("Staircase").interact("Climb-up"); } else if (getLocalPlayer().getTile().getZ() == 2) { log("In CookMeat task, should have climbed stairs by now"); // time to light fire, cook, and bank if (GameObjects.closest("Fire") == null) { log("In CookMeat task, lighting fire"); while (!getLocalPlayer().isAnimating()) { GroundItems.closest("Logs").interact("Light"); sleep(2000, 3000); } if (getLocalPlayer().isAnimating()) { sleep(2000, 10000); } } else if (GameObjects.closest("Fire") != null) { GameObject fire = GameObjects.closest("Fire"); log("In CookMeat task, cooking"); while (Inventory.contains("Raw chicken")) { Inventory.get("Raw chicken").useOn(fire); WidgetChild cookall = Widgets.getWidget(270).getChild(14).getChild(38); if (cookall != null) { cookall.interact("Cook"); sleepUntil(() -> !Inventory.contains("Raw chicken"), 30000); } } if (!Inventory.contains("Raw chicken")) { log("In CookMeat task, finished cooking"); } } } return Calculations.random(300, 600); } } I've made more progress than I was expecting overall, just have to work out the cooking kinks, setup the banking and walkback and then do a few runs to work out any other issues that are lingering. I know there are a few other issues, like sometimes it gets stuck at the chickens (probably from some poor checks) but that's what I have so far.
    10. I'm working through building my first script (chicken killer) and while it mostly works, it is very bot-like and has a few glaring issues. What I want this script to be eventually: Kills chickens Loots all drops (feathers, bones, raw chicken) When inventory is full, buries bones When inventory is almost full of raw chicken, chop down nearby tree & light fire Cook all raw chicken Bank feathers & cooked chicken Repeat My general goal is to use this script as a way of familiarizing myself with many aspects of the script development process, and I'm in the initial stages currently. Right now it kills and loots, although I need help with making the looting/combat decision making process more human-like. As it is, the script will click to loot something & attack a chicken at the same time repeatedly. Here is my code so far (just the node related to killing/looting chickens): package tasks; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.filter.Filter; 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.methods.walking.impl.Walking; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; public class Chickens extends TaskNode { final Area KILLBOX = new Area(3225, 3292, 3236, 3301); int bool = 0; public static final String CHICKEN = "Chicken"; public static final Filter<NPC> CHICKEN_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { if (npc == null){ return false; } return npc.getName().equals(CHICKEN) && !npc.isHealthBarVisible(); } }; @Override public boolean accept() { // If our inventory is not full, and we're in the right area return !Inventory.isFull() && (KILLBOX.contains(getLocalPlayer())); } @Override public int execute() { log("In Chickens task"); GroundItem drops = GroundItems.closest("Feather", "Bones", "Raw chicken"); if (getLocalPlayer().isInCombat()){ // Do nothing } else if (KILLBOX.contains(getLocalPlayer())) { // If player is in the box NPC chicken = NPCs.closest(CHICKEN_FILTER); if (chicken != null && bool == 0) { // If chickens are present, & bool var is set to 0 log("In Chickens task, attacking"); chicken.interact("Attack"); } if (drops != null) { // If chicken drops are present log("In Chickens task, drops found, picking up"); drops.interact("Take"); int bool = 1; } } else { Walking.walk(KILLBOX.getRandomTile()); } return Calculations.random(300, 600); } } As I said this is my first script, and I'm sure there are plenty of obvious issues to any scripters who have more experience than me, and I really just want to know what you feel I'm doing wrong, how I can fix my looting/combat issue, and any other suggestions you may have. My goal is to make little resource scripts like this to compliment my IMG when groups is released, but I want to ensure they are high quality and not easily detectable. I haven't been banned yet, but all I've been doing is a little chicken killing here and there as I build the script, but I have a feeling if I ran this for any extended length of time I'd be banned in no time. It's very obvious as a bot with some of it's current behavior. Eventually I would like to integrate my own classes and methods to place between the dreambot API code to make things a little more human-like, but that will be down the road once I feel comfortable I have an idea how to code scripts for dreambot relatively decently. (and have more experience with Java) Looking forward to any insight you can provide, thanks! Edit: Just wanted to clarify a bit of the code as I was attempting to fix the looting/combat at the same time issue: I was trying to set a variable (bool) so it would avoid attacking if there was loot nearby to pick up. I'm sure it may not be 100% clear just from looking at my code that was my goal lol Edit2: I've modified the combat/loot process by removing the bool var and instead just adding a check if drops are present in the combat if statement. This definitely simplifies things although I would like the looting process to be a little more human-like by, instead of waiting a set amount of time, wait specifically until a new item has entered the inventory. It would also be human-like to make it spam click piles, but I'd imagine that would be something I'd need to build down the road. Here's the updated bit of code: if (chicken != null && drops == null) { // If chickens are present and drops are not log("In Chickens task, attacking"); chicken.interact("Attack"); } if (drops != null) { // If chicken drops are present log("In Chickens task, drops found, picking up"); drops.interact("Take"); sleep(2000, 3000); }
    11. Looks like the jar was loading a different version, I uninstalled everything and reinstalled the recommended 8 version in the guide and it's working again.
    12. I'm trying to get started on a script but am having some kind of issue with the Java version. I've tried rebuilding with all kinds of versions of Java, how can I tell what version DB is using? I'm assuming it's just using the system's (which is shown in cmd in the screenshot) but maybe it's not, not sure? The script doesn't show up in the script manager either so I'm not even sure if the issue is with this script or another one...
    13. Hey there guys, First off, I just want to say I absolutely love how you guys have this bot setup. Reminds me of how American Bot/Abot was setup for RSC back when I used to script, before Jagex defected to the dark side of real-time combat instead of the superior turn-based style. It seems like it would be fun to script for so I'm going to start, with a basic "Character Starter" script to learn how to do things. My current plan is to start when the name/design window is closed: so the script will complete tutorial island, and then complete either the Combat or the Skiller Adventure Path depending on the choice made in the UI. I have some longer term plans that should be pretty entertaining to build and see in-game as well, although I'm sure if I do get to that it will be a ways away. Everything I currently plan on doing is for fun and not to profit or sell anything. I'm going to use this topic to log my first script journey, also might help other newbies. If you're a more experienced scripter, what are the top 3 things you most feel someone in my position should be aware of?
    14. worked well, thanks! Edit: The account I used this on was banned, not sure what triggered it as I tried out 2 or 3 scripts, but I think this was most likely it.
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.