Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. Yes, you will be notified of an update in the app though.
  2. Explv

    Explv's Walker

    Script is fixed on the SDN.
  3. Simplest way would be: List<NPC> warriors = getNpcs().filter(new NameFilter<>("Al-Kharid warrior"));
  4. Explv

    Explv's Walker

    I know, I did a goof I already pushed a fix. It should hopefully be resolved tonight or tomorrow. The script only works currently if started from the command line.
  5. Only way I can think of right now is to try hopping to a members world and seeing if you can.
  6. 1. Not necessarily true, you could call the match function yourself with an invalid widget outside of the OSBot methods 2. I am using a foreach loop, I don't need to check if the array is empty 3. I personally think that this convention is purely personal preference and ancient history. I find code much more legible if I have early return conditions. If your code has many many return statements in a single function, then probably it is not as object oriented as it should be, in this case I do not think it applies. 4. If you look at how my loops are structured I only loop the widget's actions once, and the match actions are stored in a variable.
  7. Consider having a read of the Java Random.nextGaussian method: https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextGaussian--
  8. Explv

    Explv's Walker

    Done. Will be available when the SDN is next updated. UPDATES: These will be available when the SDN is updated: Added CLI parameters Alphabetically sorted location drop down list Display error message on screen when web walking fails
  9. Explv

    Explv's Walker

    Done, it will be alphabetically sorted when the SDN is next updated.
  10. Updated the code here, previously could cause NPE if RS2Widget.getInteractActions() contains a null value. Changed if (widgetAction.equals(matchAction)) To if (matchAction.equals(widgetAction)) Thanks for the bug report @The Undefeated
  11. It's my bad really, that but has been around for quite a while, I have been taking a break from working on this script. Got a lot of shit to fix!
  12. Explv

    C# Hw

    You could have Googled that and found a million examples, it's an extremely common question. Either way you should have been able to figure it out, especially if you're scripter Juan. Idk how you could not understand that question, it's a fookin for loop bro. Time to start expanding your brain fam. Although the for loop method is preferred, it can also be done recursively: int Factorial(int i) { if (i <= 1) return 1; return i * Factorial(i - 1); }
  13. I have a bunch of things I need to update and fix, will do it as soon as I can
  14. ???? Look at the API bro https://osbot.org/api/org/osbot/rs07/api/Inventory.html#dropAllExcept-org.osbot.rs07.api.filter.Filter...- It can take more than one filter as a parameter, or you can just add an OR condition to your existing filter. getInventory().dropAllExcept(item -> item.getName().contains("fishing") || item.getName().equals("Blah")); getInventory().dropAllExcept(item -> item.getName().contains("fishing"), new NameFilter<>("Blah"));
  15. 1. Scripts are written in Java 2. Whatever you want 3. Learn how to use Google 4. Learn how to program 5. Mac works fine 6. See no. 3
  16. Relax guys Here's a picture of a dog wearing a hat
  17. Did you try wrapping it in tin foil?
  18. No Edit: btw this is the scripting help section, it is for questions regarding the process of developing scripts, not for finding people to write you one. If you want someone to fix it, expect to pay, and post in the appropriate section
  19. Explv

    RS Unit Format

    Ok well, if you don't want to round then you can just do Math.floor(doubleValue * 100) / 100 to get the value to 2dp To achieve your super weird format you can use the Java class "DecimalFormat" with the format ".0#" # is an optional value (if it is 0 it won't be displayed), 0 is a digit public static String formatValue(final long value) { String suffix; double convertedValue; if (value >= 1_000_000_000) { convertedValue = ((double) value / 1_000_000_000); suffix = "b"; } else if (value >= 1_000_000) { convertedValue = ((double) value / 1_000_000); suffix = "m"; } else if (value >= 1000) { convertedValue = ((double) value / 1000); suffix = "k"; } else { return String.valueOf(value); } convertedValue = Math.floor(convertedValue * 100) / 100; return new DecimalFormat(".0#").format(convertedValue) + suffix; } Test cases: assert formatValue(559546000000L).equals("559.54b"); assert formatValue(19546000000L).equals("19.54b"); assert formatValue(1954600000L).equals("1.95b"); assert formatValue(155400000L).equals("155.4m"); assert formatValue(70000000L).equals("70.0m"); assert formatValue(5400000L).equals("5.4m"); assert formatValue(450000L).equals("450.0k"); assert formatValue(12000L).equals("12.0k"); assert formatValue(8000L).equals("8.0k"); assert formatValue(600L).equals("600"); assert formatValue(50L).equals("50"); assert formatValue(2L).equals("2");
  20. Explv

    RS Unit Format

    Simplest way you wieners: This will also ensure whole numbers are not printed with .0 at the end: public static String formatValue(final long value) { String suffix = ""; double convertedValue; if (value >= 1_000_000_000) { convertedValue = ((double) value / 1_000_000_000); suffix = "b"; } else if (value >= 1_000_000) { convertedValue = ((double) value / 1_000_000); suffix = "m"; } else if (value >= 1000) { convertedValue = ((double) value / 1000); suffix = "k"; } else { convertedValue = value; } if (convertedValue % 1 == 0) { return String.format("%d%s", (long) convertedValue, suffix); } return String.format("%.2f%s", convertedValue, suffix); } Test cases: assert formatValue(559546000000L).equals("559.55b"); assert formatValue(19546000000L).equals("19.55b"); assert formatValue(1954600000L).equals("1.95b"); assert formatValue(155400000L).equals("155.40m"); assert formatValue(70000000L).equals("70m"); assert formatValue(5400000L).equals("5.40m"); assert formatValue(450000L).equals("450k"); assert formatValue(12000L).equals("12k"); assert formatValue(8000L).equals("8k"); assert formatValue(600L).equals("600"); assert formatValue(50L).equals("50"); assert formatValue(2L).equals("2");
  21. If there aren't any then just leave it blank, it should auto fill it to "none".
  22. Great tutorial, I learned a lot, thanks!
  23. Explv

    Explv's Walker

    Can't remember if I added it, will take a look later
  24. You are making API calls before onStart() is called. You can't do that, as the API has not been setup yet. Move this code that is currently above onLoop: final Position starting = myPlayer().getPosition(); Inside of onStart() or onLoop(). Or if it needs to be a global variable, declare it globally: Position starting; Then initialise it in onStart() starting = whatever Sorry about formatting, on phone.
×
×
  • Create New...