-
Posts
2314 -
Joined
-
Last visited
-
Days Won
6 -
Feedback
100%
Everything posted by Explv
-
[ tattoo & piercing proforma ] - This is what I had to send the Army.
Explv replied to Will's topic in Spam/Off Topic
Not sure if legit but this is some good /r/cringe shit. Pics of HF and Botting tattoos pls :') :') :') :facep: -
Also contains returns true if ANY of the items are in the ItemContainer. Not if ALL of the items are in the itemContainer. Just letting you know as it seems like you are assuming that from the method name 'hasSupplies'.
-
This method is dumb. It is exactly the same as: boolean hasSupplies() { int[] Supplies_ID = { 1, 2 }; return bank.contains(Supplies_ID); } Which is exactly the same as: boolean hasSupplies() { return bank.contains(1, 2); } So why wouldn't you just do: bank.contains(1, 2); Also I don't know why you are using IDs in this method, considering contains can take names of items, which is far more readable.
-
If you actually looked at the API you would see: As you can see it inherits the method getItem If you then looked at this method you would see: As you can see from that it returns an Item. Assuming you are trying to withdraw items from the bank though, once again looking at the API you would see: Please try harder in the future
-
$200 for those? You got skimmed m9
-
Btw are you using the latest version? 5.0?
-
It's because of this line ^^^^^^^^^^^^^^ See this post where I explain the same issue to another user: http://osbot.org/forum/topic/98340-in-need-of-some-help/?p=1092959
-
Yeah X-Post from Script Developers section for the greynames
-
Explv's Map A map tool to allow the simple creation of areas, poly areas, paths and positions. GITHUB: https://github.com/Explv/Explv.github.io WEBSITE: http://explv.github.io/ NOW SUPPORTS DUNGEONS (Type the dungeon name into the search box): If you would like to assist me with identifying dungeons and other areas The first set of areas is around 2868, 4658, 0 (you can go there by typing the coordinates into the boxes at the top right). Move the map around and you will see a bunch of areas without names. The second set of areas is around 2875, 9452, 0 Provide me with the name of the dungeon, and the x, y coordinates
- 98 replies
-
- 37
-
-
I think this would probably work as a single query: SELECT a.id, a.rslogin, a.rswachtwoord, a.gebruikersnaam, p.proxy, c.subcategory FROM bots a INNER JOIN proxy p ON a.proxy_id=p.id AND ('$proxy' = 'noproxy' OR p.proxy = '$proxy') INNER JOIN subcategory c ON a.category_id=c.subcat_id AND ('$sub_category' = 'nocat' OR c.subcategory = '$sub_category') The logic behind it is as follows: If you pass a valid proxy then the query would join bots and proxy only for values where p.proxy = '$proxy'. If you pass the proxy value as 'noproxy' then the query would join bots and proxy for all matching ids ignoring the p.proxy value because '$proxy' = 'noproxy' will be true for all rows. The same logic applies for the subcategory part of the query.
-
Because you have not shown any code it is hard to understand exactly what you are doing wrong. However the issue you has described sounds like the result of a lack of understanding of basic Java. I strongly recommend you follow some Java tutorials to understand the basics. From what you have described I can think of two things you might be doing wrong. Firstly, you might not be storing the button as a global variable. If you are not doing this, the variable is local to the method in which you created it and so cannot be accessed outside of it. To be able to access this variable from outside of the class you will need to store it globally: public final class Gui extends JFrame { final JButton button; public Gui() { button = new JButton(); } } If you are already doing this, then it is likely an issue with your usage of access modifiers. There are several different access modifiers https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html If your Gui class is in a different package to the class you are trying to access button from, then you will need to give the button the 'public' access modifier. public final class Gui extends JFrame { public final JButton button; public Gui() { button = new JButton(); } } If your Gui class is in the same package as the class you are trying to access the button from you don't need to give it any modifier. If the button is private then you will need to provide a getter method to access this variable from outside of the class: public final class Gui extends JFrame { private final JButton button; public Gui() { button = new JButton(); } public final JButton getButton() { return button; } } An alternative to all of the above would be to make some kind of configuration class. For example for a woodcutter you might make: public final class ScriptConfig { private Tree selectedTree; private boolean shouldBank; public final void setSelectedTree(final Tree selectedTree) { this.selectedTree = selectedTree; } public final void setShouldBank() { shouldBank = true; } public final Tree getSelectedTree() { return selectedTree; } public final boolean shouldBank() { return shouldBank; } } You then create an instance of this config in your Script class: @ScriptManifest(...) public class Chopper extends Script { @Override public void onStart() { ScriptConfig config = new ScriptConfig(); Gui gui = new Gui(config); } ... } And then pass this config class to your Gui: public final Gui extends JFrame { public Gui(final ScriptConfig config) { // init stuff } } Then, when the user presses the start button, or however you indicate that the script is started, you can set all the configuration options: public final Gui extends JFrame { private final JCheckBox shouldBankCheck; private final JComboBox<Tree> treeSelector; private final JButton startButton; public Gui(final ScriptConfig config) { // init stuff startButton.addActionListener(e -> { if(shouldBankCheck.getState()) config.setShouldBank(); config.setSelectedTree(treeSelector.getSelectedItem()); }); } } And finally, you will be able to access the chosen settings from the config instance in your Script class: @ScriptManifest(...) public class Chopper extends Script { @Override public void onStart() throws InterruptedException { ScriptConfig config = new ScriptConfig(); Gui gui = new Gui(config); // sleep while gui is open if(config.shouldBank()) ... Tree selectedTree = config.getSelectedTree(); } ... }
-
Thank you
-
Why do you care if it's more code? Less code does not necessarily mean better code. You're trying to solve a simple problem, so why not use a simple solution.
-
So let me get this straight, you want a query that does 3 things in one. 1) Lets you search for a match on proxy 2) Lets you search for a match on category 3) Lets you search for a match on both Well, why don't you just use three different god damn queries? You could have written them in the time it took you to make this post. Query 1: SELECT values FROM bot table INNER JOIN proxy table ON bot.proxy_id = proxy.proxy_id AND proxy.proxy = $proxyValue INNER JOIN category table ON bot.category_id = category.category_id Query 2: SELECT values FROM bot table INNER JOIN category table ON bot.category_id = category.category_id AND category .category = $categoryValue INNER JOIN proxy table ON bot.proxy_id = proxy.proxy_id Query 3: SELECT values FROM bot table INNER JOIN proxy table ON bot.proxy_id = proxy.proxy_id AND proxy.proxy = $proxyValue INNER JOIN category table ON bot.category_id = category.category_id AND category .category = $categoryValue And then in PHP: If category is undefined: Execute query 1 Else if proxy is undefined: Execute query 2 Else Execute query 3
-
This is because the roofs are turned on. I thought I added some code at the start of the script to turn roofs off, however (obviously) it is not working. I will fix this and leave a comment when it is done.
-
Your logic sounds quite strange. If I understand correctly, it sounds like you want 1 query that does: Select all rows where: the row's proxy_id = $proxyId or the row's category_id = $categoryId or the row's proxy_id = $proxyId AND the row's category_id = $categoryId Well isn't that the exact same as: Select all rows where: the row's proxy_id = $proxyId or the row's category_id = $categoryId Because if the row matches both category id and proxy id, it will still satisfy the above condition. However what your query currently does is: Select all rows where: the row's proxy_id = $proxyId AND the row's category_id = $categoryId Why? Well because you are doing an Inner join on both proxy id and category id. So the resulting values only satisfy this condition. I (think) this would work instead: SELECT a.id, a.rslogin, a.rswachtwoord, a.gebruikersnaam, p.proxy, c.subcategory FROM bots a FULL OUTER JOIN proxy p ON a.proxy_id=p.id FULL OUTER JOIN subcategory c ON a.category_id=c.subcat_id WHERE p.proxy = $proxy OR c.subcat_id = $sub_category; An explanation of what this does: Select all the values we want from The bots table Joined with the proxy table on proxy id (keeping all values from both tables) Joined with the subcategory table on category id (Keeping all values from both tables) Where the proxy value matches or the category matches
-
import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Explv", name = "Example hover", info = "", version = 0.1, logo = "") public class Example extends Script { private enum State { CHOPPING, HOVERING } private RS2Object chopTree; @Override public int onLoop() throws InterruptedException { switch (getState()) { case CHOPPING: chop(); break; case HOVERING: hover(); break; } return random(200, 300); } private State getState() { if(chopTree == null || !chopTree.exists() || !myPlayer().isAnimating()) return State.CHOPPING; return State.HOVERING; } private void chop() { chopTree = getObjects().closest("Tree"); if(chopTree != null && chopTree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !chopTree.exists() || myPlayer().isAnimating(); } }.sleep(); } } private void hover() { RS2Object hoverTree = getObjects().closest(obj -> obj.getName().equals("Tree") && obj != chopTree); if(hoverTree != null && !getMouse().isOnCursor(hoverTree)) { hoverTree.hover(); } } } The logic is pretty simple: If the player is not woodcutting, find closest tree and chop it Else find the closest tree, that is not equal to the tree the player is chopping and hover it
-
Yes, to generate the source code just 'make' the project. Hit Ctrl F9 or Go to Build -> Make Project
-
It will either be put on the SDN as a VIP + script (and then maybe in the future be made premium) Or it will live in the Local/Downloadable section for free Regardless, I still intend to complete the script, fix any bugs that arise etc. All the features listed in the post are completed.
-
I will be releasing the beta this week (for free)
-
weird thing happening with gui not showing up correctly.
Explv replied to roguehippo's topic in Scripting Help
We will need to see some code to determine the issue. One reason could be that you have not set a size on your JFrame? gui.setMinimumSize(new Dimension(500, 500)); -
It's probably because of this ^^^^^^^^^^^^^. Firstly, this is incorrect because you are only ever looking for a Cow once. If no Cow is found, you never try to find another one, so your script will do nothing. Secondly this will break your script, because you are calling npcs.closest() before the script has been setup. To fix both of the above, you should be doing this in onLoop. Every time you go to attack a new Cow, you will need to call that code to find one. By doing this in onLoop you can also be sure that the script is setup: @Override public int onLoop() throws InterruptedException { if (!getCombat().isFighting()) attackEnemy(); return random(200, 300); } private void attackEnemy() { NPC enemy = getEnemy(); if(enemy != null && enemy.interact("Attack")) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getCombat().isFighting(); } }.sleep(); } } private NPC getEnemy() { return npcs.closest(n-> n.getName().equals("Cow") && n.getCurrentHealth() > 0 && n.isAttackable() && map.canReach(n) ); } I will explain in more detail why this causes your script to crash (Note the code is obfuscated so may be hard to read, I have added comments to make it more clear): There is a class called ScriptExecutor which handles the starting / stopping etc of scripts. In this class there is a method named start, which handles the starting of a new script. It's definition looks like: public void start(Script iiiIIIiIii1) throws InterruptedException { SwingUtilities.invokeLater(new Runnable() { public void run() { BotApplication.iiiIIIiIii().iiiIIIiIii().iiIiIiIIiI.setEnabled(false); BotApplication.iiiIIIiIii().iiiIIIiIii().iIIiIIiiii.setEnabled(true); BotApplication.iiiIIIiIii().iiiIIIiIii().IiIIiIiIii.setEnabled(true); } }); iiiIIIiIii.prepare(iiiIIIiIii1); // Prepare the script before starting if(!iiiIIIiIii.iiiIIIiIii(iiiIIIiIii1)) { // Start the script iiiIIIiIii.stop(); // If starting the script failed, stop the script } iiiIIIiIii.restart(); } Now notice how before starting the script, it makes a call to prepare. The prepare method looks like: public void prepare(Script iiiIIIiIii1) throws InterruptedException { iiiIIIiIii.iIIIIiiiIi.setHumanInputEnabled(false); if(iiiIIIiIii.IiiiIiIIIi) { iiiIIIiIii.stop(false); } iiiIIIiIii.IiiIiIiiII = iiiIIIiIii1; iiiIIIiIii.iiIiiIiIiI = new ScriptExecutor.InternalExecutor(null); iiiIIIiIii.IiiiIiIIIi = true; iiiIIIiIii.IIiIIiiiII = iiiIIIiIii.iIIiIIiiii = false; for(ScriptExecutor var10000 = iiiIIIiIii; !var10000.iIIIIiiiIi.isLoaded(); var10000 = iiiIIIiIii) { Thread.sleep(100L); } iiiIIIiIii1.exchangeContext(iiiIIIiIii.iIIIIiiiIi); // This is what sets up all the methods like getNpcs() etc. iiiIIIiIii.iIIIIiiiIi.getRandomExecutor().IIiIiIiIiI(); iiiIIIiIii.iIIIIiiiIi.addPainter(iiiIIIiIii1); if(!BotApplication.iiiIIIiIii().iiiIIIiIii().iiiIIIiIii()) { Lb var2 = new Lb(iiiIIIiIii.iIIIIiiiIi); iiiIIIiIii.iIIIIiiiIi.addPainter(var2); iiiIIIiIii.iIIIIiiiIi.addMouseListener(var2); } iiiIIIiIii.iIIIIiiiIi.addConfigListener(iiiIIIiIii1); iiiIIIiIii.iIIIIiiiIi.addAudioListener(iiiIIIiIii1); iiiIIIiIii.iIIIIiiiIi.messageEventQueue.clear(); iiiIIIiIii.iIIIIiiiIi.addMessageListener(iiiIIIiIii1); iiiIIIiIii.iIIIIiiiIi.addLoginListener(iiiIIIiIii1); } This prepare method includes a call to exchangeContext. The exchangeContext method is what sets up all the objects like npcs, inventory etc. This is necessary to allow scripters to access the API. The exchangeContext method looks like: public MethodProvider exchangeContext(Bot iiiIIIiIii1) { iiiIIIiIii.bot = iiiIIIiIii1; iiiIIIiIii.client = iiiIIIiIii1.getClient(); iiiIIIiIii.logger = iiiIIIiIii1.getLogger(); iiiIIIiIii.npcs = iiiIIIiIii1.getMethods().npcs; iiiIIIiIii.players = iiiIIIiIii1.getMethods().players; iiiIIIiIii.groundItems = iiiIIIiIii1.getMethods().groundItems; iiiIIIiIii.objects = iiiIIIiIii1.getMethods().objects; iiiIIIiIii.widgets = iiiIIIiIii1.getMethods().widgets; iiiIIIiIii.tabs = iiiIIIiIii1.getMethods().tabs; iiiIIIiIii.inventory = iiiIIIiIii1.getMethods().inventory; iiiIIIiIii.bank = iiiIIIiIii1.getMethods().bank; iiiIIIiIii.depositBox = iiiIIIiIii1.getMethods().depositBox; iiiIIIiIii.store = iiiIIIiIii1.getMethods().store; iiiIIIiIii.equipment = iiiIIIiIii1.getMethods().equipment; iiiIIIiIii.map = iiiIIIiIii1.getMethods().map; iiiIIIiIii.combat = iiiIIIiIii1.getMethods().combat; iiiIIIiIii.magic = iiiIIIiIii1.getMethods().magic; iiiIIIiIii.prayer = iiiIIIiIii1.getMethods().prayer; iiiIIIiIii.configs = iiiIIIiIii1.getMethods().configs; iiiIIIiIii.skills = iiiIIIiIii1.getMethods().skills; iiiIIIiIii.mouse = iiiIIIiIii1.getMethods().mouse; iiiIIIiIii.keyboard = iiiIIIiIii1.getMethods().keyboard; iiiIIIiIii.camera = iiiIIIiIii1.getMethods().camera; iiiIIIiIii.menu = iiiIIIiIii1.getMethods().menu; iiiIIIiIii.antiBan = iiiIIIiIii1.getMethods().antiBan; iiiIIIiIii.dialogues = iiiIIIiIii1.getMethods().dialogues; iiiIIIiIii.settings = iiiIIIiIii1.getMethods().settings; iiiIIIiIii.colorPicker = iiiIIIiIii1.getMethods().colorPicker; iiiIIIiIii.logoutTab = iiiIIIiIii1.getMethods().logoutTab; iiiIIIiIii.doorHandler = iiiIIIiIii1.getMethods().doorHandler; iiiIIIiIii.experienceTracker = iiiIIIiIii1.getMethods().experienceTracker; iiiIIIiIii.localWalker = iiiIIIiIii1.getMethods().localWalker; iiiIIIiIii.walking = iiiIIIiIii1.getMethods().walking; iiiIIIiIii.trade = iiiIIIiIii1.getMethods().trade; iiiIIIiIii.chatbox = iiiIIIiIii1.getMethods().chatbox; iiiIIIiIii.quests = iiiIIIiIii1.getMethods().quests; iiiIIIiIii.hintArrow = iiiIIIiIii1.getMethods().hintArrow; iiiIIIiIii.grandExchange = iiiIIIiIii1.getMethods().grandExchange; iiiIIIiIii.worlds = iiiIIIiIii1.getMethods().worlds; iiiIIIiIii.projectiles = iiiIIIiIii1.getMethods().projectiles; return iiiIIIiIii; } Only after these are setup does it call the onStart method in your script. So why does your code break? Well, where you put the npcs.closest() call in your script, means that it is called when an instance of your script is created. This means that you are calling npcs.closest() before any of the above has happened. This means that exchangeContext has not been called, so npcs is null. The result of this is that your code will throw a NullPointerException, causing your script to not start.
-
I think that when firemaking the player will always walk in one specific direction after lighting a log. I can't remember if it is North, East, South or West, but it is one of those. So, for example, if the player always walks South after lighting a log. Just make sure that the first position in the line where the player will light, is the Northern most position. That way, the player will never walk back over his fires. However, if this is not possible, you could always check if the player can light a fire in the current position, and walk to a different one if a fire cannot be lit. Maybe something like this would work? private boolean canPlayerLightAFire() { return getObjects().filter(new PositionFilter<>(myPosition())).size() == 0; } Alternatively, you can listen for the message "The player cannot light a fire here", or whatever it is, and move if that happens.
-
For checking if your player is chopping a tree you can just check if your player is animating: if(myPlayer().isAnimating()) // player is performing the chop animation, so is cutting a tree For finding the tree with the fewest players chopping it, you could try doing something like: private Optional<RS2Object> getTreeWithFewestPlayers() { return getObjects() .getAll() .stream() .filter(obj -> obj.getName().equals("Tree")) .min((tree1, tree2) -> Long.compare(getNumPlayersInteracting(tree1), getNumPlayersInteracting(tree2))); } private long getNumPlayersInteracting(final Entity entity) { return getPlayers().getAll().stream().filter(player -> player.getInteracting() == entity && player.isAnimating()).count(); } For lighting a fire you could sleep until your position changes (because after you light a fire your player walks to another tile): if(!isItemWithNameSelected("Tinderbox")) getInventory().interact("Use", "Tinderbox"); else lightFire(); private boolean isItemWithNameSelected(final String itemName) { final String selectedItemName = getInventory().getSelectedItemName(); return selectedItemName != null && selectedItemName.equals(itemName); } private void lightFire() { if(getInventory().getItem("Logs").interact()){ final Position playerPos = myPosition(); new ConditionalSleep(20_000) { @Override public boolean condition() throws InterruptedException { return !myPosition().equals(playerPos) && !myPlayer().isMoving(); } }.sleep(); } }