Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 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.bot.*;
  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 PaintListener {
  15. int[] ironId = new int[] { 11954, 11955, 11956 };
  16. int[] pickId = new int[] { 1265, 1267, 1269, 1273, 1271, 1275, 15259};
  17. int mined = 0;
  18. public long startTime = System.currentTimeMillis();
  19. private String status = "";
  20. public int startexp;
  21. private long hours, minutes, seconds, millis, minutes2;
  22. public RSTile destinationTile = new RSTile(3286, 3368);
  23.  
  24. public void onRepaint(Graphics g) {
  25. if (isLoggedIn()) {
  26. int xpGained = 0;
  27. if (startexp == 0) {
  28. startexp = skills.getCurrentSkillExp(STAT_MINING);
  29. }
  30. xpGained = skills.getCurrentSkillExp(STAT_MINING) - startexp;
  31. millis = System.currentTimeMillis() - startTime;
  32. hours = millis / (1000 * 60 * 60);
  33. millis -= hours * (1000 * 60 * 60);
  34. minutes = millis / (1000 * 60);
  35. millis -= minutes * (1000 * 60);
  36. seconds = millis / 1000;
  37. minutes2 = minutes + (hours * 60);
  38. g.setColor(Color.black);
  39. g.fill3DRect(7, 270, 177, 65, true);
  40. g.setColor(Color.white);
  41. g.drawString("Time running: " + hours + ":" + minutes + ":"
  42. + seconds + ".", 9, 285);
  43. g.drawString("Status: " + status, 9, 300);
  44. g.drawString("XP Gained: " + xpGained, 9, 315);
  45. g.drawString("Total Ores: " + mined, 9, 330);
  46. float xpsec = 0;
  47. if ((minutes > 0 || hours > 0 || seconds > 0) && startexp > 0) {
  48. xpsec = ((float) startexp)
  49. / (float) (seconds + (minutes * 60) + (hours * 60 * 60));
  50. }
  51. float xpmin = xpsec * 60;
  52. float xphour = xpmin * 60;
  53. }
  54. }
  55.  
  56. public void serverMessageRecieved(final ServerMessageEvent e) {
  57. final String message = e.getMessage();
  58. if (message.contains("iron ore")) {
  59. mined++;
  60. }
  61. }
  62.  
  63. public int loop(){
  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 3000;
  76. }
  77.  
  78. public void onFinish() {
  79. log("Thank you for using my script!");
  80. log("Total Ores Mined:" + mined);
  81. log("Time ran:" + hours + ":" + minutes + ":" + seconds);
  82.  
  83. }
  84.  
  85. public boolean onStart(final Map<String, String> args) {
  86. startTime = System.currentTimeMillis();
  87. log("Hello!");
  88. return true;
  89. }
  90. }
Add Comment
Please, Sign In to add comment