Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. No, the community edition has all the features you will need.
  2. IntelliJ IDEA master race https://www.jetbrains.com/idea/
  3. "Protecting this idea" ???? I have been working on this script since December, just because I made this thread today does not mean this is a new project. Don't be a hayta
  4. use getName(), but you will also need to account for non breaking spaces in their name so use: if (hosts.contains(allPlayers.get(i).getName().replace('\u00A0', ' ')))
  5. Now open source: https://github.com/Explv/Explvs-AIO Download on GitHub: https://github.com/Explv/Explvs-AIO/releases/latest Explv's AIO From Tutorial Island to your dream account. Script ID: 890 CLI Usage: java -jar "OSBot 2.5.31.jar" -login osbot_user:osbot_passwd -bot osrs_user:osrs_passwd:pin -script "\"Explv's AIO v3.2\":example.config" Advanced task system featuring 7 different task types Level task: Perform an activity until a level in a skill is reached Resource task: Perform an activity until a quantity of an item has been obtained Timed task: Perform an activity for a number of minutes Quest task: Complete a quest Grand Exchange task: Buy or sell items at the Grand Exchange Break task: Pause the script for an amount of time Loop task: Repeat selected previous tasks any number of times Tutorial Island Support The script completes Tutorial Island if your player starts there, with fully randomized customer character creation GUI Preview Supported Activites Agility Cooking Crafting Firemaking Fishing Fletching Herblore Mining Ranged Runecrafting Smithing Thieving Woodcutting Quests
  6. I have confirmed getStore.isOpen() 100% works at Jiminua's store. Also using an area, when checking for the closest "Jiminua" is unnecessary, there is only one Jiminua, and if she leaves the area you have specified it will return null. The issue lies elsewhere in your code. Item ID 7936 is Pure essence: https://rsbuddy.com/exchange?id=7936& If the shop does not have 100 Pure essence, your script will not do anything. For clarity you should use Strings instead of IDs for item names. public void buyPureEssence(){ if(!S.getStore().isOpen()){ openStore(); } else if(S.getStore().contains("Pure essence"){ buy10(); } } private void buy10(){ long invPureEssAmount = S.getInventory().getAmount("Pure essence"); S.getStore().interact("Buy 10", "Pure essence"); new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return S.getInventory().getAmount("Pure essence") > invPureEssAmount; } }.sleep(); } private void openStore(){ NPC shopkeeper = S.npcs.closest("Jiminua"); if(shopkeeper != null){ shopkeeper.interact("Trade"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return S.getStore().isOpen(); } }.sleep(); } }
  7. http://www.tutorialspoint.com/swing/swing_jtextfield.htm
  8. Explv

    Explv's Walker

    Unfortunately that would be a bug in the Web Walker and not my script.
  9. Try Player player = players.closest("Stone 688ab");
  10. Java and JavaScript are two completely different things. JavaScript is primarily for websites.
  11. 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(); }
  12. 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
  13. Nice, I wrote this a while ago :P definitely more succinct to use setLocationRelativeTo(null)
  14. Why are you reading a GUI tutorial noob
  15. Delete the entire OSBot folder, restart OSBot and then rebuild your script.
  16. 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.
  17. 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.
  18. 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
  19. http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/
  20. 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
  21. 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
  22. 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.
  23. 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
  24. You're all lame #nospaceissafe
×
×
  • Create New...