Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

teddros

Members
  • Joined

  • Last visited

Everything posted by teddros

  1. //If you start this code with fish still in your inventory it will count those fish, so be careful private int numSalmonCaught;//Total number of salmon caught. Initialize at 0. private int numTroutCaught;//Total number of trout caught. Initialize at 0. private int inventorySlotIndex;//This is the inventory slot number that we are currently examaning //The slot numbers from inventory are from 0-27 NOT 1-28!! //Meaning that if you are fishing for trout initalize the variable at 2 //Because the first two inventory slots are taken with the rod and feathers. //I implemented this by either running the method countLureCatches() in the paint, or creating a thread and run it. //place code inventorySlotIndex = 2 somewhere in your code after you bank or drop the fish. //This way the counter can start again public void countLureCatches(){ if((inventory.getItemInSlot(inventorySlotIndex) != null) || (inventorySlotIndex <= 28)){//Will only run if the //slot that we are currently at has something stored in it, or that our index value is less than 28 //meaning we don't have a full inventory if(inventory.getItemInSlot(inventorySlotIndex).getName().equals("Raw salmon")){//Checks to see what item is in //said inventory slot and checks to see if its salmon. //because .getItemInSlot(int) returns an Item object we must use .getName() to check it against a string. //We must use .equals() to compare strings because they are objects. numSalmonCaught++;//Increments our salmon inventorySlotIndex++;//Increments our inventory slot variable }else{//Only goes through this code if the if statement above is found to be false. if(inventory.getItemInSlot(inventorySlotIndex).getName().equals("Raw trout")){ numTroutCaught++; inventorySlotIndex++; } } } } So I was writing my own fishing script for Barbarian Village and couldn't help but be bothered by the lack of a way to calculate how many trout I caught and how many salmon I caught. Sure I could use onMessage() and have a total fish caught but I wanted a way to have a count that was distinct for both types of fish. So allow me to explain what my code does. First we initialize the variable inventorySlotIndex = 2 in the onStart(). This is because we have something in slot 0 and something in slot one (feathers and fishing rod). Keep in mind the slot numbers are from 0-27 NOT 1-28.We then find out what is in the slot number (trout or salmon) once we detect that something is there. Once we find out what is in that slot say we caught a salmon we then increment both the salmonCaught and the inventorySlotIndex, and do the same thing for the next slot. Once the inventory is full the inventorySlotIndex should be at 28 which is out of bounds for our inventory and cause the script to stop counting. Once we bank or drop the fish it is important that you have the inventorySlotIndex reset to 2. If you are fishing lobster then obviously you start at slot 1. If you are doing something where you have no slots taken with equipment then you'd set it to 0. Any questions suggestions or criticisms are welcomed. If you need help implementing this into your code I'm also willing to help.
  2. import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Ted_Fisher", author = "Ted", version = 1.0, info = "", logo = "") public class Main extends Script { private JFrame gui; private boolean started = false;//For GUI, will be set true once start button is pressed ON GUI; NOT the start button in the OSBOT client. //All set by the GUI; private String selectedFishingMethod = "Salmon/Trout"; //We initialize the variable because unless the user opens the GUI selection box and physically clicks a selection, the selection will be null regardless of whether a selection appears in the section window. private boolean powerFishingMode = true; //Paint private long startTime;//Long because it is in milliseconds. private int numFishCaught; AreaObject areaObject;//Stores our bank location and fishing location. private void createGUI(){//Code for GUI. gui = new JFrame("GUI");//Instantiates (good word to know) a new JFrame Object whose memory address is stored in the variable gui. If you don't understand don't worry. final int GUI_WIDTH = 350, GUI_HEIGHT = 100;//Dimensions for the GUI window. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();//Gets the screen size. final int gX = (int) (screenSize.getWidth() / 2) - (GUI_WIDTH / 2);// Calculates x and y coordinates final int gY = (int) (screenSize.getHeight() / 2) - (GUI_HEIGHT / 2); gui.setBounds(gX, gY, GUI_WIDTH, GUI_HEIGHT); // Set the x coordinate, y coordinate, width and height of the GUI gui.setResizable(false); //Makes user unable to resize GUI. JPanel panel = new JPanel();// Create a sub container JPanel gui.add(panel);// Add it to the GUI JLabel label_1 = new JLabel("What would you like to fish?:");// Create a label label_1.setForeground(Color.white);// Set text color to white panel.add(label_1); // Add it to the JPanel JComboBox<String> fishSelecter = new JComboBox<>(new String[]{"Salmon/Trout", "Lobster", "Swordfish/Tuna"});// Create a select box for fish options fishSelecter.addActionListener(e -> selectedFishingMethod = fishSelecter.getSelectedItem().toString());// Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection. panel.add(fishSelecter);// Add the select box to the JPanel JCheckBox powerFishingCheckBox = new JCheckBox("Power Fishing Mode Enabled"); powerFishingCheckBox.setSelected(true); panel.add(powerFishingCheckBox); JButton startButton = new JButton("Start");// Add an action listener to the button startButton.addActionListener(e -> { // This code is called when the user clicks the start button. started = true;// Set the boolean variable started to true so that the onLoop() method can run. if(!powerFishingCheckBox.isSelected())//Sets powerfishing mode to false if box isn't selected. powerFishingMode = false; setFishingMethod();//Sets the fishing method and fishing location based on the fish you choose areaObject = new AreaObject(selectedFishingMethod,powerFishingMode);//An object that stores our fishing area and bankarea if we aren't powerfishing. gui.setVisible(false); // Hide the GUI }); panel.add(startButton); // Add the button to the panel gui.setVisible(true);//Makes the GUI visible. } public void setFishingMethod(){//This method changes selectedFishingMethod from the name of a fish to the method which said fish is fished. This method is only for the purpose of reusing variables and to save memory usage. Memory usage isn't much of a concern in this script but it is good programming practice to be efficient. if(selectedFishingMethod.equals("Salmon/Trout")){//Because Strings are objects we can not compare them with the == operator. we must use String.equals(). selectedFishingMethod = "Lure"; } else if(selectedFishingMethod.equals("Lobster")){ selectedFishingMethod = "Cage"; } else if(selectedFishingMethod.equals("Swordfish/Tuna")){ selectedFishingMethod = "Harpoon"; } } @[member=Override] public void onStart() {//Code here will execute before the loop is started, only executed once that is why we can set instance class variables to 0; createGUI();//Here because we only create the GUI once. startTime = System.currentTimeMillis();//Gets time in milliseconds and stores it in a variable. numFishCaught = 0;//Initialize these variables at 0 so that they can later be incremented. getExperienceTracker().start(Skill.FISHING);//Starts Experience Tracker. Used for paid, allows use to easily calculate progress. } @[member=Override] public void onExit() {//Only executes once; when the program exits long runTime = System.currentTimeMillis() - startTime;//Basic math, System.currentTimeMillis() will return the time when the program stopped, therefore we subtract the time it started from it to obtain the total time ran. log("The script ran for" + formatTime(runTime) + "."); log("You gained " + getExperienceTracker().getGainedLevels(Skill.FISHING) + " fishing levels."); log("You gained " + getExperienceTracker().getGainedXP(Skill.FISHING) + " fishing experience."); if(gui != null) { // If the JFrame has been created gui.setVisible(false); //Hides GUI. Keep in mind GUI is still there after start button is pressed its just not visable. gui.dispose(); //Dispose of GUI. } } private enum State {//Fishing States FISH, DROP, WAIT, BANKING, WALK_TO_BANK, WALK_TO_FISHING_SPOT, STOP } private State getState(){ if(!neededSuppliesInInventory())//If correct supplies are in inventory continues and doesn't return anything. return State.STOP; if(!inventory.isFull() && !myPlayer().isAnimating() && areaObject.getFishingArea().contains(myPlayer()))//If inventory isn't full AND player isn't animating it returns the fish enumeration. return State.FISH; if(inventory.isFull() && powerFishingMode)//If inventory is full and power fishing mode is enabled it returns the Drop enumeration. return State.DROP; if(inventory.isFull() && !powerFishingMode && !areaObject.getBankArea().contains(myPlayer()))//If the inventory is full and powerFishing mode is disabled it will walk to the bank. return State.WALK_TO_BANK; if(!inventory.isFull() && areaObject.getBankArea().contains(myPlayer()))//If the inventory isn't full and the player is in the bank it will walk to the fishing spot. return State.WALK_TO_FISHING_SPOT; if(inventory.isFull() && areaObject.getBankArea().contains(myPlayer()))//If the inventory is full and the player is in the bank it will bank. return State.BANKING; return State.WAIT;//If none are true it waits. } @[member=Override] public int onLoop() throws InterruptedException { if(started){//Will only run once the start button on the paint is pressed. switch (getState()) {//Try and put minimal code in switch statements to keep it from becoming a cluster fuck. Break up methods it'll not only make the code easier to read, it'll be easier to debug. case FISH: fish();//Example of not writing code in the switch, and instead writing in blocks. break; case DROP: drop(); break; case WALK_TO_BANK: walkToBank(); break; case WALK_TO_FISHING_SPOT: walkToFishingSpot(); break; case BANKING: bank(); break; case WAIT: doAntiBan();//Will only preform antiban when script is waiting sleep(random(200, 300));//Sleeps before breaking from the switch and restarting the loop. break; case STOP: this.stop();//Exits script. } return random(200, 300);//The amount of time in milliseconds before the loop starts over } return random(200,300); } private void walk(boolean toBank) throws InterruptedException {//The boolean argument allows us to determine if we are walking to the bank or to the fishing spot. Lets use reuse the method. if(toBank){ getWalking().webWalk(areaObject.getBankArea()); }else{ getWalking().webWalk(areaObject.getFishingArea()); } } public void walkToBank() throws InterruptedException{ walk(true); } public void walkToFishingSpot() throws InterruptedException{ walk(false); } public void bank() throws InterruptedException{ openBank(); depositBank(); closeBank(); } public void openBank() throws InterruptedException{ NPC closestBanker = getNpcs().closest("Banker"); Entity closestBankBooth = objects.closest("Bank Booth"); if(!bank.isOpen()){ int rand = random(3);//This makes it so it will sometimes open the bank via banker and other times via bank booth. if (rand == 1){ closestBankBooth.interact("Bank"); }else{ closestBanker.interact("Bank"); } sleep(random(1500,5000)); log("opening bank"); } } public void depositBank() throws InterruptedException{ if(bank.isOpen()){ bank.depositAllExcept("Feather","Fly Fishing Rod","Harpoon","Lobster Pot"); sleep(random(400,1000)); } log("Depositing"); } public void closeBank(){ if(bank.isOpen()) bank.close(); log("Closing bank"); } public void fish() throws InterruptedException{ NPC closestFishingSpot = getNpcs().closest("Fishing spot"); closestFishingSpot.interact(selectedFishingMethod); sleep(random(1000,5000)); log("Fishing"); } public void drop(){//drops all items except fly fishing rod and feathers inventory.dropAllExcept("Fly fishing rod","Feather","Harpoon","Lobster Cage","Coins"); log("dropping"); } public boolean neededSuppliesInInventory(){//Another example of breaking up code. if(selectedFishingMethod.equals("Lure")){//If we selected Lure in the GUI. return inventory.contains("Feather") && inventory.contains("Fly Fishing Rod");//Must be separate because it returns true if it finds one. An example of why you must ALWAYS check the API. } if(selectedFishingMethod.equals("Cage")){ return inventory.contains("Lobster Pot","Coins"); } if(selectedFishingMethod.equals("Harpoon")){ return inventory.contains("Harpoon", "Coins"); } return false; } public void doAntiBan() throws InterruptedException { switch (random(1, 50)) {//Will do a certain antiban depending on the random number. case 1: getTabs().open(Tab.SKILLS); sleep(random(500, 5000)); log("Antiban Case 1"); break; case 2: getTabs().open(Tab.SKILLS); sleep(random(500, 5000)); getSkills().hoverSkill(Skill.FISHING); sleep(random(100, 8000)); getMouse().moveRandomly(); log("Antiban Case 2"); break; case 3: getMouse().moveRandomly(); log("Antiban Case 3"); break; case 4: this.camera.movePitch(random(0, 360)); this.camera.moveYaw(random(0, 360)); log("Antiban Case 4"); break; case 5: this.camera.movePitch(random(0, 360)); log("Antiban Case 5"); break; case 6: this.camera.moveYaw(random(0, 360)); log("Antiban Case 6"); break; } sleep(random(700, 1800)); getTabs().open(Tab.INVENTORY); //Returns to inventory whether the antiban runs or not. } @[member=Override] public void onPaint(Graphics2D g) {//Remember (0,0) is the top left corner of the screen. if(started){//Will only run once the start button on the paint is pressed. long runTime = System.currentTimeMillis() - startTime; Font font = new Font("TimesRoman", Font.BOLD, 18);//Font to be used for the painting g.setFont(font); g.setColor(Color.green);//Sets paintbrush color to green. g.drawString("Run Time - " + formatTime(runTime), 10, 220); g.drawString("Experience Gained - " + getExperienceTracker().getGainedXP(Skill.FISHING),300,220); g.drawString("Current Fishing Level - " + getSkills().getStatic(Skill.FISHING), 10, 240); g.drawString("Fishing Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.FISHING), 300, 240); g.drawString("EXP Until Level - " + getSkills().experienceToLevel(Skill.FISHING), 10, 260); g.drawString("EXP Per Hour - " + getExperienceTracker().getGainedXPPerHour(Skill.FISHING), 300, 260); g.drawString("Time Until Next Level - " + formatTime(getExperienceTracker().getTimeToLevel(Skill.FISHING)), 10, 280); g.drawString("Current State - " + getState(), 300, 280); g.drawString("Fish Caught - " + numFishCaught, 10, 300); } } public void onMessage(Message message) throws java.lang.InterruptedException {//Increments the numFishCaught by reading from the chatbox. String txt = message.getMessage().toLowerCase(); if (txt.contains("you catch"))//Not perfect will increment if a player writes "you catch" numFishCaught++; } public final String formatTime(final long ms){//Converts milliseconds to hh:mm:ss. It will also leave out hh if its is 0. long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } } import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; public class AreaObject {//Basic class to store areas. private Area bankArea; private Area fishingArea; public final Area barbarianVillage = new Area(3100, 3436, 3112, 3421); public final Area karamja = new Area(2922, 3175, 2927, 3183); public AreaObject(String selectedFishingMethod, boolean powerFishingMode) {//Constructor setBankArea(selectedFishingMethod, powerFishingMode); setFishingArea(selectedFishingMethod); } public Area getBankArea() { return bankArea; } public void setBankArea(String selectedFishingMethod, Boolean powerFishingMode) { if(powerFishingMode == true){ bankArea = null; } if(selectedFishingMethod == "Lure" && powerFishingMode == false){ bankArea = Banks.EDGEVILLE; } F2P fisher that I have been working on. Any comments questions concerns or issues with my code feel free to address. Have not tested anything other than barbarian village which has been running flawlessly thus far.
  3. This question never gets old. It's nothing just looks neater to me, my friend used to do this and unfortunately it stuck with me as ugly as it may look. By the way I read your tutorial on the GUI, it was excellent so I stole the entire thing. I'm creating a much more improved fishing script, should be done in a day or so unless I get bored of runescape in a day or so which is highly likely.
  4. Haven't played Runescape in years, logged on briefly thought I'd write a few scripts for the hell of it. Posting this mostly just to help anyone who is new at java or programming in general. All of these scripts are extremely basic and should only be used as a reference; use them at your own risk. I didn't see many open source code scripts posted, reading other people's code and editing it to do what you want is the only way to learn coding, especially at a beginner level. Any questions feel free to ask. Fisher import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Ted_Fisher", author = "Ted", version = 0, info = "", logo = "") public class main extends Script { //*************************************************************************************************************************** private long startTime; private int troutCaught; private int salmonCaught; @[member='Override'] public void onStart() {//Code here will execute before the loop is started startTime = System.currentTimeMillis(); troutCaught = 0; salmonCaught = 0; getExperienceTracker().start(Skill.FISHING); } //*************************************************************************************************************************** @[member='Override'] public void onExit() { long runTime = System.currentTimeMillis() - startTime; log("You caught - " + troutCaught + " trout."); log("You caught - " + salmonCaught + " salmon."); log("The script ran for" + formatTime(runTime) + "."); log("You gained " + getExperienceTracker().getGainedLevels(Skill.FISHING) + " fishing levels."); log("You gained " + getExperienceTracker().getGainedXP(Skill.FISHING) + " fishing experience."); } //************************************************************************************************************************* private enum State {//Fishing States FISH, DROP, WAIT, BANKING, WALK_TO_BANK, WALK_TO_FISHING_SPOT, STOP } //*************************************************************************************************************************** private State getState(){ if(!neededSuppliesInInventory())//if correct supplies are in inventory continues return State.STOP; if(!inventory.isFull() && !myPlayer().isAnimating())//if inventory isn't full and player isnt animating it fishes return State.FISH; if(inventory.isFull())//if inventory is full drops return State.DROP; return State.WAIT;//if none are true waits } //*************************************************************************************************************************** //*************************************************************************************************************************** @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case FISH: fish(); break; case DROP: drop(); break; case WAIT: log("waiting"); sleep(random(500, 700)); break; case STOP: this.stop();//exits script } return random(200, 300); }//The amount of time in milliseconds before the loop starts over //*************************************************************************************************************************** public void fish(){//fishes NPC closestFishingSpot = getNpcs().closest("Fishing spot"); closestFishingSpot.interact("Lure"); log("fishing"); } //*************************************************************************************************************************** public void drop(){//drops all items except fly fishing rod and feathers inventory.dropAllExcept("Fly fishing rod","Feather"); log("dropping"); } //*************************************************************************************************************************** public boolean neededSuppliesInInventory(){ return inventory.contains("Feather") && inventory.contains("Fly Fishing Rod"); } //*************************************************************************************************************************** @[member='Override'] public void onPaint(Graphics2D g) { long runTime = System.currentTimeMillis() - startTime; Font font = new Font("Open Sans", Font.BOLD, 18); g.setFont(font); g.drawString("Run Time - " + formatTime(runTime), 10, 220); g.drawString("Experience Gained - " + getExperienceTracker().getGainedXP(Skill.FISHING),300,220); g.drawString("Current Fishing Level - " + getSkills().getStatic(Skill.FISHING), 10, 240); g.drawString("Fishing Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.FISHING), 300, 240); g.drawString("EXP Until Level - " + getSkills().experienceToLevel(Skill.FISHING), 10, 260); g.drawString("EXP Per Hour - " + getExperienceTracker().getGainedXPPerHour(Skill.FISHING), 300, 260); g.drawString("Time Until Next Level - " + formatTime(getExperienceTracker().getTimeToLevel(Skill.FISHING)), 10, 280); g.drawString("Current State - " + getState(), 300, 280); g.drawString("Salmon Caught - " + salmonCaught, 10, 300); g.drawString("Trout Caught - " + troutCaught, 300, 300); } //*************************************************************************************************************************** public void onMessage(Message message) throws java.lang.InterruptedException { String txt = message.getMessage().toLowerCase(); if (txt.contains("trout")) troutCaught++; if (txt.contains("salmon")) salmonCaught++; } //************************************************************************************************************************** public final String formatTime(final long ms){//converts milliseconds to hh:mm:ss will leave out hh and mm if its is 0 long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } //*************************************************************************************************************************** } Chicken Killer import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Ted_Chicken_Killer", author = "Ted", version = 0, info = "", logo = "") public class main extends Script { //*************************************************************************************************************************** private long startTime; private long feathersInInventoryAtStart;//for the paint to determine how many we collected. It is a long becauswe the getAmout() method is returns a long private int chickensKilled; @[member='Override'] public void onStart() {//Code here will execute before the loop is started startTime = System.currentTimeMillis(); feathersInInventoryAtStart = this.inventory.getAmount("Feather"); chickensKilled = 0; getExperienceTracker().start(Skill.ATTACK); getExperienceTracker().start(Skill.STRENGTH); getExperienceTracker().start(Skill.DEFENCE); getExperienceTracker().start(Skill.HITPOINTS); log("Script started"); } //*************************************************************************************************************************** @[member='Override'] public void onExit() { log("Script ended"); } //************************************************************************************************************************* private enum State {//Fishing States FIGHT, WAIT, COLLECT,STOP } //*************************************************************************************************************************** private State getState(){ if(myPlayer().isAnimating() || myPlayer().isMoving() || myPlayer().isUnderAttack())//If my player is doing something, or isnt moving and isnt return State.WAIT; if(feathersAreReachable() && !myPlayer().isUnderAttack()) return State.COLLECT;//if feathers are present will collect them return State.FIGHT;//if none are true FIGHTS } //*************************************************************************************************************************** //*************************************************************************************************************************** @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case FIGHT: attack(); break; case COLLECT: collect(); break; case WAIT: log("waiting"); sleep(random(500, 700)); break; case STOP: this.stop();//exits script } return random(200, 300); }//The amount of time in milliseconds before the loop starts over //*************************************************************************************************************************** public boolean feathersAreReachable(){ GroundItem feather = groundItems.closest("Feather"); return feather != null && feather.exists() && map.canReach(feather); } //************************************************************************************************************************** //*************************************************************************************************************************** public void attack(){//attacks chickens NPC closestChicken = getNpcs().closest("Chicken"); if(closestChicken.isAttackable())//if your player can attack chicken attacks it closestChicken.interact("Attack"); log("Fighting Chicken"); } //*************************************************************************************************************************** public void collect(){ GroundItem closestFeather = getGroundItems().closest("Feather"); closestFeather.interact("Take"); log("Collecting Feathers"); } //************************************************************************************************************************** @[member='Override'] public void onPaint(Graphics2D g) { long runTime = System.currentTimeMillis() - startTime; long feathersCollected = this.inventory.getAmount("Feather") - feathersInInventoryAtStart; Font font = new Font("Open Sans", Font.BOLD, 18); g.setFont(font); //g.setColor(Color.decode("47FF11"));//Sets paintbrush to lime green g.drawString("Run Time - " + formatTime(runTime), 200, 220); g.drawString("Feathers Collected - " + feathersCollected, 10, 240); g.drawString("Chickens Killed - " + feathersCollected, 310, 240); g.drawString("Attack Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.ATTACK), 10, 260); g.drawString("Strength Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.STRENGTH), 310, 260); g.drawString("Defense Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.DEFENCE), 10, 280); g.drawString("Hitpoints Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.HITPOINTS), 310, 280); g.drawString("Current State - " + getState(), 200, 300); } //*************************************************************************************************************************** public final String formatTime(final long ms){//converts milliseconds to hh:mm:ss will leave out hh and mm if its is 0 long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } //*************************************************************************************************************************** } Stunner import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Ted_Stunner", author = "Ted", version = 0, info = "", logo = "") public class main extends Script { //*************************************************************************************************************************** private long startTime; private long numSplashes;//for the paint to determine how many we collected. It is a long becauswe the getAmout() method is returns a long @[member='Override'] public void onStart() {//Code here will execute before the loop is started startTime = System.currentTimeMillis(); numSplashes = 0; getExperienceTracker().start(Skill.MAGIC); } //*************************************************************************************************************************** @[member='Override'] public void onExit() { } //************************************************************************************************************************* private enum State {//Fishing States SPLASH,WAIT,STOP } //*************************************************************************************************************************** private State getState(){ if(myPlayer().isAnimating() || myPlayer().isMoving() || myPlayer().isUnderAttack())//If my player is doing something, or isnt moving and isnt return State.WAIT; return State.SPLASH;//if none are true FIGHTS } //*************************************************************************************************************************** //*************************************************************************************************************************** @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case SPLASH: splash(); sleep(random(800, 1500)); break; case WAIT: log("waiting"); sleep(random(500, 1500)); break; case STOP: this.stop();//exits script } return random(200, 300); }//The amount of time in milliseconds before the loop starts over //*************************************************************************************************************************** public void splash(){//attacks chickens NPC monk_of_zamorack = getNpcs().closest("Monk of Zamorak"); if(monk_of_zamorack.isAttackable()){//if your player can attack chicken attacks it if(getTabs().getOpen() != null && getTabs().getOpen().equals(Tab.MAGIC)) { getMagic().castSpellOnEntity(Spells.NormalSpells.CURSE, monk_of_zamorack); numSplashes++; } else { getTabs().open(Tab.MAGIC); } } log("SPLASHING"); } //************************************************************************************************************************** // public void onMessage(Message message) throws java.lang.InterruptedException { // String txt = message.getMessage().toLowerCase(); //if (txt.contains("trout")) //************************************************************************************************************************** @[member='Override'] public void onPaint(Graphics2D g) { long runTime = System.currentTimeMillis() - startTime; Font font = new Font("Open Sans", Font.BOLD, 18); g.setFont(font); g.drawString("Run Time - " + formatTime(runTime), 10, 220); g.drawString("Experience Gained - " + getExperienceTracker().getGainedXP(Skill.MAGIC),300,220); g.drawString("Current Magic Level - " + getSkills().getStatic(Skill.MAGIC), 10, 240); g.drawString("Magic Levels Gained - " + getExperienceTracker().getGainedLevels(Skill.MAGIC), 300, 240); g.drawString("EXP Until Level - " + getSkills().experienceToLevel(Skill.MAGIC), 10, 260); g.drawString("EXP Per Hour - " + getExperienceTracker().getGainedXPPerHour(Skill.MAGIC), 300, 260); g.drawString("Time Until Next Level - " + formatTime(getExperienceTracker().getTimeToLevel(Skill.MAGIC)), 10, 280); g.drawString("Current State - " + getState(), 300, 280); g.drawString("Number of Splashes - " + numSplashes, 10, 300); } //*************************************************************************************************************************** public final String formatTime(final long ms){//converts milliseconds to hh:mm:ss will leave out hh and mm if its is 0 long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } //*************************************************************************************************************************** }

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.