Advertisement
kolton

Untitled

Dec 9th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. var Loader = {
  2. scriptList: [],
  3. init : function () {
  4. this.getScripts();
  5. this.loadScripts();
  6. },
  7. getScripts: function () {
  8. var i,
  9. fileList = dopen("libs/bots/").getFiles();
  10.  
  11. for (i = 0; i < fileList.length; i += 1) {
  12. if (fileList[i].indexOf(".js") > -1) {
  13. this.scriptList.push(fileList[i].substring(0, fileList[i].indexOf(".js")));
  14. }
  15. }
  16. },
  17. loadScripts: function () {
  18. if (!this.scriptList.length) {
  19. print("ΓΏc1You don't have any scripts in bots folder.");
  20. return false;
  21. }
  22.  
  23. for (var i in Scripts) {
  24. if (this.scriptList.indexOf(i) > -1) {
  25. if (!eval("Scripts." + i)) {
  26. continue;
  27. }
  28.  
  29. include("bots/" + i + ".js");
  30.  
  31. try {
  32. eval(i + "()");
  33. } catch (e) {
  34. print("ΓΏc1Script " + i + " " + e);
  35. }
  36. }
  37. }
  38.  
  39. return true;
  40. }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement