From GamingWiki
(Created page with "Draw a section in a character sheet for skills {| class="infobox" <onlyinclude><!-- Define the types of skills available. These each have their own class, too. -->{{#vardefin...") |
|||
| Line 1: | Line 1: | ||
| − | Draw a section in a character sheet for skills | + | Draw a section in a character sheet for skills. This template is unforgiving: |
| + | all of its parameters are required (but may be empty). | ||
{| class="infobox" | {| class="infobox" | ||
| Line 5: | Line 6: | ||
Define the types of skills available. These each have their own class, too. | Define the types of skills available. These each have their own class, too. | ||
| − | -->{{#vardefine: skillClass | {{{skillclass | + | -->{{#vardefine: skillClass | {{{skillclass}}} }}<!-- |
| − | -->{{#arraydefine: skilltypearray | {{{skilltypes | + | -->{{#arraydefine: skilltypearray | {{{skilltypes}}} | /\s+/ }}<!-- |
-->{{#arraytohash: classhash | skilltypearray | skilltypearray }}<!-- | -->{{#arraytohash: classhash | skilltypearray | skilltypearray }}<!-- | ||
We may have custom skill ranks. | We may have custom skill ranks. | ||
| − | -->{{#arraydefine: skilllevelarray | | + | -->{{#arraydefine: skilllevelarray | {{{skillranks}}} | :: }}<!-- |
| − | |||
-->{{#arraymerge: skilllevelsreverse | skilllevelarray }}<!-- | -->{{#arraymerge: skilllevelsreverse | skilllevelarray }}<!-- | ||
-->{{#arraysort: skilllevelsreverse | reverse }}<!-- | -->{{#arraysort: skilllevelsreverse | reverse }}<!-- | ||
| Line 17: | Line 17: | ||
There are various skill markers that may be defined -- these go into a hash. | There are various skill markers that may be defined -- these go into a hash. | ||
| − | -->{{#hashdefine: skillmarkerhash | {{{skillmarkers | + | -->{{#hashdefine: skillmarkerhash | {{{skillmarkers}}} | :: | /\/\// }}<!-- |
Use a hash to store and then print the skills | Use a hash to store and then print the skills | ||
| Line 23: | Line 23: | ||
We either have a long section of skills, or one entry per level. | We either have a long section of skills, or one entry per level. | ||
| − | -->{{# | + | -->{{#ifeq: {{{skills|M_NUL}}}|M_NUL|<!-- |
| − | + | No single skills section. We look for multiple sections: 'skills1', 'skills2', etc. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
There are several parameters: skills1, skill2, and so on. Each corresponds | There are several parameters: skills1, skill2, and so on. Each corresponds | ||
to a single skill rank, and each is of the form: | to a single skill rank, and each is of the form: | ||
| Line 44: | Line 32: | ||
-->{{#forargs: skills | thelevel | theskilllist | <!-- | -->{{#forargs: skills | thelevel | theskilllist | <!-- | ||
| + | -->{{#ifeq: {{#var:theskilllist}} | M_NUL ||<!-- | ||
-->{{#rmatch: {{#var:thelevel}} | /^\d+$/ | <!-- | -->{{#rmatch: {{#var:thelevel}} | /^\d+$/ | <!-- | ||
-->{{#hashinclude: skillhash | <!-- | -->{{#hashinclude: skillhash | <!-- | ||
-->{{#arrayindex: skilllevelarray | {{#expr:{{#var: thelevel}}-1}} }}={{#var:theskilllist}}<!-- | -->{{#arrayindex: skilllevelarray | {{#expr:{{#var: thelevel}}-1}} }}={{#var:theskilllist}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
| + | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
| + | -->|<!-- | ||
| + | One 'skills' section. | ||
| + | Lines are listed in descending order of skill. Each line is of the form: | ||
| + | ;; SkillName//OpType//OpModifier :: SkillName//OpType//OpModifier ... | ||
| + | where SkillName is just what it says, OpType is an optional type to the | ||
| + | skill (such as 'combat' or 'track' and OpModifier is an optional modifier | ||
| + | such as 'MG'. | ||
| + | Note: we assume that no skill lines are missing. | ||
| + | |||
| + | -->{{#arraydefine: skillsbylevel | {{{skills}}} | ;; }}<!-- | ||
| + | -->{{#arrayslice: skillsbylevel | skillsbylevel | 0 }}<!-- | ||
| + | -->{{#arraytohash: skillhash | skillsbylevel | skilllevelsreverse }}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
Revision as of 20:26, 28 February 2011
Draw a section in a character sheet for skills. This template is unforgiving: all of its parameters are required (but may be empty).
| Skills | types: Template:(({skilltypesTemplate:))} | ||||