Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/03/21 in all areas

  1. Just a cool concept that I had thought of that may come in handy for people attempting to do large projects. This is relatively beginner Java but I thought I'd share because I found it to be somewhat interesting when I thought of the idea. Below is a snippet of code of the Main Script subclass with the @ScriptManifest annotation and a TestScript class. You should only ever use the annotation once in the Main class. You can set the runnable script either with a GUI or CLI args. This concept would enable large projects sorted by packages that contain multiple different scripts to be accessed this way in the same script. I would consider doing something like this for an Ironman kind of script that did a lot of different activities. package core; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(version = 0.0, logo = "", info = "", name = "Ironman", author = "Malcolm") public class Main extends Script { private Script runnableScript; public void onStart() throws InterruptedException { this.runnableScript = new TestScript(); this.runnableScript.exchangeContext(getBot()); this.runnableScript.onStart(); } @Override public int onLoop() throws InterruptedException { return this.runnableScript.onLoop(); } public void onExit() throws InterruptedException { this.runnableScript.onExit(); } public void onPaint(Graphics2D g) { this.runnableScript.onPaint(g); } } package core; import org.osbot.rs07.script.Script; import java.awt.*; public class TestScript extends Script { private Paint paint; @Override public void onStart() { this.paint = new Paint(this); log("Test Script onStart"); } @Override public void onExit() { log("Test Script onExit"); } @Override public int onLoop() throws InterruptedException { log("RUNNING TEST SCRIPT"); return 100; } @Override public void onPaint(Graphics2D g) { this.paint.paint(g); } }
    4 points
  2. 1. Define your custom method provider, this extends OSBot's MethodProvider class, and then adds on / overrides functionality. In this example, I am overriding getInventory() with my own class which adds a "use" function. The CustomMethodProvider class defined below also supplies a custom "execute" function, which runs an Executable (a different class I have defined later) class CustomMethodProvider extends MethodProvider { private ExtendedInventory extendedInventory; private boolean hasContext; public void init(final Bot bot) { super.exchangeContext(bot); this.extendedInventory = new ExtendedInventory(); extendedInventory.exchangeContext(bot); hasContext = true; } public boolean hasContext() { return hasContext; } // Deprecated as exchangeContext(Bot bot, CustomMethodProvider methodProvider) should be used instead. @Deprecated public MethodProvider exchangeContext(final Bot bot) { return super.exchangeContext(bot); } public CustomMethodProvider exchangeContext(final Bot bot, final CustomMethodProvider methodProvider) { this.extendedInventory = methodProvider.extendedInventory; super.exchangeContext(bot); hasContext = true; return this; } @Override public ExtendedInventory getInventory() { return extendedInventory; } /** * Helper function which exchanges context with an Executable * (if not already exchanged), and then calls Executable::run * @param executable The Executable to execute * @throws InterruptedException */ public void execute(final Executable executable) throws InterruptedException { if (!executable.hasContext()) { executable.exchangeContext(getBot(), this); } executable.run(); } } Here is my "ExtendedInventory" class: class ExtendedInventory extends Inventory { public boolean isUsing(final String itemName) { return itemName.equals(getSelectedItemName()); } public boolean use(final String itemName) { if (isUsing(itemName)) { return true; } if (getInventory().interact("Use", itemName)) { Sleep.sleepUntil(() -> itemName.equals(getSelectedItemName()), 1000); return true; } return false; } } 2. Define the Executable class, this is what we will use for other classes in our script that have a common "onStart" / "onLoop" / "onEnd" pattern: abstract class Executable extends CustomMethodProvider { public void onStart() throws InterruptedException {} public abstract void run() throws InterruptedException; public void onEnd() throws InterruptedException {} } Note how this class extends our CustomMethodProvider, which means anything we define in the CustomMethodProvider class will be available to subclasses of "Executable" 3. In the main script class, set everything up (create an instance of CustomMethodProvider, and exchange context) @ScriptManifest(author = "Explv", name = "Example", info="", logo = "", version = 0.1) public class Example extends Script { private final CustomMethodProvider customMethodProvider = new CustomMethodProvider(); @Override public void onStart() { customMethodProvider.init(getBot()); } @Override public int onLoop() throws InterruptedException { return 0; } } 4. Finally, whenever you want some other class with an onStart / onLoop / onEnd, just extend the Executable class, and then run it using "execute". Here is a very contrived example: class ExampleExecutable extends Executable { private static final String TINDERBOX = "Tinderbox"; private final Executable someOtherExecutable = new SomeOtherExecutable(); @Override public void run() throws InterruptedException { if (!getInventory().isUsing(TINDERBOX)) { getInventory().use(TINDERBOX); } else { execute(someOtherExecutable); } } } class SomeOtherExecutable extends Executable { @Override public void run() throws InterruptedException { getWalking().webWalk(new Area(1, 2, 3, 4)); } } @ScriptManifest(author = "Explv", name = "Example", info="", logo = "", version = 0.1) public class Example extends Script { private final CustomMethodProvider customMethodProvider = new CustomMethodProvider(); private final Executable exampleExecutable = new ExampleExecutable(); @Override public void onStart() { customMethodProvider.init(getBot()); } @Override public int onLoop() throws InterruptedException { customMethodProvider.execute(exampleExecutable); return 600; } } 5. If you want an "Executable" that blocks until completion, then you can either use OSBot's Event class, or define your own "BlockingExecutable" which utlises OSBot's Event, for example: public abstract class BlockingExecutable extends Executable { private boolean finished; private ExecutionFailedException executionFailedException; @Override public final void run() throws InterruptedException { finished = false; executionFailedException = null; onStart(); execute(new Event() { @Override public int execute() throws InterruptedException { if (finished) { setFinished(); } else { try { blockingRun(); } catch (ExecutionFailedException executionFailedException) { BlockingExecutable.this.executionFailedException = executionFailedException; setFailed(); } } return 0; } }); onEnd(); if (executionFailedException != null) { throw executionFailedException; } } protected abstract void blockingRun() throws InterruptedException; protected void setFinished() { finished = true; } } public class ExecutionFailedException extends RuntimeException { public ExecutionFailedException(String message) { super(message); } }
    4 points
  3. KO Rune Dragon Requirements: DS2 Quest Completed Mounted Digsite pendant in POH Ring of Dueling Digsite pendant Any Jewelry Box in POH Rune Pouch with runes for Alching How to Setup: Settings: (If Alching is selected) Alch spell warning to 175k+ POH: (If using POH Teleport method) Have rooms next to each other (Only need pool/Jewelry Box/Mounted bigsite pendant) Gear: **Use Insulated Boots** Follow the wiki for reset of gear Bug report: Mirror mode/Inject - Copy and paste Logs - Describe what it is doing - Working on: Let me know what you want added! Proggies: Updates: Join my discord for the most recent updates/proggies! Only $7.99! Click Here!
    2 points
  4. β™”CzarScripts #1 Bots β™” Proven the #1 selling, most users, most replies Script Series on the market. Big THANK YOU to all our wonderful users and supporters over the 8 years, we couldn't have done it without you. Czar Bots have always been the Best and the most Feature-rich bots available with the most total sales in OSBot history. Come and find out why everyone is choosing Czar Bots today. β™” LATEST BOTS β™” If you want a trial - just post the script name and it will be activated after I hit 'like' on your post Requirements: hit 'like' on this thread
    1 point
  5. Price: ONLY $3.50 FOR A LIFETIME PURCHASE Only have RSGP? Buy an OSBot voucher HERE. COMMENT ON THE THREAD FOR A 1 TIME 12 HOUR TRIAL Description This script will use bones on the Chaos altar located in level 38 wilderness. This is a popular method for training prayer as the altar has a 50% chance of not consuming your bone, meaning that if you use 100 dragon bones on it, you are going to get roughly 200 dragon bones worth of exp. The rate of exp is the same as using bones on a gilded altar in a players house with 2 lit incenses, but at half the cost. Features Burning amulet support Banking at Edgeville / Gnome Stronghold / Lumbridge Customisable amount of bones and coins to bring Can walk to level 30 wilderness and teleport with an amulet of glory, or a grand seed pod (requires MM2 completion). Can take the Wine of zamorak until it dies, respawning close to the Lumbridge bank Detects nearby players and will hop worlds quickly if they are able to attack you Fast mode (Uses bones on the altar constantly for much faster exp rates) Adjustable script speeds Auto detects which bank you should use. (Goes by what you have in your inventory when the script starts. Glory = Edgeville, Pod = Gnome Stronghold) Risks Deep wilderness is a very dangerous place, and while I have implemented features to try and avoid as much loss as possible, I can't stop everything. If you use this script for a long time, chances are you are going to die a few times. I have also implemented hard caps on the amount of bones you can bring per trip, this varies per bone type. DO NOT RUN THIS SCRIPT WITH ANY VALUABLES EQUIPPED / IN YOUR INVENTORY.
    1 point
  6. Eagle Scripts' AIO Farming What is AIO Farming AIO Farming is a fully customizable Farming Script that helps you gain those Farming Levels What does AIO Farming support - Fully Customizable* - Profile System - Caching System** - Uses Tool Leprechaun To Note Items - Logs Out After All Patches Are Done. Once Any Patch Needs Any Interaction, The Script Will Login. * The User can choose what locations to farm on, what patches to work with and what plants to farm on specific patches ** As long as you're using profiles, the script will utilize data from any previous script runs Discord https://discord.gg/xhsxa6g Progress Reports Locations Supported - Ardougne - Brimhaven - Canifis - Catherby - Falador - Farming Guild - Kourend - Lletya - Lumbridge - Varrock - Tree Gnome Stronghold - Tree Gnome Village - Tai Bwo Wannai Plants Supported - All Herbs - All Allotments - All Trees - All Fruit Trees - Calquat Tree - All Cacti - Flowers (Marigold & Nasturtium, Limpwurt) Instructions GUI Startup Make sure to: Select a FarmingLocation, add FarmingPatches to it, choose a TraversingMethod and thΓ©n add the actual FarmingLocation to the queue. Please note that this script does not support the spellbook for traversing. CLI Startup The script's Id is 986. The script's only CLI parameter is the profile name that you'd like to load. Beware: The name can not contain any spaces. Changelog
    1 point
  7. Don't forget to grab a free week trial with OSBot's special promotion! Happy Holidays! - Project
    1 point
  8. That's intentional, it lets you override once the recommended button is off EDIT: It's mainly due to resources, 50ms will use up more resources than 1000ms since it refreshes a lot more frequently
    1 point
  9. I'd have to recommend against doing this. Should either do as Explv said and extend MethodProvider, or take advantage of the Event system. import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(version = 0.0, author = "", info = "", logo = "", name = "Script Class") public class Main extends Script { @Override public int onLoop() throws InterruptedException { execute(new ExtensionClass()); return 600; } } import org.osbot.rs07.canvas.paint.Painter; import org.osbot.rs07.event.Event; import java.awt.*; public class ExtensionClass extends Event implements Painter { @Override public void onStart() throws InterruptedException { log("Looping class starting"); getBot().addPainter(this); } @Override public int execute() throws InterruptedException { log("I am a self contained looping class"); return 600; } @Override public void onEnd() throws InterruptedException { log("Looping class ending"); getBot().removePainter(this); } @Override public void onPaint(Graphics2D g) { g.drawString("Looping class painting", 10, 330); } }
    1 point
  10. I bought this script tried a few quests 10/10
    1 point
  11. 1 point
  12. Liked, could i get a trail? Thanks
    1 point
  13. Hey Czar, looks great! Would love a trial, trying to decide what magic script would work best to get my main up.
    1 point
  14. EDIT: Oddly enough, it is working fine now. Please disregard, sorry! Hey Token, I'm getting a "failed to withdraw item" on every single item, regardless of where they are in my bank: getting herb farming supplies getting rake withdrawing item: 1 Rake failed to withdraw item And it just repeats ad-infinitum. Weird, because I tried it a couple days ago and it worked no problem.
    1 point
  15. One of the better scripts i've seen for mining will be purchasing it soon after trial ends tonight haha, but might i suggest having a timer on runite ores so it allows the script to wait for the ore lets say if its less than a minute from appearing than having a log into other worlds. I did notice soon as the script is commanded to world hop (after ore depletion) and a ore appeared it continues to hop worlds
    1 point
  16. i see now that it was my edit preset, user error script is amazing
    1 point
  17. ive done 4-5 quests i think in f2p and it works like a charm! it is a bit choppy and i do have to occasionally have to step somewhere or open a door so the bot doesnt look like a total bot, but as far as doing the quests its extremely impressive i will also try reporting every mistake i see to help the script out
    1 point
  18. I am VERY new to this site, I was wondering what I have to do to get this deal/Trial. I also am looking into buying PAID scripts etc. I just need a little guidance. Sorry for any inconvenience. Much Love and Happy Holidays!
    1 point
Γ—
Γ—
  • Create New...