Guest User

Untitled

a guest
Jul 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.Map;
  3.  
  4. import org.rsbot.event.events.ServerMessageEvent;
  5. import org.rsbot.event.listeners.*;
  6. import org.rsbot.script.*;
  7. import org.rsbot.script.wrappers.*;
  8.  
  9. @ScriptManifest(authors = "tssguy123", name = "Tssguy123's First Script", version = 1.0, category = "Other", description = "My First Script!")
  10. public class TssguysFirst extends Script implements ServerMessageListener, PaintListener {
  11. int[] ironId = new int[] { 11954, 11955, 11956 };
  12. int[] pickId = new int[] { 1265, 1267, 1269, 1273, 1271, 1275, 15259 };
  13. int mined = 0;
  14. public long startTime = System.currentTimeMillis();
  15. private String status = "";
  16. public int startexp;
  17. private long hours, minutes, seconds, millis, minutes2;
  18. public RSTile destinationTile = new RSTile(3286, 3368);
  19.  
  20. public void onRepaint(Graphics g) {
  21. if (isLoggedIn()) {
  22. int xpGained = 0;
  23. if (startexp == 0) {
  24. startexp = skills.getCurrentSkillExp(STAT_MINING);
  25. }
  26. xpGained = skills.getCurrentSkillExp(STAT_MINING) - startexp;
  27. millis = System.currentTimeMillis() - startTime;
  28. hours = millis / (1000 * 60 * 60);
  29. millis -= hours * (1000 * 60 * 60);
  30. minutes = millis / (1000 * 60);
  31. millis -= minutes * (1000 * 60);
  32. seconds = millis / 1000;
  33. minutes2 = minutes + (hours * 60);
  34. g.setColor(Color.black);
  35. g.fill3DRect(7, 270, 177, 65, true);
  36. g.setColor(Color.white);
  37. g.drawString("Time running: " + hours + ":" + minutes + ":"
  38. + seconds + ".", 9, 285);
  39. g.drawString("Status: " + status, 9, 300);
  40. g.drawString("XP Gained: " + xpGained, 9, 315);
  41. g.drawString("Total Ores: " + mined, 9, 330);
  42. float xpsec = 0;
  43. if ((minutes > 0 || hours > 0 || seconds > 0) && startexp > 0) {
  44. xpsec = ((float) startexp)
  45. / (float) (seconds + (minutes * 60) + (hours * 60 * 60));
  46. }
  47. float xpmin = xpsec * 60;
  48. float xphour = xpmin * 60;
  49. }
  50. }
  51.  
  52. public int loop() {
  53. if (isInventoryFull()) {
  54. status = "Dropping";
  55. dropAllExcept(pickId);
  56. return 500;
  57. }
  58. RSObject iron = getNearestObjectByID(ironId);
  59. if (iron == null) {
  60. return 500;
  61. }
  62. atObject(iron, "Mine");
  63. status = "Mining";
  64. return 3000;
  65. }
  66.  
  67. public void onFinish() {
  68. log("Thank you for using my script!");
  69. log("Total Ores Mined:" + mined);
  70. log("Time ran:" + hours + ":" + minutes + ":" + seconds);
  71.  
  72. }
  73.  
  74. public boolean onStart(final Map<String, String> args) {
  75. startTime = System.currentTimeMillis();
  76. log("Hello!");
  77. return true;
  78. }
  79.  
  80. public void serverMessageRecieved(final ServerMessageEvent e) {
  81. final String message = e.getMessage();
  82. if (message.contains("iron ore")) {
  83. mined++;
  84. }
  85. }
  86. }
Add Comment
Please, Sign In to add comment