Everything posted by Explv
-
Looking for feedback on first script
In this case I would probably just make your method throw an InterruptedException.
-
Looking for feedback on first script
getBank().open() Throws an InterruptedException. You either need to catch the exception or make your method throw an InterruptedException as well
-
Looking for feedback on first script
Firstly the answers to your questions: If i make a GUI, should it be in a separate class? It's up to you, it would be cleaner if it was in a separate class. Am I using ConditionalSleep correctly? Yes and no, the ConditionalSleep itself is fine, but you are calling it in the wrong place. You should only call the ConditionalSleep after you have checked the tree is not null and also after you have checked the interaction with the tree was successful. Otherwise your script will sleep when it shouldn't. Would using States make this script better? No, personally I don't think anyone should use States, because you are separating the condition from the action, which just makes it harder to read. I think that when your script becomes more complex, you should separate it out into classes and methods accordingly. If I have a complex script, should I put all my functions in a separate module? I don't understand what you mean by this question, consider reading some basic OOP tutorials. Other issues I can see looking at your code: Remove the onStart() and onEnd() methods considering you aren't doing anything useful in them Declare the Area lumbridgeTrees as a private global variable so that you aren't redefining it every time onLoop is called After you do the check for if the inventory is full, I would probably make the next if statement an else if You don't need to web walk to a random position in the Area lumbridgeTrees, just call webWalk(lumbridgeTrees) You probably want to check if the player should chop a new tree (your ableToWork()) method before finding a new Tree, otherwise you are just constantly looking for the closest tree when you don't even want to chop it. You should only perform the conditional sleep after the .interact("Chop down") method has returned true. You should return boolean instead of Boolean from the method ableToWork() You should follow Java naming conventions, (the name of your class should start with an uppercase letter). Also, although it doesn't particularly matter in this context, I would give your Script class a better name than "Main", perhaps "Woodchopper" would be more appropriate.
-
How to not wait till npc dieing animation is ended
Just do something like: if (myPlayer().getInteracting() == null) { NPC cow = getNpcs().singleFilter(getNpcs().getAll(), new NameFilter<>("Cow"), Character::isAttackable); if (cow != null && cow.interact("Attack")) { new ConditionalSleep(5000) { @ Override public boolean condition() throws InterruptedException { return myPlayer().isInteracting(cow) || !cow.isAttackable(); } }.sleep(); } }
-
Script help [This script will remain Open Source for others to learn]
I don't use Eclipse but I believe that you need to set the compliance level to 1.8 under the compiler section in properties
-
Explv's OSBot Manager
Ok, I didn't actually test the client closing on linux, I just wrote it and prayed. I'll fix it asap.
-
Explv's OSBot Manager
What distribution?
-
Explv's OSBot Manager
Are you using Linux?
-
Explv's OSBot Manager
There is a bug I need to fix for usernames with a space in them, for now use "Hi G00gle" as your username (with the quotes). I will fix this in the next version
-
Explv's OSBot Manager
Check the log (right click the configuration and select view log) if it says the script stopped then it's an issue with your script. The logs will remain until you start the configuration again so you can check them
-
How to check if item is stackable?
You don't need to make a duplicate thread. Just edit your first one
-
Explv's OSBot Manager
Issue fixed, user was using openJDK, installed oracle JDK instead
-
Paint Help? Using web Image
Try Image image = ImageIO.read(URL);
-
Paint Help? Using web Image
Did you even define the method getImage?
- Checking if an account is banned
-
Explv's OSBot Manager
Just an update on this, I have successfully written a method to check if an account is banned, it takes 1 or 2 seconds to check an account, and does so by logging into the RuneScape website and checking the account settings page. I will integrate this into the GUI tonight or tomorrow
-
Explv's OSBot Manager
I will see what I can do I don't understand what you are trying to ask
-
OSBot CLI Script Creator - Manage your bots easily
I believe that only works for free scripts. The best way to get the SDN ID is to run the script, the ID will be in the log
-
Explv's AIO [13 skill AIO in 1 script]
Just pushed a fix, it will be available when the SDN is next updated Will take a look at these issues as soon as possible, thanks Haven't had time to address this yet, will look at it ASAP When I have ironed out all the bugs, and added some more features then I will likely request it to be premium
-
Explv's OSBot Manager
UPDATED 2017-01-11 - Now loads all scripts found in a single .jar Thanks to @PineappleSausage for the contribution
-
Explv's OSBot Manager
You can already view the logs, I haven't added a button yet but if you right click a configuration and select view log it will display.Thanks, I'll take a look at your git request tomorrow after work I will also add some build instructions to the readme
-
Calling a different script from within one?
If you just want to execute a script after another has stopped you can use my manager: http://osbot.org/forum/topic/100554-explvs-osbot-manager/ But if you need something more complex, you could try initialising a script like so (I have not tested this): // Initialise the script Script someOtherScript = new SomeScript(); someOtherScript.exchangeContext(getBot()); // Call onStart someOtherScript.onStart(); // In onLoop of your wrapper script call return someOtherScript.onLoop(); You would probably also need to override the stop() method of the script you are running, so that it doesn't stop the ScriptExecutor and does something else instead.
-
[Help] Sleeping With No Animation
Easiest solution is just to sleep until either your player can no longer combine items, or (if applicable, your character has leveled up): new ConditionalSleep(60_000) { @ Override public boolean condition() { return !canCombine() || getDialogues().isPendingContinuation(); } }.sleep(); Where canCombine() would be something like: public boolean canCombine() { return getInventory().contains("Item 1") && getInventory().contains("Item 2"); }
-
Frist script: 1-60 WC Straight from tutorial island [Looking for Feedback]
Issues in the order that I see them: No need to store starting level or starting experience, you can use the ExperienceTracker in the API to calculate experience and levels gained No need to store time elapsed as a global variable as you will be recalculating this every time you paint anyway You don't need to initialise a boolean value to false, it's false by default It would be cleaner to use an Enum to store the data for the different trees, you can store the area in which you can find the tree, the level required etc. Instead of downloading the paint image every time, you can just store the image locally in the .jar You don't need to initialise a new Color for black and white, they already exist Color.BLACK and Color.WHITE (You may have got this from my GUI tutorial, which I should really update) But you don't need to store a fixed size for the GUI, you should let it calculate the size itself based on its contents You can centre the GUI using setLocationRelativeTo(null) This is a matter of preference but I think using States is pretty pointless, I think it's easier to read and understand if the conditions are in the same place as the code being executed based on those conditions Instead of calling the same method treeCut with different parameters based on the player's wc level, it would make more sense to just have a global variable with the current tree name and area, change those variables based on the player's wc level, and then just have a single call to treeCut with those variables. Again this would be simpler if you had a Tree Enum Instead of calling sleep after each case statement, it would make more sense just to break, and then return the sleep value at the end of the onLoop method, which you are already doing, so basically you are sleeping twice. In your tree cut method you check if your player is in the tree area, and if not you walk there, it would make sense to do this before the treeCut method, and leave the treeCut method to do what it's name implies, cut the trees. You aren't making use of ConditionalSleeps in your code, for example after you interact with the tree, you just do a random sleep, this can result in spam clicking the tree. What you should do instead, is check the boolean return value of the interact method, if it is true, then do a ConditionalSleep with a timeout e.g. 5 seconds, with the exit condition that the player is animating (chopping the tree) You call camera.toEntity(tree), which I believe is redundant, because the interact method will already move the camera to face the tree if it is not visible Consider making use of classes, for example moving your GUI to a separate class to make your code more readable and maintainable Hope that helps
- 1k pc