User:Gorgon/Sandbox/Sandbox Alpha

From Avlis Wiki
Revision as of 23:06, 27 January 2017 by Gorgon (talk | contribs) (Different approach to transcluding, using the new Template:Sec and sec# section tags, plus a trick to not parse them until they are in the destination spell. Can't test the results without new edits here, so preview edits don't work.)
Jump to navigation Jump to search

Anything up to/including the Template start heading will not be included in transclusion of this template (or any part of the trailing documentation section either, though that will eventually be formalized template documentation, possibly with transcluded categories at the end).

I love to over-comment my code, so why change things here...




Test version of Template:Spell

Extensions that would make this work better [My wish list]

  • Extension:Labeled Section Transclusion - Allows selective transclusion of marked-off sections of text.
  • Extension:DynamicPageList (third-party) - Enhanced version of Extension:DynamicPageList (Wikimedia)
    • DPL:Overview - Generate dynamic reports based on category members and selective included info from each (Extension:Labeled Section Transclusion above would really help there).
    • DPL:Template:Catlist - Picture this totally reformatted as filter/sort options up top of the Spell List page, as a dynamic table. It starts showing all spells, but sortable with one click by level, school, class, or any other useful Template:Spell parameter/category used by them. Then add in the ability to filter results to only certain kinds/combinations (e.g, Show only cleric evocation spells, sorted by level, with the option of showing specific domain ones as well).
    • I doubt anyone else besides me would use this (except maybe the occasional dabbler), but it would really be useful for spells, and maybe a few other things eventually. Revamping all spells via this template is a huge undertaking (and my main goal for wiki updating, now that I can verify/test spells again), so adding this extension for that work alone would make a huge difference.
    • After looking into the more recent version of Extension:DynamicPageList (Wikimedia) (the one used by most Wikimedia projects, not the "enhanced - 3rd party one"), it may be just as useful (or better), since it allows more sort options. Need to see both in practical use before deciding anything.
  • Extension:TemplateData - See the documentation section below.


Revision notes

  • Template:Spell on the NWN Wiki has some ideas, but not quite what I had in mind either.
  • I think Buddha had the right idea with his discussion on the Categories page about reformatting how we categorize spells. The current Spell List page (and its various subversions) all rely on manual updating when any new changes happen to it, like a new spell being added. Revisions to this template will improve how each spell is displayed, and categorized (even without new extensions), so moving to category listings that update dynamically makes a lot of sense.




Can the "Name" template parameter be taken from the page name automatically?

  • Maybe as a default if not given as a parameter?
  • Might need some page renaming, but should work.
  • Keeping the template from categorizing itself as a spell might be annoying, unless namespace checking or other validation is done.




  • Redone using onlyinclude sections with transcludesection tags (See above).
    • Not as simple as Labeled Section Transclusion, and can't do some things with it, but good enough for now.
  • Major School/Subschool/Descriptors redo.
    • Added the Subschool: and Descriptors: prefixes, but they may make the School line too long.
    • Added a bunch of validation checks in switches.
  • Added Spell Name: at the top.
    • Having every spell "Name" be the page name "Magic:Name" was inaccurate and confusing.
    • Uses the Name = parameter, or Sandbox Alpha if not entered (n).
  • All parameters are now Proper Case.
  • Lowercase conversion is used for comparison validation of parameter values (when possible).
    • ifeq: and case entries in a switch are case sensitive, so this is necessary.
  • Proper Case conversion is used (when possible) in output results.
    • If people don't use the right case, this should fix at least some of the issues.
  • Added a bunch of namespace checks as part of the validation,
    • All spells should be in the Main namespace, so anything outside that is a template (or test page in a userspace).
    • Added a hak to make my sandbox spell pages work as if in Main (remember to change it back when publishing this).
  • Started making missing parameter entries (without forced defaults or warnings) not show in Main, instead of the {{{parameter name}}} (like in the Template namespace).
    • Better to add warnings (when defaults aren't possible) for all that should be included. If they see annoying red stuff, they will have to fix it.
  • Split Description Summary and Description Details parameters, so the summary can be trandcluded as a short description elsewhere.
    • Need to make the Description Details optional (and conditionalon the summary) and add a default "No description" blurb to the summary.
  • I don't like all the ifeq: {{NAMESPACE}} | Main checks I added (part of my hiding missing entries above). That can be done a better way.
  • Also need to split up all the level parameters.
  • Just getting started. Too many other things to do, so not gonna try listing them all (lots of trial and error with ideas anyway).


I'm an idiot. I'm trying to use transcludesection directly from the template, instead of passing it on to each spell. Taking a break and I'll come at it fresh later.




  • Added the test Template:Sec (Section Transclusion) by the author of Extension:Labeled Section Transclusion and redid this to be used by it, with other reformatting.
    • Only the name and description use it so far, but easier than redoing it all while testing (something always needs tweaking).
  • Need the sec# tags on the spell pages themselves, so trying some tricks for that.
    • <includeonly>&lt;onlyinclude>{{{sec1 |</includeonly> and <includeonly>}}}&lt;/onlyinclude></includeonly> should be easier than the 3 templates below (might be able to do only 1 with a parameter for sec# too). Trying to avoid more templates that I don't know are even needed, or if they will work right (deletion requests here don't get resolved).
      • If this does work as I hope, and all parameters get separate tags included this way, adding a template makes sense (shouldn't need all 3 below then).
    • Hack for including onlyinclude tags - uses safesubst and 3 simple templates.




More to come...


Template start

Spell Name: {{{Name}}}
School: {{{School}}} ( Subschool: {{{Subschool}}} ) [ Descriptors: {{{Descriptor}}}, {{{Descriptor 2}}}, {{{Descriptor 3}}} ]
Level(s): {{{Level}}}
Innate Level: {{{Innate Level}}}
Component(s): {{{Components}}}
Casting Time: {{{Casting Time}}}
Range: {{{Range}}}
Target: {{{Target}}}
Duration: {{{Duration}}}
Counter(s): {{{Counters}}}
Saving Throw: {{{Saving Throw}}}
Spell Resistance: {{{Spell Resistance}}}
Metamagic: {{{Metamagic}}}
Energy Substitution: {{{Energy Substitution}}}
{{{Description Summary}}}

{{{Description Details}}}


Non-transcluded template documentation [eventually an included doc subpage or <templatedata>]

Magic:Spell_Format should be here as documentation, instead of that hard to find page.

Add template documentation here, or include a doc subpage (see: How to create a documentation subpage).

  • A {{Documentation}} sub-template would be useful for all templates on this wiki, since they need usage documentation (stripped down version, without the dozens of other templates).
  • Extension:TemplateData would work better on its own, keeping things simple.
    • It should install a "Manage TemplateData" button for the edit gui, but I am not sure what else that needs (probably VisualEditor, which is a slow pig, so pass on that). See: TemplateData editor.
    • Below is what might be the beginning of the spell template documentation as an example (using <templatedata></templatedata> tags), if it is done manually. I have the "Name" as "required": false because I may try grabbing it from the page title, if it isn't given.

== Usage ==

<templatedata>
{
    "description": "Spells Template",
    "params": {
        "Name": {
            "label": "Spell Name",
            "description": "Name of the Spell (Uses the page title if not defined)",
            "required": false,
            "suggested": true,
            "default": {{SUBPAGENAME}},
            "type": "string",
            "example": "Name = Freedom of Movement"
        },
        "School": {
            "label": "Spell School",
            "description": "School of magic the spell belongs to. Must be one of: Abjuration, Conjuration, Divination, Enchantment, Evocation, Illusion, Necromancy, Transmutation or Universal.",
            "required": true,
            "type": "string",
            "example": "School = Abjuration"
        },
        "Subschool": {
            "label": "Spell Subschool",
            "description": "Subschool of the spell.",
            "required": false,
            "type": "string",
            "example": "Subschool = "
        },
        "Descriptors": {
            "label": "Spell Descriptors",
            "description": "Descriptors of the spell.",
            "required": false,
            "type": "string",
            "example": "Descriptors = "
        },
        "Bard Level": {
            "label": "Bard Level",
            "description": "Level of spell for Bards (if it is a Bard spell).",
            "required": false,
            "type": "number",
            "example": "Bard Level = "
        },
        "Cleric Level": {
            "label": "Cleric Level",
            "description": "Level of spell for Clerics (if it is a Cleric spell).",
            "example": "Cleric Level = 4",
            "inherits": "Bard Level"
        },
        "Druid Level": {
            "label": "Druid Level",
            "description": "Level of spell for Druids (if it is a Druid spell).",
            "example": "Druid Level = 4",
            "inherits": "Bard Level"
        },
        "Paladin Level": {
            "label": "Paladin Level",
            "description": "Level of spell for Paladins (if it is a Paladin spell).",
            "example": "Paladin Level = 4",
            "inherits": "Bard Level"
        },
        "Ranger Level": {
            "label": "Ranger Level",
            "description": "Level of spell for Rangers (if it is a Ranger spell).",
            "example": "Ranger Level = 4",
            "inherits": "Bard Level"
        },
        "Arcane Level": {
            "label": "Sorcerer/Wizard Level",
            "description": "Level of spell for Sorcerers/Wizards (if it is an Arcane spell).",
            "example": "Arcane Level = 4",
            "inherits": "Bard Level"
        },
        "Domain": {
            "label": "Domain (1) Name",
            "description": "1st Domain name of spell for Clerics (if it is a Domain spell).",
            "required": false,
            "type": "string",
            "example": "Domain = Travel"
        },
        "Domain Level": {
            "label": "Domain (1) Level",
            "description": "1st Domain Level of spell for Clerics (if it is a Domain spell).",
            "required": false,
            "type": "number",
            "example": "Domain Level = 3"
        },
        "Domain 2": {
            "label": "Domain (2) Name",
            "description": "2nd Domain name of spell for Clerics (if it is a Domain spell).",
            "example": "Domain 2 = ",
            "inherits": "Domain"
        },
        "Domain 2 Level": {
            "label": "Domain (2) Level",
            "description": "2nd Domain Level of spell for Clerics (if it is a Domain spell).",
            "example": "Domain 2 Level = ",
            "inherits": "Domain Level"
        }
    },
    "paramOrder": [
        "Name",
        "School",
        "Subschool",
        "Descriptors",
        "Bard Level",
        "Cleric Level",
        "Druid Level",
        "Paladin Level",
        "Ranger Level",
        "Arcane Level",
        "Domain",
        "Domain Level",
        "Domain 2",
        "Domain 2 Level"
    ]
}
</templatedata>

Obviously I've added more parameters for class and domain spells, similar to the NWN Wiki version of Template:Spell. Their full parameter list is below (they don't use Subschool, and I used proper case with spaces for all parameters):


Spell levels:
  • bardlevel — The level of this spell when cast by a bard. Optional
  • clericlevel — The level of this spell when cast by a cleric. Optional
  • druidlevel — The level of this spell when cast by a druid. Optional
  • paladinlevel — The level of this spell when cast by a paladin. Optional
  • rangerlevel — The level of this spell when cast by a ranger. Optional
  • magelevel — The level of this spell when cast by a sorcerer or wizard. Optional
  • domain — The clerical domain that grants access to this spell. Optional
  • domainlevel — The level of this spell when granted by this domain. Required if domain is specified
  • domain2 — A second clerical domain that grants access to this spell. Optional
  • domain2level — The level of this spell when granted by the second domain. Required if domain2 is specified
  • domain3 — A third clerical domain that grants access to this spell. Optional
  • domain3level — The level of this spell when granted by the third domain. Required if domain3 is specified
  • domain4 — A fourth clerical domain that grants access to this spell. Optional
  • domain4level — The level of this spell when granted by the fourth domain. Required if domain4 is specified
  • innatelevel — The innate level of this spell.


Lines of spells:
  • line — a name for the spell line this spell belongs to. Optional, but if not set then line0 through line9 are ignored
  • line0 through line9 — names of spells (not linked) that are considered in the same "line" of spells as the current spell. Use the parameter corresponding to the spell's innate level. Include the current spell. Optional, but some should be used if "line" is set
  • linebreach — set this (to "yes") to get a table for the breach line of spells. (This is a hack to accommodate disjunction having two spell lines.) Optional


Other:
  • area — The area affected by this spell. The values "small", "medium", "large", "huge", "gargantuan", "colossal", and "spellcone" should be used when appropriate.
    • areanote — Additional information about the area of effect (e.g. a limit on the number of targets in a colossal area). Optional
    • conesize — This can override the default length of "10" for spell cones.
  • components — "V", "S", or "VS" indicating the components this spell utilizes. Optional
  • counters — Additional counterspells, preferably linked. Optional
  • duration — The duration of the spell.
  • immunity — The descriptor (immunity type) of this spell. Optional
  • range — "p", "t", "s", "m", or "l" indicating the range of the spell.
  • save — The save allowed for this spell, preferably linked. Optional
  • school — The spell school of this spell, preferably linked.
  • spellcraft — The spellcraft requirement (for epic spells). Optional, epic only
  • spellresistance — Should be "yes" if spell resistance can bock this spell. Should be "yes*" if the BioWare description says spell resistance can block this spell, but it does not actually do so. Optional
  • desc — The spell's in-game description.
  • icon — The name of the image (icon) for this spell. Optional