Guest User

Untitled

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