May 26, 20187 yr Thanks a lot for this, really helpful. Will you be expanding on the GUI section at any point? or can you point me to a tutorial you think is useful for GUI's?
July 9, 20187 yr Author On 5/26/2018 at 12:31 PM, shaba123 said: Thanks a lot for this, really helpful. Will you be expanding on the GUI section at any point? or can you point me to a tutorial you think is useful for GUI's? Finished off the GUI section. Still not happy with it (don't think it is very tidy or well explained) but it is better than it was before. I may revisit again in the future.
July 21, 20187 yr I know there haven't been many posts to this recently. I was just running through the tutorial to see if I could get a script working (using Explv's pre-made script), then was going to delve into trying my own. How do you get the script to show up within OSBot's possible scripts to run? I'm using a mac so I created an artifact and put it into the correct file structure from step 2 I believe it is. Then step 3 mentions building the artifact and then refreshing the script list and it should be there. Are there any steps that I'm missing? Thanks for the help and awesome guide!
August 12, 20187 yr Entity tree = getObjects().closest("Tree"); if (tree != null && tree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating() || !tree.exists(); } }.sleep(); } New to OSBot, but not new to Java. I was following through your tutorial, and I am curious about your sleep condition in this snippet. Why do we want to stop sleeping if myPlayer is animating. Maybe I do not understand what that method will return, but my naive assumption is that myPlayer is animating while in the act of "chopping". It seems to me that this wouldn't sleep at all as it would meet the condition upon either "chopping" or walking to the next tree. Your thoughts on this would be much appreciated Thank you for an awesome guide. Edited August 12, 20187 yr by JaguarKnight
August 12, 20187 yr Author 30 minutes ago, JaguarKnight said: Entity tree = getObjects().closest("Tree"); if (tree != null && tree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating() || !tree.exists(); } }.sleep(); } New to OSBot, but not new to Java. I was following through your tutorial, and I am curious about your sleep condition in this snippet. Why do we want to stop sleeping if myPlayer is animating. Maybe I do not understand what that method will return, but my naive assumption is that myPlayer is animating while in the act of "chopping". It seems to me that this wouldn't sleep at all as it would meet the condition upon either "chopping" or walking to the next tree. Your thoughts on this would be much appreciated Thank you for an awesome guide. Walking != animating Once the player clicks the tree, this sleep will sleep until the player starts chopping the tree, or until the tree no longer exists, or until 5 seconds has passed. You would want to check if the player is chopping a tree (animating) first: if (!myPlayer().isAnimating()) { // If the player is not chopping a Tree Entity tree = getObjects().closest("Tree"); // Get the closest Tree if (tree != null && tree.interact("Chop down")) { // If the "Chop down" interaction is successful new ConditionalSleep(5000) { // Sleep for 5 seconds, or until the player is animating (chopping the tree), or until the tree no longer exists (someone else chopped it down) @Override public boolean condition() { return myPlayer().isAnimating() || !tree.exists(); } }.sleep(); } } You could also write this in a different way, by having a very long sleep: if (!myPlayer().isAnimating()) { // If the player is not chopping a Tree Entity tree = getObjects().closest("Tree"); // Get the closest Tree if (tree != null && tree.interact("Chop down")) { // If the "Chop down" interaction is successful new ConditionalSleep(90_000, 600) { // Sleep for 90 seconds, or until the tree no longer exists, checking if the tree exists at 600ms intervals @Override public boolean condition() { return !tree.exists(); } }.sleep(); } } Edited August 12, 20187 yr by Explv
August 12, 20187 yr Ah, that makes sense now. Thank you for such a thorough explanation! I was thinking the logic was ( sleep until no longer chopping or tree is gone ) which is kind of silly considering they would both be true at about the same time. Edited August 12, 20187 yr by JaguarKnight
October 21, 20187 yr Hey Explv! Thank you for your tuts, you're a shining light in the dark, especially for brainlets like me. On that note, if anyone else was having trouble with your gui, (I was getting this since the recent 2.5.24 update: "Cannot call invokeAndWait from the event dispatcher thread" ), on a guess I just removed the try/catch blocks, and it turns out this is all you need: (doing this is probably very wrong, I'm no one to learn from, but if you need your code to work, this solution may help, it did for me) Cheers! In your main class: private GUI gui = new GUI(); In onStart: gui = new GUI(); gui.open(); if (!gui.isStarted()) { stop(); return; } Edited October 21, 20187 yr by someguy69 Removed sentence fragments
October 21, 20187 yr Was looking for a guide to maybe get started scripting and this is awesome! Thanks Lifetime sponsorship already worth it with community like this
February 4, 20196 yr So I've been working on this Oak larder project for a bit now and I'm wondering where I would go from here: @Override public void onStart() { log("Welcome to Simple larders! Let's get started."); } @Override public int onLoop() throws InterruptedException { Entity larder_space = getObjects().closest("Larder space"); if (larder_space != null && larder_space.interact("Build")) { new ConditionalSleep(5000) { @Override public boolean condition() { return !larder_space.exists(); // Not sure I'm using this right either } }.sleep(); } return 1000; } @Override public void onExit() { log("Thanks for using Simple larders!"); } } Now that I got the bot interacting with the "Larder space" and clicking "Build" I'm trying to get it to interact with the widget: RS2Widget widget = widgets.get(458, 5, 4); Which is the "Oak larder" icon but I'm having trouble on implementing this so it flows step by step. My plans for the bot are too: // 0. Make sure your in front of "Larder space" in build mode before starting. // 1.Make bot check inventory to see if "Oak planks" exist. // 2.If true, "Build" the "Larder space" // 3."Remove" the "Larder" and repeat till > 5 "Oak planks" // 4.If > 5 then call butler to un-note "Oak planks" // 5.Wait for butler to get back with "Oak planks" // 6.Repeat You're tutorials helping a lot but some tips or a push in the right direction from someone that knows what they're talking about would be great! Edited February 4, 20196 yr by Imthabawse
April 23, 20196 yr Starting this now. Looks like the most recent guide for this I could find off google haha. If my computer ends up on fire I blame you Do you think codeacademy or something is a good place to fulfill that pre-requisite? @Explv Edited April 23, 20196 yr by Jacksonpm23
Create an account or sign in to comment