Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.osbot.rs07.api.ui.Message;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import java.awt.*;
- import java.util.concurrent.TimeUnit;
- @ScriptManifest(name = "Skeleton", author = "gaylord", version = 1.0, info = "", logo = "")
- public class main extends Script {
- private long timeBegan;
- private long timeRan;
- @Override
- public void onStart() {
- timeBegan = System.currentTimeMillis();
- log("Thank you for using one of KO Scripts!");
- }
- @Override
- public void onExit() {
- log("Thank you for using one of KO Scripts!");
- }
- @Override
- public int onLoop() {
- return 100; //The amount of time in milliseconds before the loop starts over
- }
- @Override
- public void onPaint(Graphics2D g) {
- timeRan = System.currentTimeMillis() - this.timeBegan;
- //covers name
- g.setColor(new Color(178, 163, 132));
- g.fillRect(10, 460, 100, 15);
- //Mouse paint
- Point mP = getMouse().getPosition();
- g.drawLine(mP.x, 0, mP.x, 500);
- g.drawLine(0, mP.y, 800, mP.y);
- //Time running
- Font font = new Font("Open Sans", Font.BOLD, 15);
- g.setFont(font);
- g.setColor(Color.WHITE);
- g.drawString("Time Running: " + formatTime(timeRan), 10, 320);
- }
- @Override
- public void onMessage(Message msg) throws InterruptedException {
- }
- private String formatTime(long duration) {
- String res = "";
- long days = TimeUnit.MILLISECONDS.toDays(duration);
- long hours = TimeUnit.MILLISECONDS.toHours(duration)
- - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
- long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
- .toHours(duration));
- long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
- .toMinutes(duration));
- if (days == 0) {
- res = (hours + ":" + minutes + ":" + seconds);
- } else {
- res = (days + ":" + hours + ":" + minutes + ":" + seconds);
- }
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement