Jump to content

Search the Community

Showing results for tags 'combat'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • EpicBot
    • News & Announcements
    • Client Support
    • Development
    • Beta Testing
    • Community Discussion
  • Scripts
    • Official Premium Scripts
    • Workbench & Non-Premium Scripts
    • Scripter Applications
  • Market
    • Middlemen
    • Accounts
    • Gold
    • Membership
    • Services
    • Other
    • Disputes
    • Market Archive

Product Groups

  • Test group
  • Scripts
  • Donator Ranks
  • VIP

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.NPC; import com.epicbot.api.shared.entity.Player; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.Random; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.util.time.Time; import java.awt.*; //Script Manifest stuff for your script selector @ScriptManifest(name = "sCowKiller", gameType = GameType.OS) public class main extends LoopScript { //instantiate variable to be used later. private Player local_Player; private long startTime; private State state; private String playerState; private int strengthLevel; private int percentTNL; private NPC cowNPC; @Override public boolean onStart(String... strings) { //when the script starts, startTime is set equal to the current millisecond which is used for the runtime later on. startTime = System.currentTimeMillis(); System.out.println("Starting sCowKiller!"); return true; } @Override protected void onPause() { playerState = "Script is paused"; getAPIContext().mouse().moveOffScreen(); } //An enum of all the States private enum State { QUERYING, FIGHTING, ENABLING_RUN } // A getter for the player's state and defining what causes the state to change private State getPlayerState() { if (getAPIContext().client().isLoggedIn() && getAPIContext().localPlayer().get() != null) { local_Player = getAPIContext().localPlayer().get(); if (local_Player.getAnimation() != -1) { state = State.FIGHTING; } else if (local_Player.getAnimation() == -1) { state = State.QUERYING; } else if (!getAPIContext().walking().isRunEnabled()) { state = State.ENABLING_RUN; } } return state; } private NPC getCowNPC() { return getAPIContext().npcs().query() //what we're querying for .nameMatches("Cow") .notInCombat() .animation(-1) .reachable() .results() .nearest(); } private void attack() { cowNPC.click(); getAPIContext().mouse().moveOffScreen(); } // The actual loop method @Override protected int loop() { if (!getAPIContext().client().isLoggedIn()) { return 500; } switch (getPlayerState()) { // switch case for setting player state case FIGHTING: playerState = "Fighting"; break; case QUERYING: playerState = "Querying"; break; case ENABLING_RUN: playerState = "Enabling run"; default: playerState = "ERROR"; break; } //shit for determining skill XP/Time to level/etc strengthLevel = getAPIContext().skills().strength().getCurrentLevel(); percentTNL = getAPIContext().skills().strength().getPercentToNextLevel(); if (getAPIContext().localPlayer().getInteracting() == null) { cowNPC = getCowNPC(); // if the local player is not interacting if (cowNPC != null && !cowNPC.isDead()) { //if the cow npc query is not dead attack(); // do the attack method if (local_Player.getInteracting() != null) { // if our player is interacting Time.sleep(6000, () -> cowNPC.isDead()); // sleep until cow npc is dead } if (local_Player.isMoving() || cowNPC.isInteractingWithMe() || local_Player.getInteracting() == null) { if (!getAPIContext().walking().isRunEnabled()) { if (getAPIContext().walking().getRunEnergy() >= Random.nextInt(55,100)) { getAPIContext().walking().setRun(true); } } else if (getAPIContext().walking().isRunEnabled()) { if (getAPIContext().walking().getRunEnergy() <= Random.nextInt(10,15)) { getAPIContext().walking().setRun(false); } } } } } return 200; } // paint shit. @Override protected void onPaint(Graphics2D g, APIContext ctx) { if (!getAPIContext().client().isLoggedIn()) { Time.sleep(15_000, () -> getAPIContext().client().isLoggedIn()); } if (getAPIContext().client().isLoggedIn()) { PaintFrame frame = new PaintFrame(); frame.setTitle("sCowKiller"); frame.addLine("Runtime: ", Time.getFormattedRuntime(startTime)); // we use startTime here from the very beginning frame.addLine("State: ", playerState); //we get whatever the player's state is equal to and print it onto the paint. frame.addLine("", ""); frame.addLine("Current Strength level: ", strengthLevel); frame.addLine("% to next level", percentTNL); frame.draw(g, 0, 90, ctx); //drawing the actual frame. g.setColor(new Color(208, 189, 155, 255)); g.fillRect(11, 468, 120, 15); //name covering stuff, honestly might remove it cuz kinda pointless? Dunno } } }
×
×
  • Create New...