Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. What d0zza said, or preferably make it a private int with a public getter method. Side note: I would recommend staying away from the task system people here use. It is overcomplicated, messy and counter-intuitive. Considering you are writing a chicken killer I don't know why you wouldn't just put this all in a single class. However if you want multiple classes, there are better ways to achieve it. Also you could remove a lot of duplicate code from your onPaint with a simple for loop.
  2. Check if the NPC you are fighting has 0 health, or no longer exists. If that is the case, increment your kill counter by 1 and look for a new NPC to fight.
  3. The timeRan variable should be local to the onPaint function. The Runescape area should be private, final, and start with a lowercase first letter, as per standard Java conventions. There should be a new line in between each method for better readability. The class should start with an uppercase first letter, as per standard Java conventions. Version number is 2, is this really version 2 though? info and logo in the @ScriptManifest attribute are severely lacking. You don't need to check that your player isn't moving before calling web walk. The indentation is completely fucked in some places. onExit method is unnecessary, and definitely misleading as it prints "Hello" to the logger when the script is in fact exiting. The methods and class should be final just in case someone in Lumbridge tries to override them. Do you really need to sleep for 100ms in between loops, when all you are doing is calling getWalking().webWalk()? Otherwise, good job!
  4. An example of a post-test loop would be a do while loop. For example: do { // some stuff } while(some condition is true); // check this after The contents of this loop will execute at least once, because the condition is checked after the loop completes NOT before. This is different from a while loop where the condition is checked first: while (some condition is true) { // Check this first // some stuff } An example use of this is sanitizing input because you may want to get some input from the user THEN check it, and only exit the loop if some condition is matched. Consider this trivial example: Scanner scanner = new Scanner(System.in); String input; do { input = scanner.nextLine(); // Read a line of input } while (!input.equals("Hello")); // Only exit the loop if the input matches "Hello"
  5. Have you verified that the .jar is not empty? You have to make sure you add the "compiled output" to your .jar in the artifact settings (by moving it to the left hand side) like in this image (sorry not OSBot specific because I'm on my phone)
  6. If you are rebuilding the same artifact it will work fine. Intellij states that there is an error, something along the lines of unable to delete .jar, but it still works. Just make sure you press refresh in the script selector on OSBot. Why are you dragging the .jar file to the scripts folder? In the artifact settings just set the path to the scripts folder. In what way do you think that it is not working? Have you tried doing something simple like, changing the script name in the script manifest attribute, rebuilding the artifact, then refreshing the script list in OSBot and seeing if the script name changes?
  7. The "No Randoms" option is not for dismissing randoms.
  8. I wrote something similar for someone before, you need to hover the widgets: //Credits to Explv //Main class private Skill currentAttStyle; private void setAttackStyle(final Skill attackStyle) { Event attStyleEvent = new AttackStyle(attackStyle.toString()); execute(attStyleEvent); if (attStyleEvent.hasFinished()) { currentAttStyle = attackStyle; } } //AttackStyle class public class AttackStyle extends Event { private final int attackStyleParent = 593; private final int[] attackStyleChildren = {3, 7, 11, 15}; private final String xpType; private int attackStyleToCheck = 0; public AttackStyle(final String xpType) { this.xpType = xpType; } @Override public int execute() throws InterruptedException { if (getTabs().getOpen() != Tab.ATTACK) { getTabs().open(Tab.ATTACK); return 0; } RS2Widget attackStyleWidget = getWidgets().get(attackStyleParent, attackStyleChildren[attackStyleToCheck]); if (attackStyleWidget == null) { setFailed(); return 0; } if (!attackStyleWidget.hover()) { return 0; } sleep(random(500, 600)); if (getWidgets().singleFilter(attackStyleParent, widget -> widget.getMessage().matches(".*\\(" + xpType + " XP\\)$")) == null) { attackStyleToCheck++; if (attackStyleToCheck >= attackStyleChildren.length) { setFailed(); } return 0; } Rectangle widgetBounds = attackStyleWidget.getBounds(); double colorX = widgetBounds.getMinX() + 5; double colorY = widgetBounds.getMinY() + 5; if (getColorPicker().colorAt((int) colorX, (int) colorY).getRed() > 100) { log("Already selected"); setFinished(); return 0; } if (attackStyleWidget.interact()) { setFinished(); } return 0; } }
  9. https://osbot.org/api/org/osbot/rs07/api/map/constants/Banks.html
  10. Seems like a duplicate of this question: https://osbot.org/forum/topic/121176-osbot-dropping-bot-like/?do=findComment&comment=1376627
  11. Such as? I just tested it, and it works fine
  12. Only if you want to get the script parameters that the user has set. You can get the script parameters using getParameters() The script parameter format will be set by the script writer. It will likely be on the script thread, if not you will have to ask them. It may be the case the script has no parameters at all, in which case you can just set the script parameters to "none". You cannot set breaks using CLI. Not sure exactly sure what you mean by automatically close down a bot from the command line, do you mean when the script exits, or after x amount of time?
  13. Just sleep until either the inventory does not contain flax, or the dialog is pending continue: return !getInventory().contains("Flax") || getDialogue().isPendingContinuation();
  14. You should read some tutorials, there are loads on this website, and learn basic Java if you have not done that yet.
  15. Not really sure what you mean. If you want to do something when the script exits, override the onExit method in the Script class: @Override public void onExit() { }
  16. https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)
  17. If an item is stackable, it's noted id will be -1. Here is a test example: // Fire rune (stackable) log("Fire rune noted id: " + ItemDefinition.forId(554).getNotedId()); // Cannonball (stackable) log("Cannonball noted id: " + ItemDefinition.forId(2).getNotedId()); // Yew logs (not stackable) log("Yew logs noted id: " + ItemDefinition.forId(1515).getNotedId()); Output: [INFO][Bot #1][05/03 10:17:00 PM]: Fire rune noted id: -1 [INFO][Bot #1][05/03 10:17:00 PM]: Cannonball noted id: -1 [INFO][Bot #1][05/03 10:17:00 PM]: Yew logs noted id: 1516 So to check if a ground item is stackable: groundItem.getDefinition().getNotedId() == -1
  18. Have you tried this to check if it is noted: groundItem.getDefinition().isNoted()
  19. It's going to be tough to scam when you're just a greyname. And so far you've only made $35 in 3 months by scamming. So you'd probably be better off getting a job at McDonald's or something
  20. So in protest of being banned for scamming... you're going to scam?
×
×
  • Create New...