-
Posts
2314 -
Joined
-
Last visited
-
Days Won
6 -
Feedback
100%
Everything posted by Explv
-
Although yours is simpler, both solutions are incorrect as you are calculating straight line distance instead of actual path distance. So it may return a bank that is not actually closest (you may have to walk around a bunch of stuff to get there). Why do you need to know which bank is closest anyway? If you use web walking with an Area[] it will walk to the closest Area in the array, so: getWalking().webWalk(bankAreas) will walk to the closest bank.
- 24 replies
-
- 2
-
-
- closest bank
- closestbank
-
(and 3 more)
Tagged with:
-
How do I know that an NPC is interacting with me?
Explv replied to trainux's topic in Scripting Help
1) I have no idea what you're asking 2) Why use IDs for NPCs? It looks horrible, is extremely unreadable (highlighted by the fact that you have comments) You can just use the names of the NPCs... NPC npc = getNpcs().closest("Giles", "Sandwich Lady", "Rick Turpentine"); etc. 3) OSBot already has a random event dismisser, why are you writing your own? -
... You're printing the array, so what comes up is expected. If you want to print the array's contents you will need to loop over it and print each Item, or use Arrays.toString(): log(Arrays.toString(initial)); Questions like this can be easily answered using Google, all you need to search for is "How to print an array in Java".
-
https://osbot.org/forum/topic/109560-a-simple-login-handler/
-
Pushed a fix for fishing in Barbarian Village, will be released when SDN is next updated.
-
All previously mentioned fixes are now released. Fletching, Crafting, Cooking etc. should all now be working on the SDN.
-
Looks awful. BF1 gameplay looks better than that pre-rendered trailer. During the reveal they kept going on about how the game will be true to WW2 and teach the story of WW2, yet they included a bunch of unrealistic shit.
-
Updated to include more constructors
-
Pushed fixes for raw meat cooking. Disabled all other cooking options until methods have been fixed. Changes will be applied when SDN is updated.
-
Pushed fixes for these, will be available when the SDN is next updated.
-
Just Google it !!!!!!!!!!!!!!!!!!! https://stackoverflow.com/questions/9156156/how-to-get-local-time-of-different-time-zones
-
Pushed fixes for fletching unstrung bows & arrow shafts, will be available when SDN is next updated Will take a look at the rest of fletching tomorrow.
-
Pushed fixes for jewellery & armour crafting, will be fixed when SDN is next updated. Haven't tested bow string spinning or other crafting methods yet though. Do you mean smelting bars? I justed tested smelting iron bars in Al-kharid and it's working fine. Is this still an issue? Thanks
-
Pushed a fix, will be available when SDN is next updated.
-
You could do this, the only reason I chose not to is because there is also the "Amulet of glory (t)" So it's probably better to check that there is a number inside the brackets. Edit: Your way would actually work because I think "Amulet of glory(4)" does not have a space before the bracket, but "Amulet of glory (t)" does. Way to be consistent RuneScape
-
You can use withdraw() with a Filter<Item> https://osbot.org/api/org/osbot/rs07/api/Bank.html#withdraw-org.osbot.rs07.api.filter.Filter-int- The Filter<Item> returns true if an item's name matches the regular expression "Amulet of glory\\(\\d\\)" final Filter<Item> gloryFilter = item -> item.getName().matches("Amulet of glory\\(\\d\\)"); if (getBank().contains(gloryFilter)) { getBank().withdraw(gloryFilter, 1); } else { log("No amulets of glory left!"); }
-
Yes, you can use https://rsbuddy.com/exchange/summary.json Example (using https://github.com/fangyidong/json-simple) import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public final class AlchValues { private static final float STORE_PRICE_TO_HIGH_ALCH_MULTIPLIER = 0.6f; private static final float STORE_PRICE_TO_LOW_ALCH_MULTIPLIER = 0.4f; private final JSONObject ITEMS_JSON; public AlchValues() throws IOException, ParseException { ITEMS_JSON = getItemsJSON(); } public static void main(String[] args) { AlchValues alchValues = null; try { alchValues = new AlchValues(); } catch (IOException | ParseException e) { System.err.println("Failed to fetch alch values"); System.exit(1); } System.out.println("Yew logs store price: " + alchValues.getStorePrice(1515)); System.out.println("Yew logs high alch: " + alchValues.getHighAlchValue(1515)); System.out.println("Yew logs low alch: " + alchValues.getLowAlchValue(1515)); } private JSONObject getItemsJSON() throws IOException, ParseException { URL url = new URL("https://rsbuddy.com/exchange/summary.json"); URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); con.setUseCaches(true); JSONObject itemsJSON; try (InputStreamReader inputStreamReader = new InputStreamReader(con.getInputStream()); BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { JSONParser jsonParser = new JSONParser(); itemsJSON = (JSONObject) jsonParser.parse(bufferedReader); } return itemsJSON; } public int getHighAlchValue(final int itemID) { return (int) (getStorePrice(itemID) * STORE_PRICE_TO_HIGH_ALCH_MULTIPLIER); } public int getLowAlchValue(final int itemID) { return (int) (getStorePrice(itemID) * STORE_PRICE_TO_LOW_ALCH_MULTIPLIER); } public int getStorePrice(final int itemID) { return Math.toIntExact((long) getItemJSON(itemID).get("sp")); } private JSONObject getItemJSON(final int itemID) { return (JSONObject) ITEMS_JSON.get(String.valueOf(itemID)); } } Output: Yew logs store price: 160 Yew logs high alch: 96 Yew logs low alch: 64
-
Right? It's their game, they can do what they want
-
May his legend live on in our hearts
-
Saiyan 10/10
-
Stop pulling stuff out of your ass. Java is one of the highest paid languages, no one is paying you shit for tensorflow and matlib???? Also wtf is the point of this thread? Don't post a thread in scripting help asking why your code is bad, and then go on a tangent about how Java sucks and tensor flow and matlib is superior Why are you even here?
-
This is just idiotic. "ill stick to tensorflow and matlib for now" Isn't that Python? Python is older than Java right?
-
You may want to change your attitude a bit if you are asking for help from others. Being rude to everyone doesn't make people want to give you advice. "sorry for not typing if != null like an idiot for every object" It is better practice to check that an instance is != null than surround all your code with a try / catch for a NullPointerException. You should only really catch exceptions when you can handle them, if you can't handle them, or it doesn't make sense to handle them, they should be deferred to the caller using "throws", for example onLoop() should throw InterruptedException. (Just printing the exception isn't really handling it) "Your using practicies from Java 6 that are far from relevant now. I chose the wrong person to learn from." Java 6 is still being used for many large software projects, you have to be careful when updating software between major versions as it can easily break, or in this case cause other people's software to break. Also I think saying he is the wrong person to learn from is idiotic, it is clear from this post alone that he knows a lot more about programming than you do, and I can tell you that that the programming language you use, or the version of a programming language you use has no influence on how good a programmer you are. Some more notes about your code: In Java we use camelCase: findBank() not find_bank() In Java variable names should start with a lower case letter, class names should start with a capital letter. Some of your naming is funky, find_bank() walks to a bank, it doesn't find it? Methods should return booleans to indicate success, e.g. withdraw_item should return true/false depending on whether it withdrawed an item successfully. The reason why you need to call exchangeContext() is because the OSBot API has not been initialised on the other classes yet. Classes that extend MethodProvider have variables like bank, inventory, equipment, etc. (that you access with getBank(), getInventory(),...) When you call exchangeContext(Bot bot), the variables will be initialised using the values from the Bot instance, to your new MethodProvider instance. Lib is a terrible class name, you should rename this to something meaningful. If you saw Lib lib = new Lib(); would you have any idea what that was?! If you can't rename it to something meaningful, then perhaps there is something wrong with your code design, and the functions in that class should belong somewhere else.
-
If you just want to use the tool, go to the website https://explv.github.io/ If you want to modify the tool locally, Chrome complains about using the local file system, so you will want to try Firefox instead, or alternatively just setup a local web server and run it from there.
-
@Evade > What is the best language to start with? Best first language is fairly subjective, and I don't really think there is a "best" first language. I would probably recommend starting with Python, just because the syntax is much simpler than other languages. I personally started with Java, the learning curve is, in my opinion, steeper than Python, but it isn't ridiculously difficult or anything. > If you do it as a job are you free lancing or do you work for a company? I'm working for a company, most people do at the start. You need to gain experience in the field before people will trust you as a freelancer. You can gain that experience by working for a company, or by having a significant portfolio of projects that you can show potential clients. > Do you have any general tips for someone looking into programming? Just keep putting in time. Programming itself is not particularly difficult, it just takes a long time to get good at, the same with any other skill. I think the general rule is 10,000 hours to master something right? Pretty much everything you need to know about programming can be found online, either in documentation, on blog posts, tutorial websites or StackOverflow etc. Just learn how to efficiently Google what you want to know, and you can easily answer all your questions. Once you have the fundamentals down, just start building stuff. The best way to learn is by trying to build something, getting stuck, finding the answer, repeat. Eventually you'll find that you start to get stuck less. Don't just stick to one thing, explore building web apps, mobile apps, desktop apps etc. etc. If you enjoy it, then think about taking formal education in Computer Science or Software Engineering. There is more to creating software than just programming, there's a lot to learn, so doing a formal course can be helpful.