Everything posted by Explv
-
Help with webWalking
The webWalk method accepts an area. There are several predefined areas for banks: getWalking().webWalk(Banks.VARROCK_WEST); Or without using the Banks class: getWalking().webWalk(new Area(3180, 3433, 3185, 3447));
-
JavaFX and OSBot
This is how you integrate JavaFX into a Swing application: https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/swing-fx-interoperability.htm It's probably safer to just use Swing though
-
Explv's Tutorial Island [Free] [Random Characters]
I have updated the account switching to use the built in OSBot method, so it will work without using the default account or disabling randoms
-
Explv's Tutorial Island [Free] [Random Characters]
Fixed, download the latest version
-
Explv's Tutorial Island [Free] [Random Characters]
I will fix it tonight and notify you when it is uploaded.
- Explv's Walker
-
setting up cli parameters
I'm a douche for not writing your script for you? I don't see how recommending that you spend some more time learning Java to help yourself makes me a douche either.
-
setting up cli parameters
String class: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html A tutorial on variables: https://www.tutorialspoint.com/java/java_variable_types.htm
-
setting up cli parameters
Yes and I have helped you, this is the scripting help section, not the teaching basics of Java section You get the parameters String using: String parameters = getParameters(); Parse the information you need from the String, store the results. Then when you want to withdraw from the bank you use getBank().withdraw(String itemName, int amount); Using your stored information. I am not going to write down every line of code to do that, because you should be able to do it if you have basic knowledge of Java. Which is why I am recommending, that if you DONT know how to do that, then you should learn some more Java then come back to Scripting.
-
setting up cli parameters
I have shown you how to get the parameters String, parse the information you need from that String using whatever format you want. If you don't know what to do after that, I would recommend that you spend some more time learning Java, because this isn't really a scripting help question, it's just basic programming.
-
setting up cli parameters
You can withdraw items from the bank using: getBank().withdraw(String itemName, int amount); Consider reading the API documentation: http://osbot.org/api/org/osbot/rs07/api/Bank.html#withdraw-java.lang.String-int-
-
setting up cli parameters
You get the script parameters string using the getParameters() method in the Script class String parameters = getParameters();
-
Is it possible to run a bat file from inside a script?
That would require the mule to be always logged on, which isn't really what op was trying to achieve
-
Is there a way to seperate breakhandler from random events?
You could try doing something like this: @ Override public void pause() { if (getBot().getRandomExecutor().getTimeUntilBreak() == 0) { pickUpCannon(); } }
-
Getting itemID by name
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { Example example = new Example(); example.getItemsJson().ifPresent(json -> { example.getItemID(json, "Greenman's ale").ifPresent(System.out::println); example.getItemID(json, "Cannonball").ifPresent(System.out::println); example.getItemID(json, "Raw trout").ifPresent(System.out::println); example.getItemID(json, "Rune scimitar").ifPresent(System.out::println); example.getItemID(json, "Lobster").ifPresent(System.out::println); }); } private Optional<Integer> getItemID(final String json, final String itemName) { return getItemFromJson(json, itemName).flatMap(this::getItemIDFromItemJson); } private Optional<String> getItemFromJson(final String json, final String itemName) { Matcher matcher = Pattern.compile("(\\{[^}]*\"name\"\\s*:\\s*\"" + Pattern.quote(itemName) + "\"[^}]*})").matcher(json); return matcher.find() ? Optional.of(matcher.group(1)) : Optional.empty(); } private Optional<Integer> getItemIDFromItemJson(final String json) { Matcher matcher = Pattern.compile("\"id\"\\s*:\\s*(\\d*)").matcher(json); return matcher.find() ? Optional.of(Integer.parseInt(matcher.group(1))) : Optional.empty(); } private Optional<String> getItemsJson() { try { 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); try (InputStreamReader in = new InputStreamReader(con.getInputStream()); BufferedReader br = new BufferedReader(in)) { String json = br.readLine(); json = json.replaceAll("\\\\u0027", "'"); json = json.replaceAll("\\\\u0026", "&"); return Optional.of(json); } } catch (IOException e) { e.printStackTrace(); } return Optional.empty(); } } Output: 8522 2 335 1333 379
-
GE Data (get price etc. by item name) no external libraries required
I noticed there was a slight error in one of the regex patterns, it may have been causing issues for you. I have fixed it in the original post.
-
Is it possible to run a bat file from inside a script?
Correct
-
Explv's AIO [13 skill AIO in 1 script]
Do you mean smelting? Because I just tested smelting gold bars and it works fine. I just tested making gold amulet (u)s and it doesn't stop after making 8 for me. Do you mean stringing amulets?
-
Explv's AIO [13 skill AIO in 1 script]
I have pushed fixes for both of these issues, they will be available when the SDN is next updated, thanks.
-
Explv's AIO [13 skill AIO in 1 script]
I have pushed a fix for selecting the option at the start of Tutorial Island. It will be available when the SDN is updated, thanks.
-
Time and Space Complexity of itertools.permuations
I think that the space complexity is O(n) because the method returns a generator, essentially meaning that it generates each value on request. The only thing stored is the input which is O(n)Regarding time complexity, I would assume that it is O(n!) to generate all of the permutations.
-
Time and Space Complexity of itertools.permuations
OP is asking if the time and space complexities he stated are correct, not for a 'shortcut'. Also big O notation is very useful as it is a high level way of expressing the efficiency of an algorithm, allowing you to see how it will scale and compare it with other algorithms. It isn't for showing off or just for homework...
-
Time and Space Complexity of itertools.permuations
Do you have to do it that way? It seems very inefficient
-
Show banned users + reasons for ban
I support having a list of banned users and the reason for them being banned. However, the email suggestion I disagree with. Consider the case where someone is falsely banned for scamming, their personal email is now released for people to abuse. Secondly, it is unlikely a scammer created their OSBot account with a non-throwaway email address anyway, and even if they have, they will just make a new account after this rule is enforced. Even if the scammer did create an OSBot account with a non-throwaway email address, what are you going to do with that information? I'm pretty sure doxing them is illegal Hacking their email is illegal So all you have done by releasing their email address is cause the above. Regardless of those points, it is probably illegal for OSBot to release that information in the first place.
-
Getting itemID by name
You have several options. If you know what items you want to buy, just hardcode the item ids Write your own buy method that uses item names instead of ids Use an existing buy method that uses item names instead of ids, there are already snippets around on the forum, for example: http://osbot.org/forum/topic/90148-simple-ge-api