Advertisement
Guest User

Untitled

a guest
May 29th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.util.Map;
  3.  
  4. import org.rsbot.script.Script;
  5. import org.rsbot.script.ScriptManifest;
  6.  
  7. @ScriptManifest( authors = { "Botter118" }, category = "Wise", name = "FactGiver", description = "Says RS Facts")
  8. public class FactGiver extends Script {
  9.  
  10.     public long startTime;
  11.     public int randomLine;
  12.     public String textToSay;
  13.     public int sentCount;
  14.     public int secondsTilNext;
  15.  
  16.     public void chooseText(int randLine, String whatToSay) {
  17.         if(randLine == 1) {
  18.             whatToSay = "This";
  19.         }else if(randLine == 2) {
  20.             whatToSay = "Is";
  21.         }else if(randLine == 3) {
  22.             whatToSay = "Sparta!";
  23.         }else{
  24.             whatToSay = "!!!!!";
  25.         }
  26.     }
  27.  
  28.     public void sayText(String whatToSay) {
  29.         sendText(whatToSay, true);
  30.         sentCount++;
  31.     }
  32.  
  33.     public void randomizeRandom(int randLine) {
  34.         randLine = random(1, 4);
  35.     }
  36.  
  37.     public void doItAll(int randLine, String whatToSay) {
  38.         chooseText(randLine, whatToSay);
  39.         sayText(whatToSay);
  40.     }
  41.  
  42.     public void countDown(int seconds) {
  43.         while(seconds > 1) {
  44.             secondsTilNext = seconds;
  45.             wait(1000);
  46.             seconds--;
  47.         }
  48.     }
  49.    
  50.     public int loop() {
  51.        
  52.         if(!isLoggedIn()) {
  53.             login();
  54.         }
  55.  
  56.         if(getCurrentTab() != TAB_CLAN) {
  57.             openTab(TAB_CLAN);
  58.         }
  59.  
  60.         secondsTilNext = 0;
  61.  
  62.         randomizeRandom(randomLine);
  63.         doItAll(randomLine, textToSay);
  64.  
  65.         moveMouse(random(2,5), random(12,20), random(2,30), 30);
  66.  
  67.         countDown(170);
  68.  
  69.         return random(1, 10);
  70.     }
  71.  
  72.     public void onRepaint(Graphics g) {
  73.         if(isLoggedIn()){
  74.             long millis = System.currentTimeMillis() - startTime;
  75.             long hours = millis / (1000 * 60 * 60);
  76.             millis -= hours * 1000 * 60 * 60;
  77.             long minutes = millis / (1000 * 60);
  78.             millis -= minutes * 1000 * 60;
  79.             long seconds = millis / 1000;
  80.             g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 7, 5);
  81.             g.drawString("Sent " + sentCount + " messages", 7, 17);
  82.             g.drawString("Seconds Until Next Message:" + secondsTilNext, 7, 29);
  83.         }
  84.     }
  85.  
  86.     public boolean onStart(final Map<String, String> args) {
  87.         return true;
  88.     }
  89.  
  90.     public void onFinish() {
  91.  
  92.     }
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement