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
  • Tweeboy

    Lifetime Sponsor
    • Posts

      58
    • Joined

    • Last visited

    Posts posted by Tweeboy

    1. Assuming Criteria Y is never valid unless Criteria X is first valid

      You could set Leaf A's accept condition to be ((Criteria X) && (!Criteria Y))

       

      Specific to MLM what are your criteria you are trying to monitor/manage?

       

      Your boolean approach works too and may be better for monitoring the MLM sack since you can force it true, have it collect all the ore, then force it to false to go back to your miningLeaf

    2. TaskScript uses TaskNodes to perform your script's function. Instead of managing your script's logic within the main onLoop(), you will create several TaskNodes to break up the script into different tasks

      TaskNodes have three methods associated with them:

      1. boolean accept() - this is the condition that must be met in order to trigger the TaskNode.
      2. int execute() - think of your AbstractScript's onLoop(). This executes the actions/logic we actually want to perform.
      3. int priority() - allows you to prioritize your TaskNodes. By default, TaskScript will iterate through your TaskNodes in the order you add them.

       

      The script will iterate through each task (either in priority order high to low, or in order that they've been added). If the accept() condition is found to be valid, the script will loop through that TaskNode's execute().

       

      I will use a basic woodcutting script as an example. In the onStart() of our main class, we will need to add our nodes:

          @Override
          public void onStart() {
              addNodes(new BankTask(), new DropTask(), new ChopTask());
          }

       

      First the script would iterate through our BankTask. So long as the conditions of accept() are found to be true, we will loop through BankTask.execute(). Once we've deposited our logs, this TaskNode will no longer be true (inventory is NOT full) and the script will move onto the next TaskNode:

      public class BankTask extends TaskNode {
      
          @Override
          public boolean accept() {
              return Inventory.isFull() && !isDrop; //isDrop is an internal boolean determined by the user within the GUI  
          }
      
          @Override
          public int execute() {
      	//Logic for Banking & depositing logs
              return 1000;
          }
      }

       

      Then the script would iterate through your DropTask, depending on the state of boolean isDrop:

      public class DropTask extends TaskNode {
      
          @Override
          public boolean accept() {
              return Inventory.isFull() && isDrop; //isDrop is an internal boolean determined by the user within the GUI  
          }
      
          @Override
          public int execute() {
      	//Logic for Dropping inventory of logs
              return 1000;
          }
      }

       

      If neither of our above TaskNodes return a valid accept() condition, the script would move onto the ChopTask(). In this example, I left the accept() as true since I know the script will only get to this node, if DropTask & BankTask are NOT valid. You're welcome to add a condition to be met (for example, verifying treeArea.contains(Players.getLocal()) )

      public class ChopTask extends TaskNode {
      
          @Override
          public boolean accept() {
              return true;
          }
      
          @Override
          public int execute() {
      	//Logic for Walking to the tree location & chopping desired tree
              return 1000;
          }
      }

       

      Once you've flushed out the execute() logic in each, and add your nodes in the Main class onStart(), TaskScript will handle the rest.

      It will loop through BankTask>DropTask>ChopTask, checking to see which one returns accept() first, and then run the appropriate execute()

       

      If you so choose, you could break out the script logic into even more tasks (Bank, Drop, Travel, Chop, Idle). Some people may find this excessive. Do whatever you find easiest. I personally like breaking down my script into smaller tasks and will opt to use either TaskScript or TreeScript. Similar to the previous poster, I learned using TreeScript at first (specifically this implementation), but I do find it overkill for simple scripts and have been using TaskScript far more often now.

      • In TaskScript, your script logic is executed within each TaskNode. The script will check Task accept() > Task execute() if valid
      • In TreeScript, your script logic is executed within each Leaf, which are stored in Branches. The script will check the Branch accept() > check the Leaf accept() if valid > Leaf execute() if valid.
    3. The snippets you've shared are a bit scattered, would need you to share a larger snippet to confirm issue

       

      You could condense that down to something like:

       

              if (!Inventory.contains("Grain")){
                  if (!wheatArea.contains(Players.getLocal())){
                      if (Walking.shouldWalk(5)){
                          Walking.walk(wheatArea.getRandomTile());
                      }
                  } else {
                      GameObject wheat = GameObjects.closest("Wheat");
                      if (wheat != null && wheat.interact()){
                          Sleep.sleepUntil(() -> Inventory.contains("Grain"), 2000);
                      }
                  }
              }

       

    4. 13 hours ago, 40 Cubic 2 said:

      Something is wrong with this script when i do alcing and teleing to varrock at the same time. It misclicks on the teleport quite a bit and i tihnk it got one of my accounts banned but please fix the script when u get a chance, thanks.

      It like exits out of the inventory then clicks on the ground instead of the varrock tele idk what the hells goin on.

      I am running it now (Tele-Alching in Varrock) and am unable to reproduce this issue. I will leave it running for the next few hours through my work calls.

       

      Can you please share your DreamBot client settings? And it shouldn't matter but - what were you trying to alch? I would like to try to reproduce your exact run conditions.

       

      Please ensure you enter everything in the GUI properly (alch item is case sensitive - type it EXACTLY as it appears in game)

    5. Keep in mind there's a Prime Event going on at the moment (ends in ~1 month from today), ban rates are typically higher during this time as a lot of prime accounts flood the game

       

      Regardless just Trial & Error, just keep mixing it up and see what works for you

    6. 5 hours ago, Vinny143 said:

      Didn't work.

      The steps I did were:

      - Login

      - Manually open bank

      - Close bank

      - Run script

      Still gave me false for every test.

      To my knowledge, the script itself will need to access the bank to know what's inside. You manually opening and closing bank before running the script = the script does not know what's in the bank and will just return false. To verify this you can move that snippet from your onStart() to the onLoop(). Once you've started the script enable user input and open & close your bank. Your test should now return true.

       

      What are you trying to achieve with this code? It may be easier to check if the Bank contains those items within your bank node instead of the onStart method.

       

      So your bank node could have something like:

              if (Bank.open()){
                  if (Bank.contains(cookingItem)){
                      Bank.withdrawAll(cookingItem.getName());
                  } else {
                      log("No more raw fish, ending script");
                      return -1;
                  }
              }

       

    7. On 4/17/2023 at 5:10 AM, Tovenaar said:

      it gets stuck in draynor :)

      Did you have Menu Manipulation enabled?

       

      Seems to get stuck at Draynor Village with Menu Manipulation enabled. No issues when disabled though!

       

      Specifically over the below obstacle

      CqeuRMr.png

       

      When Menu Manipulation is enabled, the script will attempt to interact with the NEXT obstacle (Jump Gap) while still in the middle of climbing up the above wall. That eventually times out and the script attempts to interact again, only it tries to interact with the same Wall as before

      9d16jTg.png 

       

      I've been able to recreate this every lap with Menu Manipulation enabled

    8. 7 hours ago, blackbandan said:

      So i've made edits to the MiningTask in order to try and debugg, this is what I now have:

      The log is spamming "No available rocks found. Waiting...", meaning getClosestRock is returning Null even though I'm standing right near Copper rocks. Any ideas?

      package main.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.methods.interactive.Players;
      import org.dreambot.api.script.TaskNode;
      import org.dreambot.api.utilities.Sleep;
      import org.dreambot.api.wrappers.interactive.GameObject;

      public class MiningTask extends TaskNode {
      @Override
      public boolean accept() {
      boolean accept = !Inventory.isFull() && !isMining();
      log("MiningTask accept called, returned: " + accept);
      return accept;
      }

      @Override
      public int execute() {
      log("MiningTask execute called");
      GameObject rock = getClosestRock();

      // If there aren't any available rocks near us, we should just wait until one's available
      if (rock == null) {
      log("No available rocks found. Waiting...");
      return Calculations.random(500, 1000);
      }

      if (rock.interact("Mine")) { // If we successfully click on the rock
      log("Started mining a rock.");
      Sleep.sleepUntil(this::isMining, 2500); // Wait until we're mining, with a max wait time of 2,500ms (2.5 seconds)
      } else {
      log("Failed to interact with the rock.");
      }

      return Calculations.random(500, 1000);
      }

      /**
      * Finds the closest acceptable rock that we can mine
      *
      * @return The closest GameObject that has the name 'Rocks', with the action 'Mine', and non-null model colors
      */
      private GameObject getClosestRock() {
      GameObject rock = GameObjects.closest(object -> object.getName().equalsIgnoreCase("Rocks") && object.hasAction("Mine") && object.getModelColors() != null);
      log("getClosestRock called, returned: " + (rock != null ? rock.getName() : "null"));
      return rock;
      }

      /**
      * For part 1, we'll consider our player doing any animation as mining
      * This will be improved/changed in a future part
      *
      * @return true if the player is mining, otherwise false
      */
      private boolean isMining() {
      return Players.getLocal().isAnimating();
      }
      }

      Mining rocks were renamed since this guide was written - you're code is looking for an object named "Rocks", but all that's nearby are "Copper rocks"

    9. 6 hours ago, GreenAgent500 said:

      Got stuck after filling first inventory with shrimp. Waited over 2 mins just kept spinning camera around and around.

      This will be fixed in next Version :) pushing update now. Going to test it some more now

      Seems script only worked with Menu Manipulation enabled

      acoWdJr.png

      This is from the SDN version (paint bugged out for some reason so cleaning that up as well)

       

    10. I needed to get some early cooking levels on several accounts and wanted to do so without needing to trade anything over. This was my solution.

      This script will Fish and Cook Shrimp/Anchovies in Al Kharid. 

      Requires small fishing net in Inventory to start

      STRONGLY RECOMMENDED to be 29 combat to avoid the wandering Scorpion from sending you to Lumbridge. Script does NOT support avoiding this scorpion...

       

      Progress Reports

      Spoiler

      image.png.2f9fe125d5cefcd6bf831c506aad4223.png

      dUKD18V.png

      6433EUR.png

      VHExINP.png

       

    11. Simple script that will cast Teleports, Curse, or Alch (high/low). Supports any combination of the three! 

      I had written this originally with the intentions to do all 3 at once, but modified the script a bit to support doing any combination of the 3.

      Script will stop when out of runes. 

       

      NOTE: While the script is free to use it is STRONGLY recommended to have Menu Manipulation enabled if you're doing a combination of spells. This is a VIP feature.

       

      gboQbXe.png

       

      Instructions:

      Spoiler
      1. Check the boxes to select which spells the script will use to train with
      2. (If Tele selected) select the teleport spell you wish to use. Currently only supports F2P teleports.
      3. (If Curse selected) enter the name of the NPC you wish to cast curse on. CASE SENSITIVE, type this EXACTLY as it appears in game. NOTE: For best results, try to start the script with  the NPC already attacking you.
      4. (If Alch selected) enter the name of the item you wish to alch. CASE SENSITIVE, type this EXACTLY as it appears in game. Script will High or Low ZAlch depending on your magic level.

       

      Progress Reports

      Spoiler

      Tele/Alch/Curse (need menu manipulation to hit full xp rate, not recommended to run for long periods of time)

      image.png.f81a2afc8f98387a3afe06bc98b703f3.png

       

      Tele/Alch (recommended)

      QVacYRE.png

      5bWyvma.png

      VL4OmLs.png

       

    12. 2 hours ago, archfiend said:
      Walking.walk(wizardsTower);
              if(wizardsTower.contains(player)){
                  GameObject ladder = getGameObjects().closest("Ladder");
                  // Interact with the ladder
                  if (ladder != null) {
                      ladder.interact("Climb-up");
      
                  }
              }

      The getGameObjects isnt supported. How would I climb up a ladder? This is the hard part for part of the script.. After this is pretty much smooth sailing.

       

      So I just realize.... Im not climbing up ladders im climb up stair cases....

      but if I would to climb up a ladder it would look like something like this ?
       

      if(!wizardsTower.contains(player) ){
                  Walking.walk(wizardsTower);
              }
              if(wizardsTower.contains(player)){
                  GameObject ladder = closest("ladder");
                  // Interact with the ladder
                  if (ladder != null) {
                      ladder.interact("Climb-up");
      
                  }
              }


      So i think i gotta switch "ladder" with "staircase"....
      ---------------------------------------------------------------------------------------------------------------------------------------

      Since the post of this project there seems to be a pandemic of bots at wizards tower.... sad... cat is out of the bag.... some one beat me to it... Hmmm.

      https://dreambot.org/javadocs/org/dreambot/api/methods/interactive/GameObjects.html

      Recommend looking through the docs, lots of useful information in there

      GameObject ladder = GameObjects.closest("Staircase");

       

    13. I've been using this to get 10QP on my accounts, overall great script! Usually this is able to complete all 3 quests for me without any issues. 

      I have the most success running this on accounts that already have some stats & playtime.

       

      Some issues I've come across:

      • Cooks Assistant - same issue as above . Sometimes it works just fine, but other times it gets stuck repeatedly pulling the hopper lever. If I pause the script, go down, and collect the flour manually it'll continue just fine
      • Romeo & Juliet - Occasionally gets stuck continuing through dialogues. Happens less often than Cooks Assistant issue. Seems to be more common when delivering love letter to Romeo & talking to Apothecary. 

       

       

    ×
    ×
    • 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.