Jump to content

Xerion

Scripter II
  • Posts

    439
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    100%

Everything posted by Xerion

  1. You can run it though the command line: java -jar "Path to .jar file"
  2. Use the walking event. This way you can set the minimal distance threshold. I believe the default is 3 so that's why the method returns true when you are not standing on the exact position.
  3. I would suggest using https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Callable.html instead of using that interface.
  4. Okay. Gimme a few minutes I don't want to spoon feed everything, but this should be a good basis. Also note that this class extends the API so you wont have to use script.client or script.inventory. The thread will automatically stop after a script has stopped. import org.osbot.rs07.Bot; import org.osbot.rs07.script.API; import java.util.ArrayList; import java.util.List; /** * Created by Xerion on 16-1-2017. */ public class InventoryObserver extends API { private List<InventoryListener> listeners = new ArrayList<>(); /** * * @param bot */ public InventoryObserver(Bot bot){ this.exchangeContext(bot); new Thread(() -> { logger.debug("Started: InventoryWatcher"); while (isRunning()) { try { sleep(loop()); } catch (InterruptedException e) { e.printStackTrace(); } } logger.debug("Stopped: InventoryWatcher"); }).start(); } @[member=Override] public void initializeModule() { } /** * * @[member=Return] */ private int loop(){ /** * Add your code here to check if item is added/removed */ return 100; } /** * * @[member=Return] True if a script is running */ private boolean isRunning(){ return bot.getScriptExecutor().getCurrent() != null; } /** * * @param listener */ public void addListener(InventoryListener listener) { listeners.add(listener); } /** * * @param listener */ public void removeListener(InventoryListener listener) { if(listener != null && listeners.contains(listener)) { listeners.remove(listener); } } }
  5. while (true) { Really?? Just don't do that.
  6. Well it depends on with distro you are using (CentOS, Ubuntu, etc). Secondly there should be a lot of tutorials on the internet.
  7. It had a fashion check. If you had ugly armour it would drop it. It was probably @Krulvis fault
  8. Additionally you also do an API suggestion here: http://osbot.org/forum/forum/102-client-bugs-suggestions/ Could be useful for everybody else if an method is added that supports item names.
  9. Why do you want to know it? Well in most cases there are multiple items that have the same name. The easiest example to mention is noted and unnoted items. You can use the ItemDefinition class, but I believe you have to load the items first.
  10. It just has a different name. I believe it's "rock"
  11. Why don't you just increase the counter every time you buy the item?
  12. A human would not always pick the closest NPC. For example: NPC A is 6 tiles away from the player and is visible on the screen. NPC B is 5 tiles away from the player and not visible If a bot would pick the closest NPC it will turn the screen and interact with NPC B. A human would interact with NPC A because that one is already visible. If you let the bot always chose the closest NPC you will get a pattern that does not happen with normal players. I agree that humans will mostly interact with the closest NPC, but that is not guaranteed.
  13. Technically those things can be detected on Jagex end. I'm not going to say it matters but they will know of you do those things. First of all I want to say to most of the things you mention should be in your script. Hovering the next monster or food to eat will make your script faster so in my opinion it's worth the development time to add those things. In my opinion the most important thing for a combat script is target selection. If you always attack the closest target you will get banned eventually. My advice is to create a method that will select your next target in a more realistic way.
  14. Last time I read an article about it they said they haven't spotted one in the wild. The easiest way to check if it was legitimate was to check the permissions. The legit one only needs Camera, contacts, location and storage. I downloaded mine from APKmirror and everything was fine.
  15. I have my private updater. An updater searches for bytecode patterns to search for fields, classes and methods.
  16. Some background info for some people that might like it: Jagex changed some hooks regarding Character.getHealth() and Character.getMaximumHealth(). From now it's not possible anymore to get the precise amount of health a character has, you can only get the a health percentage instead. I assume that Character.getHealth() and Character.getMaximumHealth() will be removed from the API. Some scripts might also be broken after this update so don't expect everything to work flawless when the bot goes live again.
  17. The completion of quests are also registered as configs. If you only need the completion status of a few quests you can try to use configs instead. So for example for sheep shearer the config ID is 179. If the value is 1 it has started and if the value is 21 it's completed. Ideally Osbot should also use configs instead of their current system, but I can imagine that it can be tricky to get all the configs right. I have gathered a big list myself with most the configs for every quests, but cbf to share it here.
  18. Using lambda would make your first method a lot cleaner. For the second method you could change the boolean from the statement to Callable<Boolean>. The thing you are doing wrong is that currently the statement will never change. The value is assigned when the method is called and will never change. Anyway more info here: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Callable.html
  19. Alek has added a detector for malicious content. In your case it detected osbots own random solver files. The "malicious" content it detects is probably an API call to get the username, password or bank pin to solve these random events.
  20. You should use bit shifting and bitwise operators.
  21. There is only a hook for a Character (NPC or Player). There is no such thing for objects. Your best bet is probably to save which object you last interacted with.
×
×
  • Create New...