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
  • Search the Community

    Showing results for tags 'open source'.

    • Search By Tags

      Type tags separated by commas.
    • Search By Author

    Content Type


    Forums

    • Requests
    • DreamBot
      • Announcements
      • Client Support
      • Site Support
    • Community
      • General Discussion
      • Runescape
      • Spam
      • Applications
    • Scripts
      • SDN Scripts
      • Local Scripts
      • Private Scripting Shops
      • Script Requests
      • Script Management
    • Development
      • Scripting
      • Programming
    • Market
      • Vouchers / Store Credit
      • Middleman Services
      • Gold Exchange
      • Membership Sales
      • Account Sales
      • Item Exchange
      • Services
      • Graphics
      • Other
    • Management
      • Disputes
      • Appeals
      • Archive

    Find results in...

    Find results that contain...


    Date Created

    • Start

      End


    Last Updated

    • Start

      End


    Filter by number of...

    Joined

    • Start

      End


    Group


    Website URL


    Discord


    Skype


    Location


    Interests

    Found 4 results

    1. After seeing people in the EDU discord requesting an example of a "tree branch framework" script I've decided to make my woodcutting script open source. https://github.com/StanlyLife/LuxeLiteWoodcutting I learned tree branch framework by looking at examples from other open-source projects and hopefully, this repository will help others to write with TreeScript instead of AbstractScript and write better scripts. Any questions are welcome. if you want to try the script you can find it here
    2. import org.dreambot.api.input.Mouse; import org.dreambot.api.input.event.impl.mouse.MouseButton; import org.dreambot.api.input.mouse.algorithm.MouseAlgorithm; import org.dreambot.api.input.mouse.destination.AbstractMouseDestination; import org.dreambot.api.methods.Calculations; import org.dreambot.api.utilities.Logger; import java.awt.*; import java.util.Random; /** * Open source Mouse Algorithm using Kochanek-Bartels splines */ public class KochanekBartelsMouse implements MouseAlgorithm { private final double tension; private final double bias; private final double continuity; private Random random = new Random(); public KochanekBartelsMouse(double tension, double bias, double continuity) { this.tension = tension; this.bias = bias; this.continuity = continuity; } @Override public boolean handleMovement(AbstractMouseDestination abstractMouseDestination) { Point suitPos = abstractMouseDestination.getSuitablePoint(); mouseMovement(suitPos); return distance(Mouse.getPosition(), suitPos) < 2; } @Override public boolean handleClick(MouseButton mouseButton) { return Mouse.getDefaultMouseAlgorithm().handleClick(mouseButton); } public static void sleep(int min, int max) { try { Thread.sleep(Calculations.random(min, max)); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } public static void sleep(int ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } /** * Enhanced mouse movement using Kochanek-Bartels splines * * @param point The destination point */ public void mouseMovement(Point point) { Point curPos = Mouse.getPosition(); moveMouseSpline(curPos, point); // Directly move to the target point } /** * Generate control points for Kochanek Bartels spline * * @param start The start point * @param end The end point * @return Array of control points */ private Point[] generateControlPoints(Point start, Point end) { Point[] controlPoints = new Point[4]; controlPoints[0] = start; controlPoints[3] = end; int midX = (start.x + end.x) / 2; int midY = (start.y + end.y) / 2; // Adjusting control points to create more noticeable curves controlPoints[1] = new Point(midX + random.nextInt(200) - 100, midY + random.nextInt(200) - 100); controlPoints[2] = new Point(midX + random.nextInt(200) - 100, midY + random.nextInt(200) - 100); return controlPoints; } /** * Move mouse using a Kochanek Bartels spline * * @param start The start point * @param end The end point */ private void moveMouseSpline(Point start, Point end) { Point[] controlPoints = generateControlPoints(start, end); int steps = Calculations.random(50, 100); // Increase steps for smoother curves for (int i = 0; i <= steps; i++) { double t = (double) i / (double) steps; Point p = kochanekBartelsSpline(controlPoints, t); Mouse.hop(p); try { Thread.sleep(Calculations.random(5, 15)); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } } /** * Calculate a point on a Kochanek Bartels spline * * @param points The control points * @param t The parameter t (0 <= t <= 1) * @return The point on the spline at parameter t */ private Point kochanekBartelsSpline(Point[] points, double t) { double t2 = t * t; double t3 = t2 * t; double h1 = 2 * t3 - 3 * t2 + 1; double h2 = -2 * t3 + 3 * t2; double h3 = t3 - 2 * t2 + t; double h4 = t3 - t2; Point p0 = points[0]; Point p1 = points[3]; Point p2 = points[1]; Point p3 = points[2]; double m0x = (1 - tension) * (1 + bias) * (1 + continuity) * (p2.x - p0.x) / 2 + (1 - tension) * (1 - bias) * (1 - continuity) * (p3.x - p1.x) / 2; double m0y = (1 - tension) * (1 + bias) * (1 + continuity) * (p2.y - p0.y) / 2 + (1 - tension) * (1 - bias) * (1 - continuity) * (p3.y - p1.y) / 2; double m1x = (1 - tension) * (1 - bias) * (1 + continuity) * (p3.x - p1.x) / 2 + (1 - tension) * (1 + bias) * (1 - continuity) * (p3.x - p2.x) / 2; double m1y = (1 - tension) * (1 - bias) * (1 + continuity) * (p3.y - p1.y) / 2 + (1 - tension) * (1 + bias) * (1 - continuity) * (p3.y - p2.y) / 2; int x = (int) (h1 * p0.x + h2 * p1.x + h3 * m0x + h4 * m1x); int y = (int) (h1 * p0.y + h2 * p1.y + h3 * m0y + h4 * m1y); return new Point(x, y); } public double distance(Point p1, Point p2) { return Math.sqrt((p2.y - p1.y) * (p2.y - p1.y) + (p2.x - p1.x) * (p2.x - p1.x)); } } KochanekBartelsMouse.java
    3. import org.dreambot.api.Client; 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.container.impl.equipment.Equipment; import org.dreambot.api.methods.interactive.NPCs; import org.dreambot.api.methods.interactive.Players; 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.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Sleep; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; import org.dreambot.api.wrappers.items.Item; import java.awt.*; import static org.dreambot.api.methods.Calculations.random; @ScriptManifest(author = "Deep Slayer", name = "F2P Hill Giant Killer", version = 1.0, description = "Kills and loots Hill Giants", category = Category.COMBAT) public class GiantBoneCollector extends AbstractScript { private final Area hillGiantArea = new Area(3102, 9823, 3124, 9854, 0); private final Area bankArea = new Area(3159, 3487, 3168, 3484, 0); String food = "Tuna"; int foodAmount = 15; String weapon = "Mithril Scimitar"; private enum State { EATING, CHECK_GEAR, GET_KEY, TRAVEL_TO_HILL_GIANTS, FIGHT_HILL_GIANTS, LOOTING, BANKING, IDLE } private State getState() { if (shouldEat()) { return State.EATING; } if (!hasRequiredGear() || !hasBrassKey()) { return State.CHECK_GEAR; } if (shouldTravelToHillGiants()) { return State.TRAVEL_TO_HILL_GIANTS; } if (shouldFightHillGiants()) { return State.FIGHT_HILL_GIANTS; } if (shouldLoot()) { return State.LOOTING; } if (shouldBank()) { return State.BANKING; } return State.IDLE; } public void onStart() { } @Override public int onLoop() { switch (getState()) { case EATING: eatFood(); break; case CHECK_GEAR: checkGear(); break; case GET_KEY: getKey(); break; case TRAVEL_TO_HILL_GIANTS: travelToHillGiants(); break; case FIGHT_HILL_GIANTS: fightHillGiants(); break; case LOOTING: lootItems(); break; case BANKING: bankItems(); break; case IDLE: idle(); break; } return random(200, 300); } private boolean checkGear() { // Check if the Scimitar is in the player's inventory if (Inventory.contains(weapon)) { log("cimitar is in the inventory."); // Attempt to equip the Scimitar Item scimitar = Inventory.get(weapon); if (scimitar != null && scimitar.interact("Wield")) { log("Equipped Scimitar."); return true; } } // Check if the Scimitar is equipped if (Equipment.contains(weapon)) { log(" Scimitar is already equipped."); return true; } // Check if the Scimitar is in the bank if (Bank.isOpen() || Bank.open()) { if (Bank.contains(weapon)) { log("Scimitar is in the bank. Withdrawing and equipping..."); // Ensure there's enough space in the inventory if (!Inventory.isFull() || Inventory.contains("Coins")) { if (Bank.withdraw(weapon, 1)) { Bank.close(); Sleep.sleepUntil(() -> !Bank.isOpen(), 5000); // Wait for the bank to close Item scimitarInInv = Inventory.get(weapon); if (scimitarInInv != null && scimitarInInv.interact("Wield")) { log("Equipped Scimitar from bank."); return true; } } else { log("Failed to withdraw Scimitar. Ensure inventory space."); } } else { log("Not enough space in inventory to withdraw Scimitar."); } } } // If Scimitar is not found in inventory, equipment, or bank log(" Scimitar not found. Stopping script."); this.stop(); return false; } private void getKey() { String brassKey = "Brass key"; // Check if the Brass Key is in the player's inventory if (Inventory.contains(brassKey)) { log("Brass Key is in the inventory."); return; } // Check if the Brass Key is in the bank if (Bank.isOpen() || Bank.open()) { if (Bank.contains(brassKey)) { log("Brass Key is in the bank. Withdrawing..."); if (Bank.withdraw(brassKey, 1)) { log("Brass Key withdrawn from the bank."); // Optional: Close the bank after withdrawing the key Bank.close(); return; } else { log("Failed to withdraw Brass Key. Ensure inventory space."); this.stop(); return; } } } // If Brass Key is not found in inventory or bank log("Brass Key not found. Stopping script."); this.stop(); } private void travelToHillGiants() { log("Traveling to the Hill Giants location..."); // Check if we are already in the Hill Giants area if (hillGiantArea.contains(Players.getLocal())) { log("Arrived at the Hill Giants area."); return; } // Walking to the Hill Giants area if (Walking.shouldWalk()) { Walking.walk(hillGiantArea.getRandomTile()); } } private void fightHillGiants() { NPC hillGiant = NPCs.closest(giant -> giant != null && giant.getName().equals("Hill Giant") && giant.canAttack()); if (hillGiant != null && !Players.getLocal().isInCombat()) { if (hillGiant.interact("Attack")) { log("Engaging with Hill Giant."); Sleep.sleepUntil(() -> !hillGiant.isHealthBarVisible() || hillGiant.exists(), random(1200, 2000)); } } else { log("No Hill Giants available to attack or already in combat."); sleep(random(600, 800)); } } private void lootItems() { // Define the items you want to loot String[] lootableItems = {"Big bones", "Uncut sapphire", "Limpwurt root", "Cosmic rune", "Chaos rune","Nature rune", "Law rune"}; // Replace with actual items for (String itemName : lootableItems) { GroundItem item = GroundItems.closest(itemName); if (item != null && item.isOnScreen()) { if (Inventory.isFull()) { eatFoodToMakeSpace(); // Call method to eat food to make space } if (item.interact("Take")) { log("Looting: " + itemName); Sleep.sleepUntil(() -> !item.exists(), Calculations.random(5000, 8000)); } } } } private void eatFoodToMakeSpace() { if (Inventory.contains(food)) { Inventory.interact(food, "Eat"); log("Eating food to make space for loot."); Sleep.sleepUntil(() -> !Inventory.isFull(), Calculations.random(800, 1200)); } else { log("No food available to eat for making space."); } } private void bankItems() { log("Banking items..."); // Navigate to the bank if (!bankArea.contains(Players.getLocal())) { log("Traveling to the bank..."); if (Walking.shouldWalk()) { Walking.walk(bankArea.getRandomTile()); } } // Interact with the bank if (bankArea.contains(Players.getLocal())) { if (Bank.open()) { log("Bank opened. Depositing items..."); Bank.depositAllItems(); Sleep.sleepUntil(Inventory::isEmpty, random(1000, 2000)); // Retrieve necessary items like food and gear here, if needed Bank.withdraw("Brass key");; sleep(500,1000); Bank.withdraw(food,foodAmount); } } } private void eatFood() { if (Inventory.contains(food)) { Inventory.interact(food,"Eat"); log("Eating food for health."); Sleep.sleepUntil(() -> Players.getLocal().getHealthPercent() > random(50,60), random(1000, 2000)); } } private void idle() { // Implement idle behavior / antiban stuff } private boolean shouldEat() { // Example condition: eat if health is below 50% return Players.getLocal().getHealthPercent() < 50 && Inventory.contains(food); } private boolean hasRequiredGear() { // Check if the Scimitar is equipped if (Equipment.contains(weapon)) { log("Player has the required gear: " + weapon); return true; } else { log("Player does not have the required gear: "+ weapon); return false; } } private boolean hasBrassKey() { String brassKey = "Brass key"; // Check if the Brass Key is in the player's inventory if (Inventory.contains(brassKey)) { log("Player has the Brass Key."); return true; } else { log("Player does not have the Brass Key."); return false; } } private boolean shouldTravelToHillGiants() { // Check if already in the Hill Giants area if (hillGiantArea.contains(Players.getLocal())) { log("Already in the Hill Giants area."); return false; } // Check if the inventory contains the Brass Key if (!Inventory.contains("Brass key")) { log("Brass key is missing. Cannot travel to Hill Giants."); return false; } // Check if the inventory contains food if (!Inventory.contains(food)) { log("Food is missing. Cannot safely travel to Hill Giants."); return false; } // All conditions met, should travel to Hill Giants return true; } private boolean shouldFightHillGiants() { // Ensure we are in the Hill Giants area if (!hillGiantArea.contains(Players.getLocal())) { log("Not in the Hill Giants area."); return false; } // Check if there are Hill Giants available to fight NPC hillGiant = NPCs.closest(giant -> giant != null && giant.getName().equals("Hill Giant") && giant.canAttack()); if (hillGiant == null) { log("No Hill Giants available to fight."); return false; } // Check if the player is already in combat if (Players.getLocal().isInCombat()) { log("Already in combat."); return false; } // Check if the player has enough health if (Players.getLocal().getHealthPercent() < 50) { log("Health too low to safely engage in combat."); return false; } // Check if the player has enough food if (!Inventory.contains(food)) { // Replace "food" with your actual food item log("Not enough food to continue fighting."); return false; } // All conditions met to fight Hill Giants return true; } private boolean shouldLoot() { // Define the items you consider valuable for looting String[] valuableItems = {"Big bones", "Item2", "Item3"}; // Replace with actual valuable items from Hill Giants // Check if lootable items exist and i have food if(Inventory.contains(food)) { for (String itemName : valuableItems) { GroundItem item = GroundItems.closest(itemName); if (item != null && item.isOnScreen()) { log("Valuable item found on the ground. Time to loot: " + itemName); return true; } } } log("No items to loot"); return false; } private boolean shouldBank() { // Check if the player is out of food if (!Inventory.contains(food)) { log("Out of food, time to bank."); return true; } // Other conditions can be added here if needed, like checking the inventory for loot space return false; } }
    ×
    ×
    • 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.