Jump to content

tzhaarown

Members
  • Posts

    12
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

682 profile views

tzhaarown's Achievements

Newbie

Newbie (1/10)

0

Reputation

1

Community Answers

  1. http://pastebin.com/0TmpyquE I will implement node structure later. package kfc; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.util.GraphicUtilities; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Condition; import java.awt.*; @ScriptManifest(author = "t", info = "Start at the Falador chicken farm", name = "KFC", logo = "", version = 1.00) public class KFC extends Script { private static final Filter TARGET_FILTER = new Filter<NPC>() { @Override public boolean match(NPC npc) { return npc.getName().equals(Constants.TARGET_NAME) && npc.isAttackable() && Constants.FALADOR_CHICKEN_FARM.contains(npc); } }; private NPC target; private long lastAttack = System.currentTimeMillis(); @Override public int onLoop() throws InterruptedException { final Player player = myPlayer(); if (target == null) { getNewTarget(); } else { if (target.exists() && target.getHealth() > 0 && Constants.FALADOR_CHICKEN_FARM.contains(target)) { if (target.isVisible()) { if (!player.isInteracting(target)) { if (player.isUnderAttack()) { getCurrentTarget(); } else { attack(); } } else if (idle()) { getNewTarget(); } } else { reposition(); } } else { getNewTarget(); } } return random(10, 15); } private boolean idle() { return System.currentTimeMillis() - lastAttack > random((int) (Constants.FAIL_SAFE_TIMEOUT - (Constants.FAIL_SAFE_TIMEOUT * 0.1)), Constants.FAIL_SAFE_TIMEOUT) * 1000; } private void attack() { lastAttack = System.currentTimeMillis(); if (!target.isUnderAttack()) { if (target.interact("Attack")) { dynamicSleep(new Condition() { @Override public boolean evaluate() { return myPlayer().isInteracting(target); } }, random(800, 1000)); } } else { getNewTarget(); } } private void reposition() { camera.toEntity(target); dynamicSleep(new Condition() { @Override public boolean evaluate() { return target.isVisible(); } }, random(4000, 5000)); if (!target.isVisible()) { getLocalWalker().walk(target); dynamicSleep(new Condition() { @Override public boolean evaluate() { return myPlayer().isMoving(); } }, random(4000, 5000)); } } private void getCurrentTarget() { target = npcs.singleFilter(npcs.getAll(), new Filter<NPC>() { @Override public boolean match(NPC npc) { return npc.isInteracting(myPlayer()) && npc.getName().equals(Constants.TARGET_NAME) && Constants.FALADOR_CHICKEN_FARM.contains(npc); } }); } private void getNewTarget() { try { sleep(random(300, 400)); } catch (InterruptedException e) { e.printStackTrace(); } target = npcs.closest(TARGET_FILTER); } public boolean dynamicSleep(Condition c, long timeout) { long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < timeout && !c.evaluate()) { try { sleep(random(100, 110)); } catch (InterruptedException e) { e.printStackTrace(); } } return c.evaluate(); } @Override public void onPaint(Graphics2D g) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (target != null && target.isVisible()) { g.setColor(Color.CYAN); g.draw(GraphicUtilities.getModelArea(this.bot, target.getGridX(), target.getGridY(), target.getZ(), target.getModel())); } } }
  2. How can I disable the autologin?
  3. I want to add a conditional sleep to wait till the camera is done moving.
  4. I don't see any difference between mousespeed 1 and 20?
  5. Does anyone know how I can get the destination position of my player when he starts walking?
×
×
  • Create New...