Everything posted by Explv
-
Guess the next scam quitter
@@Dbuffed or @
-
Can I do any of these... ?
You're welcome. I don't think that the AudioListener class is even listed on the API, so your search would have been futile.
-
Can I do any of these... ?
You can add an AudioListener like so: getBot().addAudioListener(i -> {}); Haven't used it before so I'm not too sure what the integer value is, might be the id of the track. What exactly are you trying to achieve?
-
Explv's AIO [13 skill AIO in 1 script]
Good to hear you're enjoying the script. Sorry about the slow updates I have been very busy at work. I'll take a look at this issue this weekend for you. Thanks.
-
Finished my first script and was looking for a little feedback
1) You should have used ExperienceTracker for tracking xp, levels in skills etc. 2) The format time method is ugly For the above two points, Consider reading my Paint tutorial http://osbot.org/forum/topic/87697-explvs-dank-paint-tutorial/ 3) You are using fixed sleeps every where, you should use ConditionalSleep instead where appropriate, so that you can sleep until a condition is true, or for a timeout. 4) There is no point using "States" here, a single if condition would have done the trick, and generally states don't really make anything more readable. 5) Although you have mostly done it, I would recommend splitting your code up into more methods. A method should only be doing one thing. For example, your attacking code should be in a separate method. 6) Adding log statements in onStart() and onExit() like "Welcome to blah". Obviously, this is not an issue, but I don't understand why people do it. When you start a script the logger will already print "Script Started blah", and when you stop it "Script stopped blah". So overriding the onExit() method just to add that seems pointless.
-
Path Visual Tracker
Google Maps JavaScript API? https://developers.google.com/maps/documentation/javascript/examples/polyline-simple
-
Typing instantly
So this is a snippet I wrote as a reply to a thread, but it's pretty buried and some people may find it useful: public final void typeStringInstant(final String output){ for(int i = 0; i < output.length(); i ++){ getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, output.charAt(i)); } getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, (char) VK_ENTER); }
-
Does anybody know?
Why would you need to know that? I'm assuming you want to know how long to sleep for, if not, disregard this: The simplest way to sleep until a fire is lit, is to sleep until the player's position has changed. The player always moves after lighting a fire, so you can just do something like: Position currentPos = S.myPosition(); if(S.getInventory().getItem("Logs").interact()) { new ConditionalSleep(15_000) { @ Override public boolean condition() throws InterruptedException { return !S.myPosition().equals(currentPos) && !S.myPlayer().isMoving(); } }.sleep(); }
-
Why is my script attacking NPCs already in combat?
Instead of checking if your player is under attack (the chicken might not be fighting back), instead you can check if your player is interacting with a Chicken. Also, in your ConditionalSleep, considering it takes time for your player to walk to the chicken, and another player might attack it first, you should check in your sleep condition if the chicken is under attack, or dead etc. Consider this short example (untested): import org.osbot.rs07.api.filter.NameFilter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Chicken Killer", info = "Kills Chickens...", author = "Explv", version = 0.1, logo = "") public final class ChickenKiller extends Script { private NPC currentChicken; @[member='Override'] public final int onLoop() throws InterruptedException { if(!isAttackingChicken()) attackChicken(); return random(150, 200); } private boolean isAttackingChicken() { return currentChicken != null && currentChicken.exists() && currentChicken.getHealthPercent() > 0 && myPlayer().isInteracting(currentChicken) && currentChicken.isUnderAttack(); } private void attackChicken() { currentChicken = getClosestChicken(); if(currentChicken != null && currentChicken.interact("Attack")) { new ConditionalSleep(5000) { @[member='Override'] public boolean condition() throws InterruptedException { return myPlayer().isInteracting(currentChicken) || !isAttackableTarget(currentChicken); } }.sleep(); } } private NPC getClosestChicken() { return getNpcs().closest( new NameFilter<>("Chicken"), this::isAttackableTarget ); } private boolean isAttackableTarget(final NPC target) { return target != null && target.exists() && target.getHealthPercent() > 0 && !target.isUnderAttack(); } }
-
Explv's Walker
That's weird, I'll take a look at it, thank you
- Lenny cursor ( ͡° ͜ʖ ͡°)
-
HHopper | Hop to a specific world + interrupt condition
Good job Except for the if if if if if .... You can easily avoid that if you just invert the condition like: if (!script.getTabs().getOpen().equals(Tab.LOGOUT)) { script.getTabs().open(Tab.LOGOUT); return false; }
-
The @Override annotation is replaced by User OverRideCwalk's name
No
-
The @Override annotation is replaced by User OverRideCwalk's name
He was last seen 2014, so I'm not too worried about spam. Inb4 someone makes a new account called FunctionalInterface
-
The @Override annotation is replaced by User OverRideCwalk's name
This thread is for the developers of the website to see, so don't worry about understanding it....
-
The @Override annotation is replaced by User OverRideCwalk's name
Yeah... my uh... IDE is doing that...... The problem is, when you try to put the annotation @ Override (without the space) inside of code tags, and then submit your post / edit. @ Override is automatically replaced with that user's name. See this reply in the scripting help section: http://osbot.org/forum/topic/103825-cant-get-conditionalsleep-to-validate/?p=1159828 Note how the accepted solution by Khaleesi has a space between the @ and Override to prevent it from happening.
-
The @Override annotation is replaced by User OverRideCwalk's name
So this problem is recent, @@OverRideCwalk's name appears instead of the Override annotation inside of the code tags. Consider this simple example: public class Example { @[member='OverRideCwalk'] // This should be @ Override (no space) public String toString() { return "His username messes this up"; } } People are currently working around this issue by putting a space between the @ and the annotation: public class Example { @ Override public String toString() { return "This works fine"; } }
-
GE Data (get price etc. by item name) no external libraries required
sigh perhaps you should read up on the Java Garbage Collector then. If you are really concerned about memory usage, then perhaps you should use a profiler to see how much memory, and where the memory is being used. It isn't really a concern though. It's just a Map containing a few objects..
-
In your opinion how likely is the person that comments above you to scamquit
Well now we know that you would kappa
-
In your opinion how likely is the person that comments above you to scamquit
500k and he's out
-
In your opinion how likely is the person that comments above you to scamquit
11/10
-
How do slots work?
The source code is heavily obfuscated, so I wouldn't bother trying to read it. In terms of the getSlot() method, as the API does not specify anything else, it is safe to assume that it would return an index from 0 to the inventory size. Most methods that return some form of index would start at 0, and you know that the inventory has 28 slots. As a valid index would always be positive, -1 is typically used to indicate that a valid index could not be found, you will find this everywhere in programming. Regarding the ordering, you can't know for sure as it's not in the API, but most people would assume left to right in rows. If you don't know exactly how something works, just write a little test and you'll find out.
-
How do slots work?
This is something you could have easily figured out yourself by doing a small amount of testing. The definition of getSlot() looks like: public int getSlot(final Item item) { if(item == null) { return -1; } else { Item[] items = getInventory().getItems(); // returns an array of size 28 for(int i = 0; i < items.length; i++) { if(items[i] != null && items[i].equals(item)) { return i; } } return -1; } } As you can see, if the item is not found it returns -1. Otherwise it returns a value from 0 (inclusive) to 28 (exclusive). 0 is the top left slot, 27 is the bottom right slot. The index increments from left to right: 0 1 2 3 4 5 6 7 8 9 10 11 etc.
-
Mouse/Mousemat (Gaming) (mostly csgo and FPS)
Who gives a shit https://www.amazon.co.uk/Logitech-B100-Optical-Mouse-Black/dp/B00AZKNPZC/ref=sr_1_1?s=computers&ie=UTF8&qid=1469914709&sr=1-1&keywords=mouse
-
Cooking Conditional Sleep
In the future please use the code tags when posting code on OSBot. It's the button that looks like <>