Everything posted by Explv
-
How to know if other players are nearby
If you want to check if a player is less than a certain distance away, you can use: private boolean isOtherPlayerWithinDistance(final int distance) { for(final Player player : getPlayers().getAll()) { if(player != myPlayer() && player.getPosition().distance(myPosition()) < distance) { return true; } } return false; } Or you can use a filter: private boolean isOtherPlayerWithinDistance(final int distance) { return !getPlayers().filter(player -> player != myPlayer() && player.getPosition().distance(myPosition()) < distance).isEmpty(); } Otherwise you can just check the size of getPlayers().getAll() private boolean isOtherPlayerNearby() { return getPlayers().getAll().size() > 1; }
-
How to know if other players are nearby
That method works fine, he just might want to check that the player != myPlayer
-
External logs
What you can do is run OSBot in debug mode from the command line, and redirect all output to a file. Open up CMD / terminal and type: java -jar "C:\Users\Username\Downloads\OSBot 2.4.59.jar" -debug >> test.txt With the correct file path to your OSBot.jar This will output all log statements to the file test.txt
- when mouse is clicked?
-
when mouse is clicked?
I haven't actually tested this out, but this may work for tracking clicks made by the bot: getBot().addMouseListener(new BotMouseListener() { @Override public boolean blockInput(Point point) { return false; } @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } });
-
when mouse is clicked?
If you just want to capture the users' mouse click you can use the MouseAdapter class (Add this to onStart()) getBot().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); // do whatever you want to do when the user clicks the mouse } });
-
Explv's Dank GUI Tutorial
I think it is possible, just maybe not using FXML. Support may be added in the future by OSBot devs, but for now it is easier to just use Swing.
-
Explv's Walker
Sure, i'll take a look at adding wilderness locations for you
- Post your desktops
-
[ tattoo & piercing proforma ] - This is what I had to send the Army.
Not sure if legit but this is some good /r/cringe shit. Pics of HF and Botting tattoos pls :') :') :') :facep:
-
Why has my join date been reset?
- Tutorial Island - logout, switch to next account
Alright thanks, I'm taking a look at the bugs now, script will be updated at some point today.- Need some help.
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'.- Need some help.
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.- Need some help.
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- new cop
$200 for those? You got skimmed m9- Tutorial Island - logout, switch to next account
Are you using my script by itself or with dragon loader? My script supports multiple accounts by itself, using it with dragon loader might break the login process. I will take a look at the other bugs tonight/tomorrrow, those will be a quick fix- Explv's Tutorial Island [Free] [Random Characters]
Btw are you using the latest version? 5.0?- Tutorial Island - logout, switch to next account
My script supports multiple accounts natively now. Just download the .jar on my thread and use that: http://osbot.org/forum/topic/84213-explvs-tutorial-island-free-random-characters/- Explv's Dank GUI Tutorial
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- Explv's Map
Yeah X-Post from Script Developers section for the greynames- Explv's Map
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- some help with a sql query
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.- Best way to get info from gui?
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(); } ... }- Explv's Tutorial Island [Free] [Random Characters]
Thank you - Tutorial Island - logout, switch to next account