Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.Icon;
- import javax.swing.JOptionPane;
- import java.util.ArrayList;
- import java.util.Map;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.*;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = "tssguy123", name = "Tssguy123's First Script", version = 1.0, category = "Other", description = "My First Script!")
- public class TssguysFirst extends Script implements ServerMessageListener,
- PaintListener {
- int[] ironId = new int[] { 11954, 11955, 11956 };
- int[] pickId = new int[] { 1265, 1267, 1269, 1273, 1271, 1275, 15259 };
- int mined = 0;
- public long startTime = System.currentTimeMillis();
- private String status = "";
- public int startexp;
- private long hours, minutes, seconds, millis, minutes2;
- public RSTile destinationTile = new RSTile(3286, 3368);
- public void onRepaint(Graphics g) {
- if (isLoggedIn()) {
- int xpGained = 0;
- if (startexp == 0) {
- startexp = skills.getCurrentSkillExp(STAT_MINING);
- }
- xpGained = skills.getCurrentSkillExp(STAT_MINING) - startexp;
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- minutes2 = minutes + (hours * 60);
- g.setColor(Color.black);
- g.fill3DRect(7, 270, 177, 65, true);
- g.setColor(Color.white);
- g.drawString("Time running: " + hours + ":" + minutes + ":"
- + seconds + ".", 9, 285);
- g.drawString("Status: " + status, 9, 300);
- g.drawString("XP Gained: " + xpGained, 9, 315);
- g.drawString("Total Ores: " + mined, 9, 330);
- float xpsec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && startexp > 0) {
- xpsec = ((float) startexp)
- / (float) (seconds + (minutes * 60) + (hours * 60 * 60));
- }
- float xpmin = xpsec * 60;
- float xphour = xpmin * 60;
- }
- }
- public int loop() {
- if (inventoryContains(pickId)) {
- if (distanceTo(new RSTile(3286, 3368)) > 10) {
- walkTo(new RSTile(3286, 3368));
- status = "Walking";
- return 500;
- }
- if (isInventoryFull()) {
- status = "Dropping";
- dropAllExcept(pickId);
- return 500;
- }
- RSObject iron = getNearestObjectByID(ironId);
- if (iron == null) {
- return 500;
- }
- atObject(iron, "Mine");
- status = "Mining";
- return 2500;
- }
- else{
- log("No pick in inventory. Stopping script...");
- return -1;
- }
- }
- public void onFinish() {
- log("Thank you for using my script!");
- log("Total Ores Mined:" + mined);
- log("Time ran:" + hours + ":" + minutes + ":" + seconds);
- }
- public boolean onStart(final Map<String, String> args) {
- startTime = System.currentTimeMillis();
- log("Hello!");
- return true;
- }
- public void serverMessageRecieved(final ServerMessageEvent e) {
- final String message = e.getMessage();
- if (message.contains("mine some iron")) {
- mined++;
- }
- }
- }
Add Comment
Please, Sign In to add comment