Jump to content

Chicken Wing

Members
  • Posts

    610
  • Joined

  • Last visited

  • Feedback

    100%

Everything posted by Chicken Wing

  1. Literally realised I was using the wrong method as you posted this Thanks for the help
  2. How do I make the script change tab by pressing the function keys (e.g. f6 to switch to magic tab)? When I use getKeyboard().typeKey((char) KeyEvent.VK_F6); It just types "u", if anyone knows what's wrong I would be grateful for some help Edit: nvm I fixed it guy
  3. Oh I didn't realise it was the parent class (/facepalm), TY!
  4. This is exactly what I was looking for, thank you EDIT: EntityAPI is an abstract class? So I have to make those methods myself? I think I've found a solution to my problem so its ok now anyway.
  5. Is there a way to get a reference to an entity other than using objects.closest()?
  6. How do I check if there is an entity at a certain position? EDIT: I mean get a reference to an entity using a position oopsy
  7. http://www.asciitable.com/ Use the decimal number, so ESC would be 27 and tab is 9 oh and cast it as a char; getKeyboard().typeKey((char) 27);
  8. Refactoring does nothing, as I said the script was working with the exact same code I have right now, I think its some sort of build path error Yes, I did that twice, I even deleted the whole project, made a new one and copied over .java files which were uploaded to the sdn EDIT: I FIXED IT, NVM GUYS
  9. Can anyone explain what this stacktrace actually means? [ERROR][09/09 05:21:38 PM]: Uncaught exception! java.lang.NoSuchMethodError: core.Node.<init>(Lcore/Fletcher;)V at nodes.cut.OpenBank.<init>(OpenBank.java:12) at core.Fletcher.onStart(Fletcher.java:85) at org.osbot.rs07.event.ScriptExecutor.onStart(ni:197) at org.osbot.rs07.event.ScriptExecutor.start(ni:46) at org.osbot.com2.run(dn:246) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) My script was working fine, and compiles fine, but now even if I make a new project in eclipse and copy over .java files which i know are fine and run the jar I get this error, even when I use the same .java files which are used in the script on the sdn (and the sdn script works).
  10. Hey, is there a way to select an item in a specific slot in the inventory? I am using : sA.inventory.getItemInSlot(14).interact("Use"); to select the 14th unstrung bow, however it just selects the first one (which I understand why). Is there a way to do it without manually defining the area on the screen to click?
  11. I was having some problems with the default keyboard so I used your one, its very nice . And yeah thats an oopsy for not checking if its visible. Also if I add paint, and maybe an option to input the string of the log and some other stuff, would this be SDN worthy? (free ofc)
  12. Hey, I've been trying to get familiar with the api and wrote a simple fletching script, it would be great if some more experienced scripters could give some feedback package dev; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import util.SmartKeyboard; import java.awt.*; @ScriptManifest(author = "You", info = "My first script", name = "Fletcher", version = 0.1, logo = "") public class LogCutter extends Script { private boolean _hasKnife = false; private final static int LOG_ID = 1515; private final static int BOW_u_ID = 66; @Override public void onStart() { if(inventory.contains(946)){ _hasKnife = true; } log("Script started"); getMouse().setSpeed(1); } private enum State { WITHDRAW_LOGS, CUT_LOGS, WAIT, BANK_BOWS, WITHDRAW_KNIFE, RECOVER_UNEXPECTED_STOP }; private State getState() { if(!inventory.contains(946)){ return State.WITHDRAW_KNIFE; } if(_hasKnife && inventory.isEmptyExcept(946)){ return State.WITHDRAW_LOGS; } if(_hasKnife && inventory.getAmount(1515) == 27){ return State.CUT_LOGS; } if(_hasKnife && inventory.getAmount(66) == 27){ return State.BANK_BOWS; } if(_hasKnife && inventory.contains(LOG_ID) && !myPlayer().isAnimating()){ return State.RECOVER_UNEXPECTED_STOP; } return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case BANK_BOWS: openBank(); depositBows(BOW_u_ID); break; case CUT_LOGS: cutLongBows(LOG_ID); break; case WAIT: break; case WITHDRAW_KNIFE: openBank(); withdrawKnife(); break; case WITHDRAW_LOGS: openBank(); withdrawLogs(LOG_ID); break; case RECOVER_UNEXPECTED_STOP: cutLongBows(LOG_ID); break; } return random(200, 300); } // private methods ------------------------------------- private void withdrawLogs(int id) throws InterruptedException { if (this.bank.isOpen() && bank.contains(id)) { bank.withdrawAll(id); } new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.getAmount(id) == 27; } }.sleep(); bank.close(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !bank.isOpen(); } }.sleep(); sleep(random(290, 380)); } private void withdrawKnife() throws InterruptedException { if (this.bank.isOpen() && bank.contains(946)) { bank.withdraw(946, 1); } new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.getAmount(946) == 1; } }.sleep(); _hasKnife = true; sleep(random(290, 380)); } private void openBank() throws InterruptedException { if (!this.bank.isOpen()) { Entity bankBooth = objects.closest("Bank booth"); if (bankBooth != null) { bankBooth.interact("Bank"); } new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return bank.isOpen(); } }.sleep(); } sleep(random(280, 390)); } private void depositBows(int id) throws InterruptedException { if (this.bank.isOpen() && bank.contains(id)) { bank.depositAll(id); } new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.getAmount(id) == 0; } }.sleep(); sleep(random(290, 380)); } private void cutLongBows(int id) throws InterruptedException { if(inventory.contains(id)){ inventory.getItem(946).interact("Use"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.isItemSelected(); } }.sleep(); inventory.interact("Use", id); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return dialogues.isPendingOption(); } }.sleep(); sleep(random(280, 390)); widgets.get(304, 10).interact("Make X"); sleep(random(400, 700)); new SmartKeyboard(this, 65).typeString("33", true, false); sleep(random(280, 390)); getMouse().moveOutsideScreen(); new ConditionalSleep(100000) { @Override public boolean condition() throws InterruptedException { return inventory.getAmount(BOW_u_ID) == 27; } }.sleep(); sleep(random(280, 390)); } } // --------------------------------------------------------------------------- @Override public void onExit() { log("Script stopped"); } @Override public void onPaint(Graphics2D g) { } }
  13. Hey, I'm trying to use the widget debugger with the widget debug mode. When I hover over the widgets, 6 numbers appear, but what do the numbers mean?
×
×
  • Create New...