Everything posted by Botre
-
What'sup from the other side of the world!
Helloooooooooooooooo
-
Babysitting (and homework) at its finest.
- Sleeping Crab Detection
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- Who will win the Champions League?
PSG beat Chealsea, so PSG.- Need help with InventoryListener
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(); }- I'm making a crafting bot. How do I check if the player is animating/crafting something?
myPlayer().isAnimating(); isAnimating() - Method in class org.osbot.rs07.api.model.Character Whether the character is performing an animation.- Bot Clients?
You'd still need a client to read the data from the game + control the main mouse Oo edit: nvm misread.- Scripting and Random Function
You're overthinking this, I doubt changing the seed would change much if anything.- How I've been evading all dem bans
y u break my hard?- How I've been evading all dem bans
beep boop boop yes beep boop boop- How I've been evading all dem bans
fixed- Alpha Team Bundle Design
I'll get in touch ;)- Don't you just love when Mald: does something sweet!
*- How I've been evading all dem bans
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()); } } }- My Total Level Snippet
Beginners swag. public static int getMyTotalLevel(Script script) { int total = 0; for (Skill skill : Skill.values()) total += script.getSkills().getStatic(skill); return total; }- OSBot 2.3.63 - Java 8
weeeeeeeeeeeeeeeeeeeeeeeeee- Native English speaker needed
It's not my native language but I'm an English lit student and also a freelance proofreader. So... yeah :x- 71 hunter/81 cook/55 magic/41 ranged/52 fletch
5 mil-ish- Dogelike
- Does somebody know how to spec 2 times with the MSB
: ' ( @OP: http://2007.runescape.wikia.com/wiki/Magic_shortbow_%28i%29- Does somebody know how to spec 2 times with the MSB
Might be a game tick timing trick (?).- Dogelike
Really really unhappy :saddoge: ...- Lesser Demon Killer script source with comments [EDUCATIONAL]
Final isn't a type. If you want to change the monster you would change the assigned value from: private static final String NAME = "Lesser demon"; to: private static final String NAME = "Goblin"; //For example, this is a comment btw. If you want to make it search from multiple monster names you could use an array like this: private static final String[] NAMES = new String[]{"Lesser demon", "Goblin"};- Dogelike
1236 would really make me unhappy- how do you feel hero
- Sleeping Crab Detection