Everything posted by MarWo22
-
Need help with GE
Im trying to make a part of my script where it will abort all of the pending offers. But i can't seem to get it to work. Can someone help me? Thanks Nvm just found it out
-
cancel GE offers
Im trying to find a way to cancel the GE offers. There is probably a really easy way to do it buy I can't seem to find it.
-
getState() with multiple if statements
thank you stupid of me that I didnt think of that myself
-
getState() with multiple if statements
private enum State{ BANK, MAKE, GRANDEXCHANGE, } private State getState() { if(inventory.contains(227) && inventory.contains(HighestMarginHerbId)) return State.MAKE; return State.BANK; } First of all im a beginner in scripting and in java. Im trying to make getState() return GRANDEXCHANGE when bank does not contain the item 227 and HighestMarginHerbId. But it keeps giving me errors.
-
Dont know how to use it
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; /** * GrandExchange Price Class * * @author Reid * */ public class GrandExchange { private static final String BASE = "https://api.rsbuddy.com/grandExchange?a=guidePrice&i="; /** * Default Constructor * */ public GrandExchange() { } /** * Gets the overall price of an item. * * @param itemID * @return itemPrice * @throws IOException */ public int getOverallPrice(final int itemID) throws IOException { return parse(itemID,"overall"); } /** * Gets the buying price of an item. * * @param itemID * @return itemPrice * @throws IOException */ public int getBuyingPrice(final int itemID) throws IOException { return parse(itemID,"buying"); } /** * Gets the selling price of an item. * * @param itemID * @return itemPrice * @throws IOException */ public int getSellingPrice(final int itemID) throws IOException { return parse(itemID,"selling"); } /** * Retrieves the price of an item. * * @param itemID * @return itemPrice * @throws IOException */ private int parse(final int itemID, String choice) throws IOException { final URL url = new URL(BASE + itemID); BufferedReader file = new BufferedReader(new InputStreamReader(url.openStream())); String line; String price = null; while ((line = file.readLine()) != null) { if (line.contains("{")) { price = (line).trim(); } } if (choice.equals("buying")){ price = price.substring(price.indexOf(",") + 10, nthOccurrence(price, ',', 1)).trim(); } else if(choice.equals("selling")) { price = price.substring(nthOccurrence(price, ',', 2) + 11 , price.indexOf("sellingQuantity") - 2).trim(); } else { price = price.substring(price.indexOf(":") + 1, price.indexOf(",")).trim(); } file.close(); return Integer.parseInt(price); } private int nthOccurrence(String str, char c, int n) { int pos = str.indexOf(c, 0); while (n-- > 0 && pos != -1) pos = str.indexOf(c, pos + 1); return pos; } } So i found this Snippet but im new to scripting. I dont know how to use it. Can someone please help me? Thank you
-
GE checker
Is there a way to check the prices of an item on the GE in your script? For example the instant buy and sell prices of items. This could be very usefull in flipping bots and to check the marging for which items are the most profitable.
- Keeps spamclicking
-
Keeps spamclicking
This is my first script i made. Everything works fine except when it starts using the items. It will keep spamming them. I've used if(!myplayer().isanimating()). But there seems to be a small gap in the animations so it will still be spamming the vials of water and herbs and it will eventually cancel the crafting. import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "MarWo", info = "simple bot for making unfinished potions", logo = "", name = "HerbloreBot", version = 0) public class Bot extends Script { private enum State { BANK, MAKE }; private State getState() { if(inventory.contains(227) && inventory.contains(255)) return State.MAKE; return State.BANK; } public void onStart(){ } public void onExit() { } public int onLoop() throws InterruptedException { switch (getState()) { case BANK: if(!getBank().isOpen()) { getBank().open(); } sleep(100); bank.depositAll(); sleep(100); bank.withdraw(227, 14); sleep(100); bank.withdraw(255, 14); sleep(100); bank.close(); break; case MAKE: if(!getWidgets().isVisible(270, 14)) { if(!myPlayer().isAnimating()) { inventory.interact("Use", 227); sleep(250); inventory.interact("Use", 255); } } if (getWidgets().isVisible(270, 14)) { getWidgets().interact(270, 14, "Make"); } break; } return 500; } }