Jump to content

Botre

Members
  • Posts

    5883
  • Joined

  • Last visited

  • Days Won

    18
  • Feedback

    100%

Everything posted by Botre

  1. I'm going to assume that with "non-aggressive" you mean "sleeping" and not "not automatically attacking the player". If I'm assuming wrongly then there's no way to find out if a monster is aggressive (in the API at least, that I'm aware of) but crabs in the "awake" state are ALWAYS NPCs. "Sleeping" crabs are classified as Object (I'm pretty sure they are at least). You can verify yourself with this debugger: NPC crab = //GET AWAKE CRAB HERE. if (crab.getInteracting() != null) { if (getInteracting().equals(myPlayer()) { // CRAB IS INTERACTING WITH ME } else { // CRAB IS INTERACTING WITH OTHER PLAYER (OR NPC) } } Hope this helped. Edit: like APA said, not sure if there's room for another RC script on the market tbh :p
  2. I seem to be having some trouble with caching the inventory amounts. Halp :x import java.util.Map; import java.util.TreeMap; import org.osbot.rs07.api.model.Item; import dependencies.script.BotreScript; /** * @author Bjorn Krols (Botre) * @version 0.0 * @since April 20, 2015 */ public class InventoryListener extends Thread { private final BotreScript script; private Map<String, Integer> oldCache, newCache; public InventoryListener(final BotreScript script) { this.script = script; oldCache = new TreeMap<String, Integer>(); newCache = new TreeMap<String, Integer>(); } @Override public void run() { while (script.isRunning()) { if (script.isOnline()) { oldCache = newCache; newCache.clear(); for (Item item : script.getInventory().getItems()) if (item != null && !newCache.containsKey(item.getName())) newCache.put(item.getName(), (int) script.getInventory().getAmount(item.getName())); onUpdate(); } try { Thread.sleep(3000); // SLOW FOR READABILITY } catch (InterruptedException e) { e.printStackTrace(); } } } public void onUpdate() { } public int getDifference(String name) { if (oldCache.containsKey(name) && newCache.containsKey(name)) { script.log("old " + oldCache.get(name)); script.log("new" + newCache.get(name)); return newCache.get(name) - oldCache.get(name); } else return 0; } } How it currently logs: [INFO][Bot #1][04/21 02:55:09 AM]: old 7 [INFO][Bot #1][04/21 02:55:09 AM]: new7 [INFO][Bot #1][04/21 02:55:12 AM]: old 9 [INFO][Bot #1][04/21 02:55:12 AM]: new9 [INFO][Bot #1][04/21 02:55:15 AM]: old 10 [INFO][Bot #1][04/21 02:55:15 AM]: new10 [INFO][Bot #1][04/21 02:55:18 AM]: old 12 [INFO][Bot #1][04/21 02:55:18 AM]: new12 How it's supposed to log: [INFO][Bot #1][04/21 02:55:09 AM]: old 5 [INFO][Bot #1][04/21 02:55:09 AM]: new7 [INFO][Bot #1][04/21 02:55:12 AM]: old 7 [INFO][Bot #1][04/21 02:55:12 AM]: new9 [INFO][Bot #1][04/21 02:55:15 AM]: old 9 [INFO][Bot #1][04/21 02:55:15 AM]: new10 [INFO][Bot #1][04/21 02:55:18 AM]: old 10 [INFO][Bot #1][04/21 02:55:18 AM]: new12 Solved: if (script.isOnline()) { oldCache.clear(); oldCache.putAll(newCache); newCache.clear(); for (Item item : script.getInventory().getItems()) if (item != null && !newCache.containsKey(item.getName())) newCache.put(item.getName(), (int) script.getInventory().getAmount(item.getName())); onUpdate(); }
  3. myPlayer().isAnimating(); isAnimating() - Method in class org.osbot.rs07.api.model.Character Whether the character is performing an animation.
  4. You'd still need a client to read the data from the game + control the main mouse Oo edit: nvm misread.
  5. You're overthinking this, I doubt changing the seed would change much if anything.
  6. beep boop boop yes beep boop boop
  7. public class AutoPlayerResponder { private final Script script; private final int cooldownSeconds; private Map<PlayerMessageContentType, MilliTimer> cooldownMap; public AutoPlayerResponder(final Script script) { this.script = script; cooldownSeconds = 180; cooldownMap = new EnumMap<PlayerMessageContentType, MilliTimer>(PlayerMessageContentType.class); } public void respond(String message) { PlayerMessageContentType type = PlayerMessageInterpreter.getInstance().getContentType(message); if (type == null || (cooldownMap.containsKey(type) && cooldownMap.get(type).getElapsedSeconds() < cooldownSeconds)) return; String response = null; switch (type) { case BOT_ACCUSATION: response = "beep boop boop"; break; case BOT_QUERY: response = "beep boop boop yes beep boop"; break; case SKILL_QUERY: Skill skill = PlayerMessageInterpreter.getInstance().getSkillMention(message); response = script.getSkills().getStatic(skill) + ", beep boop boop"; break; case TOTAL_LEVEL_QUERY: response = BotreMethodProvider.getMyTotalLevel(script) + " ...beep boop boop"; break; } if (response != null) { script.getKeyboard().typeString(response, true); cooldownMap.put(type, new MilliTimer()); } } }
  8. Beginners swag. public static int getMyTotalLevel(Script script) { int total = 0; for (Skill skill : Skill.values()) total += script.getSkills().getStatic(skill); return total; }
  9. weeeeeeeeeeeeeeeeeeeeeeeeee
  10. It's not my native language but I'm an English lit student and also a freelance proofreader. So... yeah :x
  11. : ' ( @OP: http://2007.runescape.wikia.com/wiki/Magic_shortbow_%28i%29
×
×
  • Create New...