SkyrimForge Forums

Curse Client and Packager > Packager Discussion

Packager Documentation!

  • 3 posts
    #1 Feb 17, 2012 at 20:27 UTC - 0 likes

    Hey guys! Here is your long-awaited packager documentation, complete with an example or two. :) Hopefully this will help those of you who have mods that require scripting, but did not previously have the scripting know-how to place your mods in the Curse Client!

    Format Layout:
    MyMod.zip
    ./MyMod.manifest
    ./scripts/Install.lua
    ./Readme.txt
    ./Changelog.txt
    ./License.txt
    ./screenshots/img1.jpg
    ./screenshots/img2.jpg
    ./Data/MyMod.esp
    ./Data/Interface/Coolstuff.swf
    ./Options/option1/Data/MyMod2.esp
    ./Options/option2/Data/MyMod2.esp

    Manifest File:
    A serialized file that has the data about what files need to be installed by default, metadata about the project and author, what type of licensing options, and other metadata.

    Install.lua:
    Lua has been utilized for scripting advanced installs. The install script is completely sandboxed when executed. Full docs for the supported function calls can be found below.

    Readme, Changelog, and License text files:
    They are all three plain text files, containing relevent info. There is no special formatting in these files required, however we do allow for markdown syntax to enhance formatting.

    Screenshot Folder:
    The screenshot folder contains screenshots related to the app.

    Data Folder:
    These files are literally the files that'd be copied into the main game's data folder. The manifest file can mark files in this folder to not install by default.

    Options Folder:
    The options folder allows you to create groups of files that get installed as a sub feature to a mod.

    Underneath the Options folder there is a folder per Option Group that each represent an option. Each option folder contains it's own Data folder to be copied in to the game's Data folder. None of these are installed by default with the installers, but can be installed via the lua scripting with an installChoice api by giving it the name of the option group (folder name) you wish to install.

    This allows for a clean solution when you have multiple versions of the same file.

    Lua Docs:

    choice(question, options)
    Displays a list of choices in the install wizard. A single option is selectable similar to a radio select.

    Parameters
    question:
    a string that is displayed as the question
    options:
    a table that holds the details for the options, please refer to the options format for details

    Return Values
    choice:
    the key of the chosen choice.

    installFile(file)
    Installs a single file from the package’s data directory at the same spot in the game’s data folder. Has no effect on files flagged to install by default.

    Parameters
    file:
    a string representing the relative path to the Data folder which should be installed.

    Return Values
    None

    Notes
    When in the packager this should error if the file doesn’t exist.
    When in the client this should silently fail if the file doesn’t exist.

    installOption(optionName)
    Installs an option group into the game. All files in the group are installed. Any file in this group will override any previous scheduled installs of the same file.

    Parameters
    optionName:
    a string of the name of the option to install

    Return Values
    None

    Notes
    When in the packager this should error if the option doesn’t exist.
    When in the client this should silently fail if the option doesn’t exist.

    Options Table Format:

    Example

    local choiceTable = {
    	key1 = {
    		title = "Option text to display",
    		order = 1,
    		default = true,
    	},
    	key2 = {
    		title = "Option text to display",
    		order = 2,
    	},
    }
    

    Description
    A choiceTable is a list of options stored in a lua table. This table may be keyed numericaly or via strings. String based keys are highly recommended for script clarity.

    Each option is itself a table. The following keys are valid on all options.

    title
    A string that is used to display the choice to the user.
    order
    A numeric index that controls the order that the choice will be displayed inside the install wizard. Ordering is relative within a given choiceTable.
    default
    A boolean value that indeicateds whether or not an option is selected by default. This can be applied to multiple values but choice() will only respect one of them, whereas the upcoming multichoice() api will respect all of them.

    Example Lua Script:

    local colorChoices = {
    	Blue = {
    		title = "Install blue textures for all weapons",
    		order = 1,
    	},
    	Dark = {
    		title = "Install dark textures for all weapons",
    		order = 2,
    	},
    	Golden = {
    		title = "Install golden textures for all weapons",
    		order = 3,
    	},
    	Light = {
    		title = "Install light textures for all weapons",
    		order = 4,
    	},
    	Red = {
    		title = "Install red textures for all weapons",
    		order = 5,
    	},
    	Silver = {
    		title = "Install silver textures for all weapons",
    		order = 6,
    	},
    	advanced = {
    		title = "Choose a different color for each weapon",
    		order = 7,
    	},
    }
    
    local colorChoice = choice("Which color addons to you prefer?", colorChoices)
    
    if colorChoice ~= "advanced" then
    	installOption("bow"..colorChoice)
    	installOption("warhammer"..colorChoice)
    	return
    end
    
    local warhammerChoices = {
    	warhammerBlue = {
    		title = "Install blue textures for warhammers",
    		order = 1,
    	},
    	warhammerDark = {
    		title = "Install dark textures for warhammers",
    		order = 2,
    	},
    	warhammerGolden = {
    		title = "Install golden textures for warhammers",
    		order = 3,
    	},
    	warhammerLight = {
    		title = "Install light textures for warhammers",
    		order = 4,
    	},
    	warhammerRed = {
    		title = "Install red textures for warhammers",
    		order = 5,
    	},
    	warhammerSilver = {
    		title = "Install silver textures for warhammers",
    		order = 6,
    	},
    	none = {
    		title = "Use the default texture for warhammers",
    		order = 7,
    	},
    }
    
    local warhammerChoice = choice("Which color do you prefer for Warhammers?", warhammerChoices)
    
    if warhammerChoice ~= "none" then
    	installOption(warhammerChoice)
    end
    

    Hope this helps you all in placing your mods in the Client!

    Last edited Mar 11, 2012 by Torhal: Formatting fixes.
    #2 Feb 17, 2012 at 21:59 UTC - 0 likes

    Hey, that bottom example is the example for my Elven Weapon Retex, right? xD
    This'll be useful, good job on getting this up.

    http://i252.photobucket.com/albums/hh37/dark-oblivion/AreYouFeelingLuckySHRUNK.png

    #3 Feb 18, 2012 at 00:30 UTC - 0 likes

    @TrueChaos137:

    Mayyyyyyyyyyyyybe ;D

  • 3 posts

You must login to post a comment. Don't have an account? Register to get one!