Jump to content

Scorncial

Members
  • Posts

    13
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

556 profile views

Scorncial's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Thanks a lot, everything seems to be working fine now How could I implement the coditionalsleep, so that it only sleeps as long as the next dialogue has been opened?
  2. It's giving me another error, when I change "return random" with "sleep", Eclipse tells me: "Tha method sleep(long) in the type MethodProvider is not applicable for the arguments (int, int). So I suppose it's not possible to sleep a random amount of time? And it still gives me the unreacable error on the first "dialogues.clickContinue();".
  3. Now it tells me "org.osbot.rs07.api.Dialogues is never used" on line 4 and on line 26: "dialogues.clickContinue(); is unreachable code". import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.Dialogues; import java.awt.*; @ScriptManifest(author = "Me", info = "Buys Woad leaves from Wyson the gardener in Falador Park", name = "Woad Leaf Buyer", version = 0.1, logo = "") public class main extends Script { @Override public void onStart() { log("Woad Leaf Buyer has started."); } @Override public int onLoop() throws InterruptedException { if(!(inventory.getAmount(995) < 20)) { stop(); } NPC gardener = npcs.closest("Wyson the gardener"); if (gardener != null) { gardener.interact("Talk-to"); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.selectOption(2, 1); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.selectOption(4, 4); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.clickContinue(); return random(200, 300); dialogues.clickContinue(); } return random(200, 300); } @Override public void onExit() { log("Thanks for running Woad Leaf Buyer"); } @Override public void onPaint(Graphics2D g) { } }
  4. I did that and Eclipse is still giving me an error, it says: "getDialogues cannot be resolved".
  5. completeDialogue(java.lang.String... options) Completes the current dialogue using the specified options when available. How exactly should I use this so he picks the first option? This is the code I currently have, Eclispe is giving an error at each line starting with "Dialogues.", what's the proble there and how can I solve it? DO you guys have any other suggestions on things I could improve? import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.Dialogues; import java.awt.*; @ScriptManifest(author = "Me", info = "Buys Woad leaves from Wyson the gardener in Falador Park", name = "Woad Leaf Buyer", version = 0.1, logo = "") public class main extends Script { @Override public void onStart() { log("Woad Leaf Buyer has started."); } @Override public int onLoop() throws InterruptedException { if(!(inventory.getAmount(995) < 20)) { stop(); } NPC gardener = npcs.closest("Wyson the gardener"); if (gardener != null) { gardener.interact("Talk-to"); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.selectOption(2, 1); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.selectOption(4, 4); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.clickContinue(); return random(200, 300); Dialogues.clickContinue(); } return random(200, 300); } @Override public void onExit() { log("Thanks for running my first script"); } @Override public void onPaint(Graphics2D g) { } }
  6. I'm stille getting used to the API, so it's kinda hard to find ... Also, you gold me the coin id, bit how could I find such things myself?
  7. Super bedankt But I'll keep writing in english so other people can still understand ;) So I did look a bit into the api and when talking to the gardener I'll need to use the "dialogues" class and use "clickContinue()" to talk to him, but how can I make the bot chose a specific option when he gets offered one? for example the gardener will ask how much he wants to pay for the Woad leaf, and you have 4 options: 5, 10, 15 and 20 gp, how do I make the bot to chose for the 20 gp option?
  8. No problem, take your time I just saw you're The Netherlands, I'm from Belgium, so we both speak Dutch
  9. Thanks I see, that was very stupid of me Do you have any idea how I can check if the player is currently talking to the gardener?
  10. Thanks a lot, but I'm still getting an error on line 21, Eclipse says the following: And how can I find the Id for coins? This is my script now: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Luigi", info = "Buys Woad leaves from Wyson the gardener in Falador Park", name = "Woad Leaf Buyer", version = 0.1, logo = "") public class main extends Script { @Override public void onStart() { log("Woad Leaf Buyer has started."); } private enum State { TALK, WAIT }; private State getState() { if (condition 1 is true) { return State.TALK; } else { return State.WAIT; } } @Override public int onLoop() throws InterruptedException { if(!(inventory.getAmount(COINID) < 20)) { stop(); } switch (getState()) { case TALK: NPC gardener = npcs.closest("Wyson the gardener"); if (gardener != null) { gardener.interact("Talk-to"); } break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("Thanks for running my first script"); } @Override public void onPaint(Graphics2D g) { } }
  11. Thanks, your comments helped a lot Would you have an idea on how to solve the error on line 20? Also, if I can't define the NPC as an object as what should I define it? The coin thing should this be put between line 27 and 28?
  12. I would like to do that But could you tell me how?
  13. Hi, so I'm getting into Java scripting (but I know a decent amount of PHP) and as always, I learn best by actually doing stuff. So therefore I'd like to learn some really basic stuff by making a very simple script. The script I'd like to make should talk against Wyson the gardener at the Falador garden and buy Woad leaves from him. This is what I have so far: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Luigi", info = "Buys Woad leaves from Wyson the gardener in Falador Park", name = "Woad Leaf Buyer", version = 0.1, logo = "") public class main extends Script { @Override public void onStart() { log("Woad Leaf Buyer has started."); } private enum State { TALK, WAIT }; private State getState() { if (condition 1 is true) return State.TALK; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case TALK: NPC gardener = objects.closest("Wyson the gardener"); if (stall != null) { stall.interact("Talk-to"); } break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("Thanks for running my first script"); @Override public void onPaint(Graphics2D g) { } } I'm making this script based upon this beginners tutorial. Eclipse gives me an error on line 20, 30, 31 and 32. What am I doing wrong? Also how can I check if the user has more than 20 coins in his inventory and exit the script, if that ain't the case? Thanks for helping a starting noob like me
×
×
  • Create New...