How to check what addons are currently loaded via a .lua script?

Zecheriah

Member
I want to make a mod where every time a replay is saved in Time Attack, it will automatically create a .txt file with the replay name. The file will contain a list of every addon that was loaded (in order) when the replay was saved. It would be useful for if you want to watch a replay but aren't sure which mods you were using.

So, is there any way to either:
  • Check whenever an addon is newly loaded, or
  • Check what addons are currently loaded at any given time?
 
I want to make a mod where every time a replay is saved in Time Attack, it will automatically create a .txt file with the replay name. The file will contain a list of every addon that was loaded (in order) when the replay was saved. It would be useful for if you want to watch a replay but aren't sure which mods you were using.

So, is there any way to either:
  • Check whenever an addon is newly loaded, or
  • Check what addons are currently loaded at any given time?

The following information was extracted from this SRB2 Wiki page:
[SRB2 Wiki] Lua/Hooks said:

AddonLoaded​

Hook format: addHook("AddonLoaded", functionname)

Function format: function()

Executes once every time any addon loads. This hook is useful most for compatibility between mods, and also this is the only hook that allows adding new hooks.

This hook is only executed locally, and thus isn't network-safe. Use at your own risk.
The "AddonLoaded" hook was added in v2.2.14 and it's still available for the latest version of the game.

Unfortunately, there doesn't seem to exist a way of recieving an add-on's name with Lua, plus it doesn't checks for add-ons loaded before add-ons using "AddonLoaded".



By the way, if your plans were generating that .txt so players can load those add-ons and watch their replay, let me tell you SRB2 already can load add-ons used on replays automatically. But I won't stop from trying to do that thingy if you want to!
srb20098.gif
 
Thanks for the info! I was thinking the AddonLoaded hook could work if there was a way to access any lines that are sent to the console, but I'm not sure if that's actually possible.

By the way, if your plans were generating that .txt so players can load those add-ons and watch their replay, let me tell you SRB2 already can load add-ons used on replays automatically. But I won't stop from trying to do that thingy if you want to!
I didn't think to use the guest replay for this; I was trying to view best time replays with a character addon currently loaded and it would often tell me the addons are out of order, which is why I wanted to make this mod. So, that's probably the best work around, at least for vanilla maps. Thanks!
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top