Advertisement
Guest User

Paint Tutorial Example 3

a guest
Aug 16th, 2015
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.10 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.util.concurrent.TimeUnit;
  3.  
  4. import org.dreambot.api.methods.skills.Skill;
  5. import org.dreambot.api.methods.tabs.Tab;
  6. import org.dreambot.api.script.AbstractScript;
  7. import org.dreambot.api.script.Category;
  8. import org.dreambot.api.script.ScriptManifest;
  9. import org.dreambot.api.utilities.Timer;
  10. import org.dreambot.api.wrappers.interactive.GameObject;
  11.  
  12.  
  13. @ScriptManifest(author = "Pug", name = "paint tutorial", version = 0.01, description = "0.01", category = Category.MISC)
  14. public class test extends AbstractScript
  15. {
  16.  
  17.     // PAINT VARIABLE DECLARATIONS
  18.     private int currentLevel;
  19.     private int beginningLevel;
  20.     private int levelsGained;
  21.    
  22.     // ONSTART() METHOD
  23.     public void onStart()
  24.     {
  25.         beginningLevel = getSkills().getRealLevel(Skill.RUNECRAFTING);
  26.     }
  27.  
  28.     // ONLOOP() METHOD
  29.     @Override
  30.     public int onLoop()
  31.     {
  32.         return 0;
  33.     }
  34.    
  35.     //OUR PAINT METHOD
  36.     public void onPaint(Graphics g)
  37.     {
  38.         currentLevel = getSkills().getRealLevel(Skill.RUNECRAFTING);
  39.         levelsGained = currentLevel - beginningLevel;
  40.         // STANDARD WAY TO DISPLAY LEVELS
  41.         g.drawString("" + beginningLevel, 1,1);
  42.         g.drawString("" + currentLevel, 1,1);
  43.         g.drawString("" + levelsGained, 1, 1);
  44.         // ALT WAY TO DISPLAY LEVELS AS SHOWN IN THREAD
  45.         g.drawString(beginningLevel + " / " + currentLevel + " ( +" + levelsGained + " )", 1, 1);
  46.     }
  47.    
  48.     private String ft(long duration)
  49.     {
  50.         String res = "";
  51.         long days = TimeUnit.MILLISECONDS.toDays(duration);
  52.         long hours = TimeUnit.MILLISECONDS.toHours(duration)
  53.         - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
  54.         long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
  55.         - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
  56.         .toHours(duration));
  57.         long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
  58.         - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
  59.         .toMinutes(duration));
  60.         if (days == 0) {
  61.         res = (hours + ":" + minutes + ":" + seconds);
  62.         } else {
  63.         res = (days + ":" + hours + ":" + minutes + ":" + seconds);
  64.         }
  65.         return res;
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement