Skip 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.

Explv

Scripter II
  • Joined

  • Last visited

Everything posted by Explv

  1. Java and JavaScript are two completely different things. JavaScript is primarily for websites.
  2. Something like that yes, but you should account for cases where walking fails, or opening the bank fails etc. etc. You will also want to sleep when opening the bank to avoid spam clicking. So something more like this: private void bank(){ if(!Banks.EDGEVILLE.cotains(myPosition())) getWalking().webWalk(Banks.EDGEVILLE); else if(!getBank().isOpen()) openBank(); else getBank().depositAllExcept("Fly fishing rod", "Feather"); } private void openBank(){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); }
  3. Not sure if I fully understand you or not, but I am assuming you are trying to make an AIO chopper, where the user can select different locations etc. This is a very simple example, which you can build upon. You start by having an enum for each Tree, which contains an Area in which the trees can be found: public enum Tree { NORMAL (new Area(0, 0, 0, 0)), OAK (new Area(0, 0, 0, 0)); Area area; Tree(final Area area){ this.area = area; } @Override public String toString(){ char[] name = name().toLowerCase().toCharArray(); name[0] = Character.toUpperCase(name[0]); return new String(name); } } Then when the script starts, have the user select what tree they want to chop: import org.osbot.rs07.script.Script; import javax.swing.*; public class Woodchopper extends Script { @Override public void onStart() { Tree selectedTree = (Tree) JOptionPane.showInputDialog(null, "Select a Tree", "Woodchopper", JOptionPane.INFORMATION_MESSAGE, null, Tree.values(), Tree.values()[0] ); } @Override public int onLoop() throws InterruptedException { return 0; } } Your Chop Node can then take the selected tree as a constructor parameter: import org.osbot.rs07.script.Script; public class ChopNode extends Node { private final Tree tree; public ChopNode(final Script S, final Tree tree) { super(S); this.tree = tree; } @Override public boolean validate() { return !S.getInventory().isFull(); } @Override public void execute() { if(!tree.area.contains(S.myPosition())){ S.getWalking().webWalk(tree.area); } else{ chop(); } } private void chop(){ // chop the trees } } So now in your onStart, when you create the nodes, you can pass the selected Tree: import org.osbot.rs07.script.Script; import javax.swing.*; public class Woodchopper extends Script { @Override public void onStart() { Tree selectedTree = (Tree) JOptionPane.showInputDialog(null, "Select a Tree", "Woodchopper", JOptionPane.INFORMATION_MESSAGE, null, Tree.values(), Tree.values()[0] ); Node chopNode = new ChopNode(this, selectedTree); } @Override public int onLoop() throws InterruptedException { return 0; } } Hope that helps
  4. Nice, I wrote this a while ago :P definitely more succinct to use setLocationRelativeTo(null)
  5. Why are you reading a GUI tutorial noob
  6. Delete the entire OSBot folder, restart OSBot and then rebuild your script.
  7. You should really learn how to debug yourself. For starters, you are catching an Exception and never handling it. If you had printed out the exception by doing this: Image bg = getImage("http://s9.postimg.org/5tbnkub0r/Namnl_st_1.png"); @Override public void onPaint(Graphics2D g){ if(bg != null){ g.drawImage(bg, 100, 100, null); System.out.println("Drawing image"); } } private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { e.printStackTrace(); } return null; } You would have seen this displayed (in debug mode): The website returns a 403 response code (Forbidden error), most likely because it looks at the request headers and sees that you are not visiting this url from a web browser. You can either reupload the image to a different site, or you can set the User-Agent in your Java code to be a browser's User-Agent like this: Image bg = getImage("http://s9.postimg.org/5tbnkub0r/Namnl_st_1.png"); @Override public void onPaint(Graphics2D g){ if(bg != null){ g.drawImage(bg, 100, 100, null); System.out.println("Drawing image"); } } private Image getImage(String url) { try { URL imgUrl = new URL(url); URLConnection connection = imgUrl.openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); return ImageIO.read(connection.getInputStream()); } catch (IOException e) { e.printStackTrace(); } return null; } Which works.
  8. What you are doing is a bad idea. onPaint is called many times per second, and in every loop you are re-getting the image from that url. You should only get the image once and store it.
  9. Some songs might not be as quiet as you're hoping for, but it's what I like to listen to. http://stefanostev.bandcamp.com/album/beyond-stolen-notes http://lapa.bandcamp.com/album/meeting-of-the-waters
  10. http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/
  11. 1. You don't need to store cooking xp 2. Split your code into more methods, each method should do one thing 3. Use ConditionalSleeps Your banking should look more like: private void bank(){ if(!getBank().isOpen()) openBank(); else if(!getInventory().isEmptyExcept("Raw trout")) getBank().depositAll(); else if(!getInventory().contains("Raw trout")) getBank().withdrawAll("Raw trout"); else getBank().close(); } private void openBank(){ NPC emeraldBenedict = getNpcs().closest("Emerald Benedict"); if(emeraldBenedict != null){ emeraldBenedict.interact("Bank"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } Your getState should only return BANKING or COOKING: private State getState(){ return !getBank().isOpen() && getInventory().contains("Raw trout") ? State.COOKING : State.BANKING; } For Widgets you should use getWidgetContainingText() wherever possible. So your cooking method should look more like: private void cook(){ RS2Widget troutWidget = getWidgets().getWidgetContainingText("Trout"); if(troutWidget != null) troutWidget.interact("Cook All"); else if(!isTroutSelected()) getInventory().getItem("Raw trout").interact("Use"); else useFire(); } private boolean isTroutSelected(){ Item selectedItem = getInventory().getSelectedItem(); return selectedItem != null && selectedItem.getName().equals("Raw trout"); } private void useFire(){ RS2Object fire = getObjects().closest("Fire"); if(fire != null){ fire.interact("Use"); new ConditionalSleep(1500){ @Override public boolean condition() throws InterruptedException { return getWidgets().getWidgetContainingText("Trout") != null; } }.sleep(); } } You can also avoid using a timer by using a ConditionalSleep. So all together your script could look more like: import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; import java.text.DecimalFormat; @ScriptManifest(name = "RogueDenCooker", author = "GaetanoH", version = 1.0, info = "", logo = "") public class RogueDenCooker extends Script { private long startTime; public enum State { COOKING, BANKING; } private State getState(){ return !getBank().isOpen() && getInventory().contains("Raw trout") ? State.COOKING : State.BANKING; } @Override public void onStart() { log("Thanks for using my Rogue's Den Cooker, please start with enough food in the bank"); startTime = System.currentTimeMillis(); getExperienceTracker().start(Skill.COOKING); } @Override public int onLoop() throws InterruptedException { switch(getState()){ case COOKING: cook(); break; case BANKING: bank(); break; } return random(200, 300); } private void cook(){ if(getTroutWidget() != null) cookAll(); else if(!isTroutSelected()) getInventory().getItem("Raw trout").interact("Use"); else useFire(); } private void cookAll(){ if(getTroutWidget().interact("Cook All")){ new ConditionalSleep(60_000){ @Override public boolean condition() throws InterruptedException { return !getInventory().contains("Raw trout"); } }.sleep(); } } private boolean isTroutSelected(){ Item selectedItem = getInventory().getSelectedItem(); return selectedItem != null && selectedItem.getName().equals("Raw trout"); } private void useFire(){ RS2Object fire = getObjects().closest("Fire"); if(fire != null){ fire.interact("Use"); new ConditionalSleep(1500){ @Override public boolean condition() throws InterruptedException { return getTroutWidget() != null; } }.sleep(); } } private RS2Widget getTroutWidget(){ getWidgets().getWidgetContainingText("Trout"); } private void bank(){ if(!getBank().isOpen()) openBank(); else if(!getInventory().isEmptyExcept("Raw trout")) getBank().depositAll(); else if(!getInventory().contains("Raw trout")) getBank().withdrawAll("Raw trout"); else getBank().close(); } private void openBank(){ NPC emeraldBenedict = getNpcs().closest("Emerald Benedict"); if(emeraldBenedict != null){ emeraldBenedict.interact("Bank"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } @Override public void onPaint(Graphics2D g) { Point mP = getMouse().getPosition(); g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5); g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5); long runTime = System.currentTimeMillis() - startTime; cookingXP = getExperienceTracker().getGainedXPPerHour(Skill.COOKING); g.drawString("Time running: " + formatTime(runTime), 10, 290); g.drawString("Experience/h: " + String.valueOf(cookingXP), 10, 310); g.drawString("Made by GaetanoH", 10, 330); } private String formatTime(long ms){ long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } } Hope that helps
  12. The thing is, as you will find out, Discrete Mathematics is the main subset of Mathematics used in Computer Science. It underlies many of the algorithms that you will use, and covers useful topics like Graph Theory. Considering OP is interested in algorithms and AI, he will want to do DM. Take a look at this link: https://en.wikipedia.org/wiki/Discrete_mathematics
  13. I feel like you don't know anything about CS. Broad is good, if you learn something extremely specific at university then you restrict yourself when it comes to employment. Also you mixed it up, you meant "you learn a little about a whole lot" and that is good. The field of CS is enormous and there is a lot to learn. By being introduced to subjects it allows you to self teach in the areas that you are interested in. It's not about spoonfeeding. Unlike many other jobs, working in software means that you have to constantly learn new technologies and skills. That's why there generally isn't much point in spending all of your time learning one specific thing. "You end up getting your degree and have nowhere to go from there" ---- except for all of the jobs that ask for a CS degree / any software job you want It is a field where there is high demand for graduates, and a lot of universities have 100% employment rate for CS students.
  14. You will either need a degree in computer science or software engineering, or a very impressive portfolio. Pretty much every large company will ask for a degree, most smaller companies will too, but some small companies you can get by with just a portfolio. Considering you will be competing with graduates, not having a degree in CS or SE will leave you at a significant disadvantage. As for the minor question, personally I would choose Discrete Mathematics unless you already have an understanding of it / are particularly interested in Robotics
  15. You're all lame #nospaceissafe
  16. The download link is fine?
  17. Wow sounds great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11 Let me just find my wallet!!!! mfw greyname thinks people will pay him 25m for some bullshit
  18. Try doing this instead: g.drawPolygon(t.getPolygon(getBot()));
  19. http://osbot.org/forum/topic/66742-getting-position/
  20. But didn't you know you should maximise performance, and minimise readability
  21. Your opinion. You should learn what premature optimisation is. My solution is better. Thank you for playing, please try again!
  22. Item glory = getBank().getItem(item -> item.getName().startsWith("Amulet of glory")); FTFY.
  23. In the future if you post code, please use the code tags, otherwise it is completely unreadable: The issue in your code as far as I can see, is you have tree.interact("Chop Down") It should be tree.interact("Chop down") The interaction text must be exact. There are quite a few other errors in your Script, but I don't have the time to write down what they are.
  24. Arrays.stream(getBank().getItems()).filter(item -> item.getName().contains("Amulet of glory")).collect(Collectors.toList()); FTFY. getBank().getItems() returns an Item[]
  25. players.inventory.contains() Is wrong. It should be: getInventory().contains()

Account

Navigation

Search

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.