Thread: Retreiving Extension Info
-
August 29th, 2014, 07:48 #1
Retreiving Extension Info
Hi Guys,
Just a quick one - is there a way (ie a function) to get a list of Extensions that are loaded, and/or the details about the Extension(s) (eg Version Number, Author, etc)?
CheersDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
August 29th, 2014, 08:03 #2"Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness
Post your SavageWorlds ruleset feature requests and issue reports here!
-
August 29th, 2014, 08:38 #3
OK, well, if it doesn't exist then I'll write something - and I have.
Feel free to use the following code in your Extensions - I suggest putting the code into an LUA file (say, "lsExtensionManager.lua") and then put this line:
Code:<script name="ExtensionManager" file="lsExtensionmanager.lua"/>
Code:aExtensions = {} function registerExtension(sExtensionName,sAuthor,sVersion) aExtensions[sExtensionName] = {}; if sAuthor then aExtensions[sExtensionName]["author"] = sAuthor; end if nVersion then aExtensions[sExtensionName]["version"] = sVersion; end end function unregisterExtension() if aExtensions then aExtensions[sExtensionName] = nil; end end function isExtensionLoaded(sExtensionName) for kKey,vValue in pairs(aExtensions) do if kKey == sExtensionName then return true; end end return false; end function getExtensionAuthor(sExtensionName) if aExtensions[sExtensionName] then return aExtensions[sExtensionName]["author"] end return nil; end function getExtensionVersion(sExtensionName) if aExtensions[sExtensionName] then return aExtensions[sExtensionName]["version"] end return nil; end
Might I also STRONGLY recommend that SW add this code (or something similar) into the CoreRPG Ruleset - please.
Note: I haven't tested this yet - I wrote it "on the fly" - so if you spot a typo/bug/etc please let us know - thanks.
CheersLast edited by dulux-oz; August 29th, 2014 at 15:10.
Dulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
August 29th, 2014, 10:43 #4
Few notes: can you really "unregister" extension? I mean if you have loaded it in, that means that it's there to stay
version number would better be string, because you could have something like 1.2-build2 -- depending version naming style, which may differ in projects."Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness
Post your SavageWorlds ruleset feature requests and issue reports here!
-
August 29th, 2014, 15:10 #5
I was waiting for someone to point that out - yes, you are right, but I put it in because every other register[something] function has a corresponding unregister[something] function - I was being (anally) complete.
Good call - changes made in the relevant post.
CheersDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
August 29th, 2014, 15:52 #6
Posting untested code! How could you??? ;-)
Nice idea. The main issue, which I'm sure you're aware of, is relying on developers putting this in their extension. Or, we're you thinking it would be more of use to an individual who developed more than one extension themselves - checking for specific extensions and versions to see if they are compatible?Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 29th, 2014, 17:24 #7
Actually a little of both - my own Extensions may have extra/different features when each is loaded with others of my Extensions (which prompted me in the first place) but it would also be good if we, as the developer community, took the trouble to help each other out by using this in our Extensions.
That's one reason I'm asking SW to add it in to FG and/or CoreRPG - or even make the registration automatic as part of the Extension loading code (which exists inside FG) - but even if they decide not too (and I really really hope they do) if we could all use it it would help us all out.
Just my $0.03 worth (inflation, you know).
CheersLast edited by dulux-oz; August 29th, 2014 at 17:26.
Dulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
August 29th, 2014, 17:57 #8Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 29th, 2014, 18:50 #9
Perhaps add a slash handler to output all registered extension names and versions to the chat window? /extensionlist maybe?
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 29th, 2014, 21:38 #10
Considering it already outputs the list of extensions at startup, I would expect the slash command to be a pretty trivial addition.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks