Advertisement
skillerkidos1

Untitled

Apr 11th, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. import org.osbot.rs07.api.ui.Message;
  2. import org.osbot.rs07.script.Script;
  3.  
  4. import org.osbot.rs07.script.ScriptManifest;
  5.  
  6. import java.awt.*;
  7. import java.util.concurrent.TimeUnit;
  8.  
  9. @ScriptManifest(name = "Skeleton", author = "gaylord", version = 1.0, info = "", logo = "")
  10.  
  11. public class main extends Script {
  12.  
  13. private long timeBegan;
  14. private long timeRan;
  15.  
  16. @Override
  17. public void onStart() {
  18. timeBegan = System.currentTimeMillis();
  19. log("Thank you for using one of KO Scripts!");
  20.  
  21.  
  22. }
  23.  
  24.  
  25.  
  26. @Override
  27. public void onExit() {
  28. log("Thank you for using one of KO Scripts!");
  29.  
  30. }
  31.  
  32. @Override
  33. public int onLoop() {
  34.  
  35. return 100; //The amount of time in milliseconds before the loop starts over
  36.  
  37. }
  38.  
  39. @Override
  40. public void onPaint(Graphics2D g) {
  41. timeRan = System.currentTimeMillis() - this.timeBegan;
  42.  
  43. //covers name
  44. g.setColor(new Color(178, 163, 132));
  45. g.fillRect(10, 460, 100, 15);
  46.  
  47. //Mouse paint
  48. Point mP = getMouse().getPosition();
  49. g.drawLine(mP.x, 0, mP.x, 500);
  50. g.drawLine(0, mP.y, 800, mP.y);
  51.  
  52. //Time running
  53. Font font = new Font("Open Sans", Font.BOLD, 15);
  54. g.setFont(font);
  55. g.setColor(Color.WHITE);
  56. g.drawString("Time Running: " + formatTime(timeRan), 10, 320);
  57.  
  58.  
  59. }
  60.  
  61.  
  62. @Override
  63. public void onMessage(Message msg) throws InterruptedException {
  64.  
  65. }
  66.  
  67.  
  68. private String formatTime(long duration) {
  69. String res = "";
  70. long days = TimeUnit.MILLISECONDS.toDays(duration);
  71. long hours = TimeUnit.MILLISECONDS.toHours(duration)
  72. - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
  73. long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
  74. - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
  75. .toHours(duration));
  76. long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
  77. - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
  78. .toMinutes(duration));
  79. if (days == 0) {
  80. res = (hours + ":" + minutes + ":" + seconds);
  81. } else {
  82. res = (days + ":" + hours + ":" + minutes + ":" + seconds);
  83. }
  84. return res;
  85. }
  86.  
  87.  
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement