Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Jake Slang

Members
  • Joined

  • Last visited

Everything posted by Jake Slang

  1. Check my previous post. I've updated the syntax, it should work now. I made a mistake, I think I just woke up around that time, my bad.. Also,, that rawFoodName (between quotes) was just a parameter/placeholder, you should pass in the full name of the raw fish: Sleep.sleepUntil(() -> !getInventory().contains("Raw tuna"), 120000); Oh, and make sure the timeout is around 2 minutes, or else it'll try cooking again after 5 seconds. If you cook a variety of food you could also do: Sleep.sleepUntil(() -> !getInventory().contains("Raw tuna") && !getInventory().contains("Raw lobster"), 120000);
  2. Something like this: Sleep.sleepUntil(() -> !getInventory().contains("rawFoodName"), 120000); So now your player will sleep until your inventory doesn't contain the given raw food (first parameter), or until the timeout is hit (which is set to 2 minutes now). You have to think about the timeout. I've set it to 2 minutes, because the first parameter will most likely evaluate to false, but you don't want the second parameter to evaluate to true after like 3 seconds, which will loop your script again. This snippet is made because it is shorter and self-explanatory in the way you read it: Let your script sleep until the first given parameter is truthy (thus continue running your script), or until the timeout is hit (thus continue running your script). Timeout is in milliseconds btw.
  3. I guess this is the right section for posting pointless/unnecessary threads like these.. Are you trying to provoke/make people scared? People die every day.
  4. You got me again with that creative thinking Maybe it'd be SDN material if I iimplement your suggestion. I know there's another chocolate cutter in the SDN, but that one is not for money making purposes. Anyways, thanks for the tip!
  5. Hey, nice script release. That's some creative thinking (unique script).
  6. You need a conditional sleep. Now you're just sleeping for 4-5 seconds (which your script uses to cook 3 fishes before looping again). So what you want is: Sleep.sleepUntil(() -> condition, timeout); Now it will sleep until the condition (is true) or the timeout is met. The condition could be till there are no raw fishes left in your inventory. I would give the timeout some absurd number so you'll pretty much only stop cooking when the condition evaluates to true. In order to use this static sleepUntil() method, you should add this snippet under your main class: https://hastebin.com/azusobiyur.java Also check out:
  7. Thanks, bro. The starting cash is for buying in the choco bars. I'll edit the thread and make it more explicit.
  8. Hey, hey, welcome to OSBot!! I'm also a dev, hope we can all learn from each other.
  9. Laravel integrates everything you need as a Web dev.
  10. [$] JakesChocolateGrinder (v1.1) [$] Features Cuts chocolate bar into chocolate dust for currently 60k/hour (WARNING: PRICES MAY FLUCTUATE) Banks Logs you out when out of bars Requirements 50k starting cash for buying in the choco bars (preferably a lot more for convenience) A knife (NO PESTLE & MORTAR) Configuring the script Download the .jar file Copy or cut it into your OSBot scripts folder (e.g. C:\users\username\OSBot\Scripts\) Log in on OSBot Refresh the Script Selector (the script should be added now) Instructions You have to start in Varrock East Bank (or it'll webwalk you to it)! Make sure you have a knife and chocolate bar(s) in your inventory/bank Run the script via the Script Selector and let it do its thing >:D Versions v1.0 - Initial release v1.1 - Added paint JakesChocolateGrinder.jar
  11. Jake Slang replied to Kira1's topic in General Help
    If you have a script running, you can't X it; you have to make sure that the script you're running is either paused or stopped.
  12. Ok, so I even found another bug in here. Once you your inventory is full, it'll execute the bank() method as expected, and when you depositAll(), it'll trigger the canFishShrimps() method, because when you deposit all, your inventory doesn't have that fishing net that it expects.. But since I didn't include an else if statement that conditionally asks if the (getBank().isOpen()) method is true, it would execute the else statement, thus logging out. So in the end refactoring did in fact help. This is my code after listening to @TheWind's advice: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.util.function.BooleanSupplier; @ScriptManifest(author = "Jake Slang", name = "JakesShrimpCatcher", info = "Catches shrimp (and anchovies) in Lumbridge swamp.", version = 0.1, logo = "") public final class JakesShrimpCatcher extends Script { private final Area lumbyFishing = new Area(3240, 3150, 3238, 3145); private final Position lumbyBank = new Position(3208, 3220, 2); Entity fishingSpot = null; @Override public final void onStart() { log("Is there anybody actually reading THIS?!"); } @Override public final int onLoop() throws InterruptedException { if (canFishShrimps()) { fish(); } else { bank(); } return random(200, 300); } @Override public final void onExit() { log("I guess YOU did!"); } private void fish() { if (!lumbyFishing.contains(myPosition())) { getWalking().webWalk(lumbyFishing); } fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot != null && fishingSpot.interact("Net")) { sleepConditional(); } } private void sleepConditional() { Sleep.sleepUntil(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000); } private void bank() throws InterruptedException { if (getInventory().isFull()) { if (!Banks.LUMBRIDGE_UPPER.contains(myPosition())) { getWalking().webWalk(lumbyBank); } if (!getBank().isOpen()) { getBank().open(); getBank().depositAll(); } else if (getBank().isOpen()) { getBank().depositAll(); } else { stop(true); } } } private boolean canFishShrimps() throws InterruptedException { if (!getInventory().contains("Small fishing net")) { if (!Banks.LUMBRIDGE_UPPER.contains(myPosition())) { getWalking().webWalk(lumbyBank); } if (!getBank().isOpen()) { getBank().open(); getBank().withdraw("Small fishing net", 1); } else if (getBank().isOpen()) { getBank().withdraw("Small fishing net", 1); } else { stop(true); } } return !myPlayer().isAnimating() && !getInventory().isFull(); } } class Sleep extends ConditionalSleep { private final BooleanSupplier condition; public Sleep(final BooleanSupplier condition, final int timeout) { super(timeout); this.condition = condition; } @Override public final boolean condition() throws InterruptedException { return condition.getAsBoolean(); } public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) { return new Sleep(condition, timeout).sleep(); } }
  13. Thanks @TheWind for your comprehensive feedback. I'll read it through tomorrow. Have to get some rest now
  14. Hey, thanks for replying. Do you have any suggestions? What kind of scripts did you write before applying for Scripter 1? Yeah, I specifically grabbed the tile position of the Lumbridge bank, because else it would bug around on banking.
  15. OK, I was just hoping for some remarks on for example my sleep() usage. I think I could do things more efficiently.. If I learn to see these gotchas faster, it'll make me a better programmer overall, really.
  16. Hey, so I just finished writing my first script for learning purposes. I'd like to get some feedback on ways to refactor this logic down a bit more. Here's my code: SPOILER: It basically catches and banks shrimps/anchovies :P import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.util.function.BooleanSupplier; @ScriptManifest(author = "Jake Slang", name = "JakesShrimpCatcher", info = "Catches shrimp (and anchovies) in Lumbridge swamp.", version = 0.1, logo = "") public final class JakesShrimpCatcher extends Script { private final Area lumbyFishing = new Area(3240, 3150, 3238, 3145); private final Position lumbyBank = new Position(3208, 3220, 2); @Override public final void onStart() { log("Is there anybody actually reading THIS?!"); } @Override public final int onLoop() throws InterruptedException { if (canFishShrimps()) { fish(); } else { bank(); } return random(200, 300); } @Override public final void onExit() { log("I guess YOU did!"); } private void fish() { if (!lumbyFishing.contains(myPosition())) { getWalking().webWalk(lumbyFishing); } Entity fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot != null && fishingSpot.interact("Net")) { sleepConditional(); } } private void sleepConditional() { Entity fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot != null && fishingSpot.interact("Net")) { Sleep.sleepUntil(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000); log(Sleep.sleepUntil(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000)); } } private void bank() throws InterruptedException { if (getInventory().isFull()) { if (!Banks.LUMBRIDGE_UPPER.contains(myPosition())) { getWalking().webWalk(lumbyBank); MethodProvider.sleep(2000); } else if (!getBank().isOpen()) { getBank().open(); getBank().depositAll(); } else { stop(true); } } } private boolean canFishShrimps() throws InterruptedException { if (!getInventory().contains("Small fishing net")) { getWalking().webWalk(lumbyBank); MethodProvider.sleep(2000); getBank().open(); getBank().withdraw("Small fishing net", 1); } return !myPlayer().isAnimating() && !getInventory().isFull(); } } class Sleep extends ConditionalSleep { private final BooleanSupplier condition; public Sleep(final BooleanSupplier condition, final int timeout) { super(timeout); this.condition = condition; } @Override public final boolean condition() throws InterruptedException { return condition.getAsBoolean(); } public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) { return new Sleep(condition, timeout).sleep(); } } Plot twist: It basically catches shrimps/anchovies and banks them :P
  17. Ok, so I don't think my code was necessarily wrong, but I did made some adjustments conform your advice: private final Area lumbyFishing = new Area(3247, 3156, 3244, 3154); public final int onLoop() throws InterruptedException { if (canFishShrimps()) { fish(); } else { bank(); } return random(150, 200); } private void fish() { if (!lumbyFishing.contains(myPosition())) { getWalking().webWalk(lumbyFishing); } Entity fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot != null) { if (fishingSpot.interact("Net")) { sleepConditional(); } } } private void sleepConditional() { Entity fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot != null && fishingSpot.interact("Net")) { Sleep.sleepUntil(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000); log(Sleep.sleepUntil(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000)); } } private void bank() { // } private boolean canFishShrimps() { return !myPlayer().isAnimating() && !getInventory().isFull(); } So I think the problem was that I also had to export my Sleep class (which was automatically created on reference) to my Script folder. PS: And I know I can refactor this logic a lot more; I'm on it! :)
  18. Thank each one of you for all your efforts. I'll read through after breakfast
  19. Hey, so I'm pretty new to this, and I have a question.. I'm currently writing a fishing script for fun/learning purposes, and I stumbled upon the fact that my fish() method stops running after achieving a level or when the fishing spot disappears. I know that the script executioner gets called depending on the ms you specify in the onLoop method, and I've also tried adding a while loop, but neither of these methods helped me fix the problem. private void fish() { if (!lumbyFishing.contains(myPosition())) { getWalking().webWalk(lumbyFishing); } Entity fishingSpot = getNpcs().closest("Fishing spot"); while (fishingSpot.exists()) { if (fishingSpot != null && fishingSpot.interact("Net")) { new Sleep(() -> myPlayer().isAnimating() || !fishingSpot.exists(), 5000).sleep(); } } } SO my question to you guys was: What is wrong with my code? Thanks in advance.
  20. Just follow the instructions on the site. You basically have to 'Get Mouse Position & Add Action' (keybind) on the desired spots. Then you start the 'Script Execution' by pressing another keybind. Here is a showcase on how to set it up:
  21. This works for me: https://www.murgee.com/auto-mouse-click/
  22. Hi

    Jake Slang replied to Fabrii's topic in Spam/Off Topic
    Okay
  23. Hi

    Jake Slang replied to Fabrii's topic in Spam/Off Topic
    German, why? I have lots of Dutch friends if you were wondering :P

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.