Everything posted by bumzag
-
Pick certain amount of items
After this question I promise I'll stop beating a dead horse: What I did was create an object using the RS2Object method and outputted the ID RS2Object redberries = getObjects().closest("Redberry bush"); log(redberries.getId()); I fully comprehend your point about checking the length of the modelID array, but with the code I posted, the log shows "23628" when there are berries, and then "23629" when there are no berries. Knowing this, couldn't I simply redeclare the bush variable to an object with an ID of 23628 instead of 23629? Nvm, the solution by FuryShark truly is far cleaner and more sufficient. BravoTaco, thank you again for the detailed explanation. You're an excellent teacher. For anyone that stumbles on this thread weeks/months/years from now, here is my code and I implemented FuryShark's solution if (!(getInventory().getAmount("Redberries") >= 3)) { walk(redberryArea); RS2Object redberryBush = getObjects().closest(o -> o.getName().endsWith("Redberry bush") && o.getModelIds().length > 1); if (redberryBush.exists()) if (redberryBush.isVisible()) if (redberryBush != null) { int redberryCount = Math.toIntExact(getInventory().getAmount("Redberries")); redberryBush.interact("Pick-from"); Sleep.sleepUntil(() -> getInventory().getAmount("Redberries") > redberryCount, 5000); } }
-
Pick certain amount of items
That all makes perfect. On a different note however, wouldn't it be possible to simply select the nearest bush by the desired ID? For example if the bush's ID changes, couldn't I then just reselect the other bush based on it's ID? So basically if (!(getObjects().closest(modelID)) == desiredID) I know thats not proper syntax but along those lines
-
Pick certain amount of items
Can you expand on this? Will it also target Cadava bushes?
-
Pick certain amount of items
This is why I love this site. Thank you for the detailed answer. The only problem is, with your solution, it still tries picking from the bush even if there's no berries and it still increments the for loop, so I eventually run away. Is there a way to monitor the chat for the error it spits out when there's nothing left on the bush?
-
Pick certain amount of items
I know this is a very simple concept but for some reason I'm struggling. I'm making a script to complete Goblin Diplomacy and I need to pick exactly 3 redberries. I know there's something inherently wrong with it, but here's my for loop thus far if (!(getInventory().getAmount("Redberries") == 3)) { walk(redberriesArea); RS2Object redberries = getObjects().closest("Redberry bush"); for (int i=0; i<4; i++) { int berryCount = i; redberries.interact("Pick-from"); Sleep.sleepUntil(() -> getInventory().getAmount("Redberries") == berryCount + 1, 5000); } } What am I doing wrong? It won't pick exactly 3, it'll pick one and then move on with the script, which makes the character run to a different area. Sometimes it'll pick 1, I think it's picked 2 before too.
-
Bots getting banned during tutorial island
Aah I see. And no, I have not used a proxy or VPN. I did however signup for large amounts of OSRS accounts in such a short period of time that I was prompted for a human-verification. I'll try verifying emails. Thanks all
-
Bots getting banned during tutorial island
You mean after the account has been created?
-
Bots getting banned during tutorial island
I made a bunch of accounts with temp emails and then loaded them into osbot. I was going to complete Tut island with Explv's script one-by-one, but it seems as though Jagex switched something up. I've used Explv's tutorial island probably a hundred times and never once did it cause a ban. It's an excellent script. But it seems as though Jagex may have caught on. Of the 4 accounts I've tried running through Tut island with Explv's script, 3 were suddenly logged out with the message "Account locked as we suspect it has been stolen" I know this is common and I'm not surprised it's happening. I'm not asking for a fix or complaining, just wondering if anyone has noticed this as well
-
[Quest] Rune Mysteries
Will do, if not for this little script then for the other stuff I'm working. I definitely catch nullpointers in the log all the time, something I need to improve on. I just got more acquainted with the dialogue side of the API so I'll make sure to brush up on more. Thanks man
-
[Quest] Rune Mysteries
Been working on an all-in-one trade restriction lifter, which includes getting 10qp. It's just easier to do Romeo & Juliet and Goblin Diplomacy. I doubt anyone will need it but here's a simple script to finish Rune Mysteries public Area dukeHoracioArea = new Area(3208, 3224, 3213, 3218).setPlane(1); public Area wizardTower = new Area(3102, 3164, 3104, 3163); public Area wizardTowerBasement = new Area(3101, 9574, 3107, 9567).setPlane(0); public Area varrockShop = new Area(3251, 3401, 3254, 3400); private void runeMysteries() throws InterruptedException { NPC dukeHoracio = getNpcs().closest("Duke Horacio"); NPC sedridor = getNpcs().closest("Sedridor"); NPC aubury = getNpcs().closest("Aubury"); if (configs.get(63) == 0) { walk(dukeHoracioArea); dukeHoracio.interact(); Sleep.sleepUntil(() -> dialogues.clickContinue() && dialogues.completeDialogueU("Have you any quests for me?", "Sure, no problem."), 5000); } if (configs.get(63) == 1 || configs.get(63) == 2) { walk(wizardTowerBasement); sedridor.interact(); Sleep.sleepUntil(() -> dialogues.clickContinue() && dialogues.completeDialogueU("I'm looking for the head wizard.", "Ok, here you are.", "Yes, certainly."), 5000); } if (configs.get(63) == 3) { walk(varrockShop); aubury.interact(); Sleep.sleepUntil(() -> dialogues.clickContinue() && dialogues.completeDialogueU("I have been sent here with a package for you."), 5000); } if (configs.get(63) == 4) { aubury.interact(); Sleep.sleepUntil(() -> dialogues.clickContinue() && !getDialogues().inDialogue(), 5000); } if (configs.get(63) == 5) { walk(wizardTowerBasement); sedridor.interact(); Sleep.sleepUntil(() -> dialogues.clickContinue() && !getDialogues().inDialogue(), 20000); } } public void walk(Area x) throws InterruptedException { if (!x.contains(myPosition())) getWalking().webWalk(x); } I'm sure there's plenty to be improved upon but I figured maybe it'll help someone.
-
Pass Area variable to method
Makes so much more sense. Thank you!
-
Pass Area variable to method
Awesome thanks man, that works. I had it set up like that but I didn't know the x was interchangeable. The x is just a placeholder and can be changed out with anything right? Like I could do private void walk(Area flippityFloppityFloomSham) { if(!flippityFloppityFloomSham.contains(myPositions())){ getWalking().webWalk(flippityFloppityFloomSham); } } And it would work the same, right? Thanks again
-
Pass Area variable to method
I apologize for asking another question so quickly. I want to create a reusable method for webwalking so I don't have to keep typing it out. Basically I want to do this: private void walk() { if (!x.contains(myPosition())) { getWalking().webWalk(x); Sleep.sleepUntil(() -> x.contains(myPosition()), 2000); sleep(random(100, 500)); } And I want to be able to call the method by doing walk(x); Somewhere in the script. So that I could change x to a different area, like "walk(cowArea);" or "walk(giantArea);" whenever I need. I know this is easy but it's kicking my ass.
-
Dialog box with multiple drop menus in one
I saw the GUI section in Explv's tutorial but for some reason didn't give it a chance. I should have read it further, thank you. And thank you for linking the other tutorial. I'll read through them thoroughly and get better acquainted.
-
Dialog box with multiple drop menus in one
I promise when I say, I have been searching endlessly, both on osbot and elsewhere for an answer to my question. Can someone point me in the direction of a tutorial or write-up on how to do a simple dialog box with multiple drop boxes? Basically I'm trying to make a script that, when it starts, it asks the user several questions and carries out the script based on those answers. I'd prefer the drop down boxes to be on the same single dialog pop-up instead of them popping up one after the other. I did read a question that said I have to create two JComboBoxes, place them in a JPanel and then place that JPanel into the JOptionPane's Object parameter". Which is cool and all but idk how to do that. Thanks
-
Pulling GE price's
I'm trying to use Explv's script to pull GE data but I can't figure out how to actually paint the data on screen. I've created the two classes "RSExchange" and "ExchangeItem" and then there's this snippet: All I want is the sell average from the JSON response but I don't know how to parse/output that info using paint.
-
Cannot resolve symbol "RS2Object" & Cannot resolve method "interact"
-
Cannot resolve symbol "RS2Object" & Cannot resolve method "interact"
I followed Explv's instruction to setup the environment and the osbot.jar shows in the dependencies tab in the Modules section of the Project structure but it still show's as an error when building the project.
-
Cannot resolve symbol "RS2Object" & Cannot resolve method "interact"
I know I've either asked this same question or see it answered on here but I can't find the thread. I'm rebuilding my Wheat Picker script and have to configure IntelliJ but I'm getting those errors. I know it's a simple fix but I can't remember how it's done. Any advice?
-
[BZG] Wheat Picker v1.0
Thanks for the advice, I pm'd you back and I've updated the code in this thread and the jar file to reflect it.
-
[BZG] Wheat Picker v1.0
Edit: This may be better suited for Resource Collection, feel free to move if so. Like so many others have said before, be gentle. I've written a few other very simple scripts, this is just one that I feel is decent. It's nothing special, just a simple wheat picker with a static area to pick wheat in the field in Draynor and deposits in Draynor's bank. I used Explv's Lambda expressions for conditional sleeps. I'm sure there's plenty of redundancies or ways to simplify/clean up the code, so if you see a way I'd love to hear it. Thanks. import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.map.Area; @ScriptManifest(name = "[BZG] Wheat Picker v1.0", author = "bumzag", version = 1.0, info = "Picks wheat in Lumbridge and banks in Draynor.", logo = "") public final class WheatPicker extends Script { private Area[] BANK = {Banks.DRAYNOR}; private Area wheatArea = new Area(3116, 3286, 3126, 3277); public void onStart() throws InterruptedException { } @Override public void onExit() { } @Override public int onLoop() throws InterruptedException { if (checkInvIsFull()) dumpInventory(); else { if(!wheatArea.contains(myPosition())) getWalking().webWalk(wheatArea); else { RS2Object wheat = objects.closest("Wheat"); long wheatBefore = getInventory().getAmount("Wheat"); if (wheat != null) { if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { if(wheat.interact("Pick")) Sleep.sleepUntil(() -> getInventory().getAmount("Wheat") > wheatBefore, 5000); } } } } } return(500); } private boolean checkInvIsFull() { return getInventory().isFull(); } private void dumpInventory() throws InterruptedException { if(!Banks.DRAYNOR.contains(myPlayer().getPosition())) { getWalking().webWalk(BANK); Sleep.sleepUntil(() -> Banks.DRAYNOR.contains(myPosition()), 2000); } getBank().open(); Sleep.sleepUntil(() -> getBank().isOpen(), 2000); getBank().depositAll(); Sleep.sleepUntil(() -> getInventory().isEmpty(), 2000); } } Download here
-
Buying items from general store
Ty for taking the time to answer. Makes a lot more sense now.
-
Buying items from general store
Ignore them in the sense that I can erase them out of the code?
-
Buying items from general store
Thanks man, it was simple as a sleep statement. I'll have to work on ConditionalSleeps. Thank you. Thank you for writing that out. Can you elaborate on stuff like "s.store.isOpen()" and "s.myPlayer().getPosition().distance(shop)" and "s.npcs.closest("Shop keeper")"? I don't understand the "s." portion of it. Where is that coming from?
-
Buying items from general store
Yeah dude idk what's going on. It trades with the shop keeper, outputs the log, waits a second, closes the shop and repeats. But it won't buy. Edit: on second thought, the log in the if(getStore().isOpen()) doesn't output, there fore it doesn't buy either. Also, I did refresh on the script GUI, and I know it did take the rebuild of the jar file because I changed the log string that's outside the if(getStore().isOpen() statement.