-
Cooking bot, double click
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);
-
Cooking bot, double click
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.
-
Terrorist Attack in Finland.
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.
- [$] JakesChocolateGrinder (v1.1) || F2P MONEY MAKING SCRIPT (UP TO 70K/HOUR) || NO REQUIREMENTS [$]
- ZeFishLooter [GOOD CASH (30k/ph)] [F2P] [NO REQ]
-
Cooking bot, double click
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:
- [$] JakesChocolateGrinder (v1.1) || F2P MONEY MAKING SCRIPT (UP TO 70K/HOUR) || NO REQUIREMENTS [$]
-
Hi, I'm Hez! (New Scripter)
Hey, hey, welcome to OSBot!! I'm also a dev, hope we can all learn from each other.
-
On vacation til next sunday
Have fun! >:D
-
Web Framework for a personal dev portfolio
Laravel integrates everything you need as a Web dev.
- [$] JakesChocolateGrinder (v1.1) || F2P MONEY MAKING SCRIPT (UP TO 70K/HOUR) || NO REQUIREMENTS [$]
-
Jake Slang changed their profile photo
-
[$] JakesChocolateGrinder (v1.1) || F2P MONEY MAKING SCRIPT (UP TO 70K/HOUR) || NO REQUIREMENTS [$]
[$] 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
-
ad wont close
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.
-
Code review: Fishing script
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(); } }
-
Code review: Fishing script
Thanks @TheWind for your comprehensive feedback. I'll read it through tomorrow. Have to get some rest now