Jump to content

uyfgfarOS

Members
  • Posts

    51
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

1306 profile views

uyfgfarOS's Achievements

Iron Poster

Iron Poster (3/10)

6

Reputation

  1. Can someone help? I can't download it. When I click the link, nothing happens. When I try update through OSBot, it just greys out 'Update to v2.6.71' and nothing happens EDIT: nevermind, right click save as saved the day
  2. Re-using old code that worked perfectly. I get stuck at the log "Store is open" Any ideas why it's not finding the widget and proceeding with the method? It's not actually being used for grapes anymore, I'm just using the grape code. Widget numbers are correct for the new widget. int buyGrapes() throws InterruptedException { if (store.isOpen()) { log("store is open"); sleep(300); RS2Widget grapeWidge = getWidgets().get(300, 548, 300); if (grapeWidge != null) { grapeCount = grapeWidge.getItemAmount(); if (grapeCount > 0) { log("Shop in stock, buying"); grapeWidge.interact("Buy 10"); sleep(400); } else if (grapeCount == 0) { getWorlds().hopToP2PWorld(); //state = State.HOP; } } } return 0; }
  3. Hi mate, it's because I wasn't running it on Java SE 1.8. I got confused thinking that wasn't Java 8, but it is
  4. Just set up my IDE (Eclipse) and using some old code from a previous bot I scripted. Getting the error [ERROR][01/16 04:31:07 PM]: Failed to load local script : buyer/main$State.class [ERROR][01/16 04:31:07 PM]: Failed to load local script : buyer/main.class I thought it may be my code, so loaded up a skeleton script that I know has 0 issues. Same error with that, too. I had one of the newer Javas, uninstalled that and tried just using Java 8, same error again. Any ideas? Cheers.
  5. Hi mate. Can i get a trial please? Looks sick
  6. Same here, I think the bot is down
  7. Cheers for your patience. I can see this is a lot simpler now, I think the whole switch case thing was confusing me. Only thing I had to change from your code was the fact that the Culinaromancer chest doesn't like the buy option, so I have to use widgets. Also once my inventory is full it's sat spamming on the grapes (0) to buy them. That's something I'll try figure out. Thankyou!
  8. Hi mate, thanks for the reply. In my mind I thought the loop would take care of changing states. I have added a state change into both hopping & banking now. But a little unsure. My hopping method looks like this now: int hopping() throws InterruptedException { int hopCount = 0; log("hopping"); while (hopCount == 0) { getWorlds().hopToP2PWorld(); hopCount = 1; } state = State.OPENCHEST; return 0; } I can appreciate I probably don't need the while loop in there, I was just trying something out as I changed state to OPENCHEST, hoping it would hop and then open chest, but it opens the world viewer and then clicks the chest, without hopping. Apologies if it's dumb on my part I've been out of coding for about 3 years
  9. Hi guys, creating a script to buy grapes & hop. All working fine except when it hops it will be stuck in the hopping method. I've tried using counters to counteract it being stuck inside the method but I can't seem to get it out. package testBuyer; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import testBuyer.main.State; import java.awt.*; import javax.swing.text.html.parser.Entity; @ScriptManifest(info = "GRAPE BUYER", version = 1.0, logo = "", author = "MATT", name = "Test2") public class main extends Script { int grapeCount = 1; enum State { OPENCHEST, BUYGRAPES, BANK, HOP; } public State state; public void onStart(){ if(getInventory().isFull()) { log("FULL - BANKING"); state = State.BANK; } if (getInventory().onlyContains("Coins")) { log("ONLY COINS IN INVENT"); state = State.OPENCHEST; log("OPEN CHEST"); } if(getStore().isOpen()) { state = State.BUYGRAPES; } if (grapeCount == 0) { log("out of grapes"); state = State.HOP; } if (getInventory().contains("Coins") && getInventory().contains("Grapes") && !getInventory().isFull()) { log("Invent has coins & grapes, but isn't full."); state = State.OPENCHEST; } } public int onLoop() throws InterruptedException{ switch (state){ case OPENCHEST: return openChest(); case BUYGRAPES: return buyGrapes(); case BANK: return bank(); case HOP: return hopping(); } return random(100, 220); } int openChest() throws InterruptedException { objects.closest("Chest").interact("Buy-food"); sleep(900); if (getInventory().contains("Coins") && !getInventory().isFull()) { log("Changing state to buying"); state = State.BUYGRAPES; } return 0; } int buyGrapes() throws InterruptedException { if (store.isOpen()) { log("store is open"); sleep(300); RS2Widget grapeWidge = getWidgets().get(300, 16, 5); if (grapeWidge != null) { grapeCount = grapeWidge.getItemAmount(); if (grapeCount > 0) { log("Shop in stock, buying"); grapeWidge.interact("Buy 10"); sleep(400); } else { state = State.HOP; } } } return 0; } int hopping() throws InterruptedException { log("hopping"); getWorlds().hopToP2PWorld(); grapeCount = 1; return 0; } int bank() throws InterruptedException{ getBank().depositAllExcept("Coins"); sleep(300); return 0; } } Here's what the log shows, initially when entering the hopping method it will show the log "hopping" twice, instantly. Followed by loads. [INFO][Bot #1][01/10 11:26:05 AM]: hopping [INFO][Bot #1][01/10 11:26:05 AM]: hopping [INFO][Bot #1][01/10 11:26:05 AM]: hopping [INFO][Bot #1][01/10 11:26:05 AM]: hopping [INFO][Bot #1][01/10 11:26:05 AM]: hopping [INFO][Bot #1][01/10 11:26:05 AM]: hopping Thanks a lot guys.
  10. Not finding any widget, It gets to the log stating the store is open, but won't get to the next log "buying 10" if (store.isOpen()) { log("store is open"); sleep(300); RS2Widget grapeWidget = getWidgets().getWidgetContainingText("Grapes"); if (grapeWidget != null && grapeWidget.interact("Buy 10")) { log("buying 10"); sleep(300); } I then thought that the interact should be within the if statement, so I moved it there but still same results. EDIT: Solved by just changing the widget declaration to RS2Widget grapeWidge = getWidgets().get(300, 16, 5);
  11. Ah apologies mate, it's been a while haha! I'll try this out now. Appreciate it.
  12. I was trying to figure this out earlier, I can get the widget for the grape, but I can't figure out how I'd move the mouse cursor down to the buying option, as there isn't a widget for the mouse position I want. Hmm okay cheers for that! Once I've got it buying I'll see if the hop method works or not.
  13. Hi all, not wanting to get properly back into coding I just can't be bothered to buy grapes from the Culinaromancer chest. I wrote a little script but it doesn't seem to buy from the store. Is it because it's a chest, rather than an NPC? It will open up the shop & jump to the buying grapes method but it won't actually buy them. Probably a simple fix but I'm rusty. Cheers. package cookingTrainer; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import javax.swing.text.html.parser.Entity; @ScriptManifest(info = "GRAPE BUYER", version = 1.0, logo = "", author = "MATT", name = "") public class main extends Script { enum State { OPENCHEST, BUYGRAPES, BANK, HOP; } public State state; public void onStart(){ if(getInventory().isFull()) { state = State.BANK; log("BANK"); } if (getInventory().onlyContains("Coins")) { state = State.OPENCHEST; log("OPEN CHEST"); } if(getStore().isOpen()) { state = State.BUYGRAPES; } } public int onLoop() throws InterruptedException{ switch (state){ case OPENCHEST: return openChest(); case BUYGRAPES: return buyGrapes(); case BANK: return bank(); case HOP: return hopWorlds(); } return random(100, 220); } int openChest() throws InterruptedException { objects.closest("Chest").interact("Buy-food"); sleep(900); if (getInventory().contains("Coins") && !getInventory().isFull()) { if (!getStore().contains("Grapes")) { state = State.HOP; log("HOPPING"); } else { log("Changing state to buying"); state = State.BUYGRAPES; } } return 0; } int buyGrapes() throws InterruptedException{ log("BUYING"); if (!getStore().contains("Grapes")) { store.close(); sleep(300); state = State.HOP; log("HOPPING"); } else { log("BUYING GRAPES NOW"); if (store.isOpen()) { log("store is open"); sleep(300); store.buy("Grapes", 10); sleep(300); sleep(300); sleep(300); } } sleep(300); return 0; } int bank() throws InterruptedException{ getBank().depositAllExcept("Coins"); sleep(300); return 0; } int hopWorlds() throws InterruptedException { getWorlds().hopToP2PWorld(); sleep(300); return 0; } }
  14. SOLVED: For anyone else having this issue, I had to change the JRE environment to JavaSE-1.8, as it was on JavaSE-15 and it now works.
×
×
  • Create New...