icekontroi

Goblin Loader Tester

Jun 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. package scripts;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api2007.NPCs;
  5. import org.tribot.api2007.types.RSModel;
  6. import org.tribot.api2007.types.RSNPC;
  7. import org.tribot.script.Script;
  8. import org.tribot.script.ScriptManifest;
  9.  
  10. @ScriptManifest(authors = "IceKontroI", category = "@ Util", name = "Goblin Model Loader", version = 0.01, description = "Loads all goblins in the surrounding area, then processes the RSModel for each, printing relevant data to the client debug.")
  11.  
  12. public class Tester extends Script {
  13.  
  14. @Override
  15. public void run() {
  16.  
  17. setLoginBotState(false);
  18.  
  19. long init = System.currentTimeMillis();
  20.  
  21. RSNPC[] goblins = NPCs.find("Goblin");
  22.  
  23. General.println("Took " + (System.currentTimeMillis() - init) + " MS to find " + goblins.length + " goblins");
  24.  
  25. RSModel[] models = new RSModel[goblins.length];
  26.  
  27. long[] times = new long[goblins.length];
  28.  
  29. long sum = 0;
  30.  
  31. init = System.currentTimeMillis();
  32.  
  33. for (int i = 0; i < goblins.length; i++) {
  34.  
  35. long start = System.currentTimeMillis();
  36.  
  37. models[i] = goblins[i].getModel();
  38.  
  39. times[i] = System.currentTimeMillis() - start;
  40.  
  41. sum += times[i];
  42. }
  43.  
  44. General.println("Average time: " + Math.round((double) sum / times.length) + " MS x " + times.length + " goblins");
  45.  
  46. double time = Math.round(System.currentTimeMillis() - init);
  47.  
  48. General.println("Total model processing time: " + time + " MS (" + time / 1000 + " seconds)");
  49. }
  50. }
Add Comment
Please, Sign In to add comment