Today was the first time I had a problem with the order in which modules are loaded in my 2.10 bot. There was a short discussion in
this thread. Anyways, this was all completely off topic in the Online.php thread, but my own solution and Xenixa's got me thinking. The following concept may be complete bogus, or totally unnecessary. I have no idea what the new version brings, and how load order of modules is handled there.
- Put all modules except for main.php into one directory, even Bot.php, AOChat and such.
- Let main.php load (require_once) the modules in this directory in any order, no need to sort, no need to load Bot.php and such modules first. Remove the code from main.php that outputs which module just got loaded.
- Add as many require_once into each module's header as necessary. All "normal" modules would need Bot.php at least, plus all additional modules they rely upon. Bot.php would require AOChat.php and MySQL.php.
- Put the $bot -> log(...) output that tells us which module got loaded into each module's constructor.
Uhm... that's about it. I think this way modules should automatically get loaded in one of the many correct orders. AOChat.php and MySQL.php would still be loaded first, Bot.php thereafter, modules that rely upon other modules last. All modules that got loaded after Bot.php would output that they have been loaded themselves. Would that work? Would anyone need or want this?
Would be cool if someone tells me this is a stupid idea before I go and break my bot just for the fun of it.