smile Posted December 25, 2020 Share Posted December 25, 2020 (edited) 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 } } } Edited January 8, 2021 by smile Rewrite of script v2 +making it look nicer + cleaning up stuff 2 1 3 Quote Link to comment Share on other sites More sharing options...
Koala Posted December 25, 2020 Share Posted December 25, 2020 will this kill zulrah? 1 2 Quote Link to comment Share on other sites More sharing options...
smile Posted December 25, 2020 Author Share Posted December 25, 2020 1 minute ago, Koala said: will this kill zulrah? Yes 1 2 Quote Link to comment Share on other sites More sharing options...
Koala Posted December 25, 2020 Share Posted December 25, 2020 1 minute ago, smile said: Yes Nice 3 Quote Link to comment Share on other sites More sharing options...
Global Moderators MansNoThot Posted December 25, 2020 Global Moderators Share Posted December 25, 2020 What aminal dos it kell? Gz on relese 2 Quote Link to comment Share on other sites More sharing options...
smile Posted December 25, 2020 Author Share Posted December 25, 2020 3 minutes ago, Mansnothot said: What aminal dos it kell? Gz on relese thanks! :) 1 2 Quote Link to comment Share on other sites More sharing options...
Global Moderators Euan Posted December 25, 2020 Global Moderators Share Posted December 25, 2020 Looks good smile, congrats on the first open source release of this new EpicBot era! 2 Quote Link to comment Share on other sites More sharing options...
Proto Posted December 25, 2020 Share Posted December 25, 2020 Can we share the monopoly on cows? 2 Quote Link to comment Share on other sites More sharing options...
Sellout Posted December 25, 2020 Share Posted December 25, 2020 big pp 1 Quote Link to comment Share on other sites More sharing options...
cheebus Posted December 26, 2020 Share Posted December 26, 2020 What did the poor cows do to u man... 2 Quote Link to comment Share on other sites More sharing options...
smile Posted December 26, 2020 Author Share Posted December 26, 2020 18 hours ago, Proto said: Can we share the monopoly on cows? absolutely not! 2 Quote Link to comment Share on other sites More sharing options...
smile Posted December 26, 2020 Author Share Posted December 26, 2020 20 hours ago, Euan said: Looks good smile, congrats on the first open source release of this new EpicBot era! Thanks! 1 Quote Link to comment Share on other sites More sharing options...
smile Posted December 26, 2020 Author Share Posted December 26, 2020 1 hour ago, cheebus said: What did the poor cows do to u man... They existed 1 Quote Link to comment Share on other sites More sharing options...
seph Posted December 27, 2020 Share Posted December 27, 2020 Quote Link to comment Share on other sites More sharing options...
1airwolf Posted January 22, 2021 Share Posted January 22, 2021 this looks nice but how do i use it Quote Link to comment Share on other sites More sharing options...
smile Posted January 23, 2021 Author Share Posted January 23, 2021 10 hours ago, 1airwolf said: this looks nice but how do i use it Build it in intelliJ Quote Link to comment Share on other sites More sharing options...
crashwork Posted May 26, 2021 Share Posted May 26, 2021 On 1/22/2021 at 9:00 PM, smile said: Build it in intelliJ I've downloaded intelliJ but I don't know how to build it, can you show me how? Quote Link to comment Share on other sites More sharing options...
TheKevin Posted June 27, 2021 Share Posted June 27, 2021 copy paste it into a projekt (there is a video how to setup intelliJ for it) and then just click on build tab and click on build. After this you have to make a "Script" folder in the epicbot folder with the settings and copy paste the compiled file/files into the script folder. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.