IllusionaryOne

Untitled

Feb 5th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. Trying to figure out how to reset $script at this point. I believe what happens is, based on this. when initReady is called for init.js, $script is still the last script in memory which is topCommand.js for me. There is a Java API call though to set $script, so figuring out how to solve this now.
  2.  
  3. [02-05-2016 @ 19:48:19] Loaded module: commands/streamCommand.js (Enabled)
  4. [02-05-2016 @ 19:48:19] >> addHook: ./commands/topCommand.js[-1]
  5. function () {
  6. if ($.bot.isModuleEnabled("./commands/topCommand.js")) {
  7. $.registerChatCommand("./commands/topCommand.js", "top5", 7);
  8. $.registerChatCommand("./commands/topCommand.js", "top5time", 7);
  9. }
  10. }
  11.  
  12. [02-05-2016 @ 19:48:19] Loaded module: commands/topCommand.js (Enabled)
  13. [02-05-2016 @ 19:48:19] Bot locked & loaded!
  14. [02-05-2016 @ 19:48:19] >> addHook: ./commands/topCommand.js[101]
  15. function () {
  16. $.registerChatCommand("./init.js", "chat", 1);
  17. $.registerChatCommand("./init.js", "module", 1);
  18. $.registerChatCommand("./init.js", "reconnect", 2);
  19. }
  20.  
  21. Notice that topCommand.js is reloaded.. because of $script in addHook:
  22.  
  23. function addHook(hook, handler) {
  24. var scriptFile = $script.getPath().replace('\\', '/').replace('./scripts/', ''),
  25. i = getHookIndex(scriptFile, hook);
  26. if (hook == 'initReady') $.consoleLn(">> addHook: " + scriptFile + "[" + i + "] " + handler);
  27. if (i > -1) {
  28. hooks[i].handler = handler;
  29. } else {
  30. hooks.push(new Hook(scriptFile, hook, handler));
  31. }
  32. };
Advertisement
Add Comment
Please, Sign In to add comment