Skip to content

Instantly share code, notes, and snippets.

@matortheeternal
Last active September 25, 2019 19:37
Show Gist options
  • Select an option

  • Save matortheeternal/6f9d24f37bef4a3d6040b25e9122a10c to your computer and use it in GitHub Desktop.

Select an option

Save matortheeternal/6f9d24f37bef4a3d6040b25e9122a10c to your computer and use it in GitHub Desktop.

Javascript mod installer

Requirements

  • GUI
  • User capacity to select options
  • Install files based on selected options
  • Combine ESP fragments based on selected options

Data format

Basic metadata

  1. Mod name
  2. Mod author(s)
  3. Installer version
  4. Schema version
  5. Installer Type (game)
  6. Links
{
    "jmiSchemaVersion": "1",
    "installerType": "Skyrim",
    "mod": {
        "name": "Comprehensive Bugfix Patch",
        "authors": "Mator, George",
        "aliases": "CBP",
        "version": "1.0.0"
    },
    "links": [{
        "name": "Nexus Mods Mod Page",
        "url": "https://nexusmods.com/skyrim/2345992"
    }, {
        "name": "GitHub issue tracker",
        "url": "https://github.com/matortheeternal/skyrim-cbp"
    }]
}

Dependencies

  1. Files to detect
  2. Detection location
  3. Dependency name
  4. Required
{
    "dependencies": [{
        "name": "Skyrim",
        "id": "SkyrimInstalled",
        "required": true,
        "files": ["%DataFolder%/Skyrim.esm", "%GameFolder%/TESV.exe"]
    }]
}

Screens

  1. Layout
  2. Title
  3. Media
  4. Selection type
  5. Condition
  6. Options
{
    "screens": [{
        "title": "Introduction",
        "layout": "Custom",
        "document": "introduction.html"
    }, {
        "title": "Screen 2",
        "condition": "SkyrimInstalled",
        "layout": "Basic",
        "text": "screen2.txt",
        "media": "image1.png",
        "sections": [{
            "label": "Section 1",
            "condition": "SkyrimInstalled",
            "selectionType": "One",
            "options": [{
                "label": "Option 1",
                "id": "s2o1",
                "default": true
            }, {
                "label": "Option 2",
                "id": "s2o2"
            }, {
                "label": "Option 3",
                "id": "s2o3"
            }]
        }]
    }, {
        "title": "Screen 3",
        "layout": "DetailedOptions",
        "condition": "SkyrimInstalled",
        "sections": [{
            "label": "Section 1",
            "selectionType": "Any",
            "options": [{
                "label": "Option 1",
                "id": "s3e1o1",
                "text": "Lorem ipsum dolor sit amet",
                "media": "option1.png",
                "default": "s2o2"
            }, {
                "label": "Option 2",
                "id": "s3e1o2",
                "text": "Lorem ipsum dolor sit amet",
                "media": "option2.png"
            }]
        }, {
            "label": "Section 2",
            "selectionType": "Any",
            "options": [{
                "label": "Option 1",
                "id": "s3e2o1",
                "text": "Lorem ipsum dolor sit amet",
                "media": "whatever.png"
            }, {
                "label": "Option 2",
                "id": "s3e2o2",
                "text": "Lorem ipsum dolor sit amet"
            }]
        }]
    }]
}

File rules

  1. Condition
  2. File paths or expressions
{
    "fileRules": [{
        "condition": "s2o1 || s2o2 || s2o3",
        "files": {
            "base/*": "%DataPath%"
        }
    }, {
        "condition": "s3e1o1 && s3e2o1",
        "files": {
            "s3/12/*": "%DataPath%"
        }
    }]
}

Plugins

  1. Filename
  2. Rules
{
    "plugins": [{
        "filename": "Comprehensive Bugfix Patch.esp",
        "rules": [{
            "condition": "SkyrimInstalled",
            "files": ["base.esp.json"]
        }, {
            "condition": "s3e2o2",
            "files": ["extra.esp.json"]
        }]
    }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment