From GamingWiki
Jump to: navigation, search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Documentation}}
+
{{Documentation}}<!--
  
{| class="infobox"
+
-->{{#if: {{#vardefineecho: debug | }} | debug mode enabled <br />}}<!--
<onlyinclude><!--
 
  
 
-->{{#vardefine: cols | {{{columns|6}}} }}<!--
 
-->{{#vardefine: cols | {{{columns|6}}} }}<!--
  
   debug: hard-code it for now.
+
-->
 +
<onlyinclude><!--
 +
 
 +
   debug: hard-code some of it for now.
  
-->{{Character sheet/section
+
  @todo: implement skill point expenditure
| columns  = {{#var:cols}}
 
| header  = {{{label|Skill modes}}}
 
}}<!-- end section header
 
  
 
-->{{#hashdefine: sectionParams}}<!--
 
-->{{#hashdefine: sectionParams}}<!--
Line 18: Line 17:
 
-->{{#hashinclude: sectionParams
 
-->{{#hashinclude: sectionParams
 
| columns  = {{#var:cols}}
 
| columns  = {{#var:cols}}
 +
| subhead  = {{{label|Skill modes}}}
 
| labelclass1 = label  
 
| labelclass1 = label  
 
| llabel1 = &nbsp;
 
| llabel1 = &nbsp;
Line 25: Line 25:
 
| llabel5 = Fair (+2)
 
| llabel5 = Fair (+2)
 
| llabel6 = Average (+1)
 
| llabel6 = Average (+1)
| ldata1  = &nbsp;
 
| ldata2  = &nbsp;
 
| ldata3  = &nbsp;
 
| ldata4  = &nbsp;
 
| ldata5  = &nbsp;
 
| ldata6  = &nbsp;
 
| ldataclass2 = specialized skill
 
| ldataclass3 = focused skill
 
| ldataclass4 = trained skill
 
| ldataclass5 = shaded
 
| ldataclass6 = shaded
 
| cdata1  = &nbsp;
 
| cdata2  = &nbsp;
 
| cdata3  = &nbsp;
 
| cdata4  = &nbsp;
 
| cdata5  = &nbsp;
 
| cdata6  = &nbsp;
 
| cdataclass2 = shaded
 
| cdataclass3 = specialized skill
 
| cdataclass4 = focused skill
 
| cdataclass5 = trained skill
 
| cdataclass6 = shaded
 
| rdata1  = &nbsp;
 
| rdata2  = &nbsp;
 
| rdata3  = &nbsp;
 
| rdata4  = &nbsp;
 
| rdata5  = &nbsp;
 
| rdata6  = &nbsp;
 
| rdataclass2 = shaded
 
| rdataclass3 = shaded
 
| rdataclass4 = specialized skill
 
| rdataclass5 = focused skill
 
| rdataclass6 = trained skill
 
 
}}<!-- end section
 
}}<!-- end section
  
-->{{#arraydefine:modeArray|{{#ask: [[is a :: skill]] [[skill in mode :: Hemocrat||Space||Science]]
+
  TERMINOLOGY:
|?Name
+
  * Rank: position on the adjective ladder. May be divided into rankName and rankVal
|?Skill in mode=Mode
+
  * Level: skill level, i.e, untrained, trained, focused or specialized
| format=array  
+
 
}}}}<!--
+
-->{{#vardefine:modeGood|{{{skill mode good|Banter}}}}}<!--
 +
-->{{#vardefine:modeFair|{{{skill mode fair|Space}}}}}<!--
 +
-->{{#vardefine:modeAverage|{{{skill mode average|Action}}}}}<!--
 +
 
 +
--><includeonly><!--
 +
  -->{{#set:
 +
      | has good skill mode = {{#var:modeGood}}
 +
      | has fair skill mode = {{#var:modeFair}}
 +
      | has average skill mode = {{#var:modeAverage}}
 +
      }}<!--
 +
--></includeonly><!--
 +
 
 +
-->{{#if: {{#var: debug}} |
 +
'''debug''' Setting modes to:
 +
* good = {{#vardefineecho:modeGood|Banter}}
 +
* fair = {{#vardefineecho:modeFair|Space}}
 +
* average = {{#vardefineecho:modeAverage|Action}}
 +
}}<!--
 +
 
 +
  Some initial arrays and hashes:
 +
  * modeArray lists the three modes in ascending rank
 +
  * levelArray lists all four levels in ascending order
 +
  * levelSubArray is like levelArray, without "untrained".
 +
  * modeHash is to be populated later. The eventual structure will be:
 +
    * keys are mode names
 +
    * values are hashtables, defined as:
 +
      * keys are levels
 +
      * values are arrays of skill names
 +
 
 +
-->{{#arraydefine: modeArray | {{#var: modeAverage}}, {{#var: modeFair}}, {{#var: modeGood}} | , }}<!--
 +
-->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!--
 +
-->{{#arrayslice:  levelSubarray | levelArray | 1 }}<!--
 +
-->{{#hashdefine: modeHash}}<!--
 +
-->{{#arrayprint:  modeArray | | <mode> | <!--
 +
  -->{{#hashinclude: modeHash  | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!--
 +
-->}}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
{{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[mode name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]]
 +
        |?mode name
 +
        |?Includes skill
 +
      }}
 +
}}<!--
 +
 
 +
  Query all skills found belonging to our three modes.
 +
-->{{#hashdefine:skillModeHash |
 +
      {{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]]
 +
        |?Mode name
 +
        |?Includes skill
 +
        |format=array
 +
        |mainlabel=-
 +
      }}
 +
      | ,
 +
      | <PROP>
 +
  }}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
  
-->{{#hashdefine: modeHash | Hemocrat;, Space;, Science; }}<!--
+
  '''debug''' query result (skillModeHash): {{#hashprint: skillModeHash | | <modename> | <modeskills> | <modename>=<modeskills><br/>}}
-->{{#hashdefine: skillModeHash}}<!--
+
}}<!--
-->{{#hashdefine: skillLevelHash}}<!--
+
 
-->{{#arrayprint: modeArray | , | @@@@ | <!--
+
  Now that we have all the skill mode details, we put them into a hashTable
   -->{{#vardefine:currentSkillPage| {{#explode:@@@@|<PROP>|0}} }}<!--
+
  that maps each skill to the modes it is found in:
   -->{{#vardefine:currentSkillName| {{#explode:@@@@|<PROP>|1}} }}<!--
+
 
  -->{{#arraydefine:currentSkillModes| {{#explode:@@@@|<PROP>|2}} |<MANY>}}<!--
+
-->{{#hashdefine: skillHash}}<!--
  -->{{#arraysearch:currentSkillModes|Hemocrat|0| <!--
+
-->{{#hashprint: skillModeHash | | <modename> | <modeskills> | <!--
      -->{{#hashinclude:skillModeHash| {{#var:currentSkillName}}=Hemocrat}}<!--
+
   -->{{#arraydefine: modeSkills | <modeskills> | <MANY> | unique}}<!--
       -->{{#hashinclude:skillLevelHash| {{#var:currentSkillName}}=3}}<!--
+
   -->{{#arrayprint: modeSkills | | <skillname> | <!--
  -->|<!--
+
      -->{{#arraydefine: skillModes | {{#hashvalue: skillHash | <skillname>}} <MANY> <modename> | <MANY> | unique,sort=asc}}<!--
 +
       -->{{#hashinclude: skillHash | <skillname>={{#arrayprint: skillModes | <MANY>}} }}<!--
 
   -->}}<!--
 
   -->}}<!--
   -->{{#arraysearch:currentSkillModes|Space|0| <!--
+
-->}}<!--
      -->{{#hashkeyexists:skillModeHash|{{#var:currentSkillName}}|<!--
+
 
        -->{{#hashinclude:skillLevelHash| {{#var:currentSkillName}}={{#eval:{{#hashvalue:skillLevelHash|{{#var:currentSkillName}}}}+1}}}}<!--
+
-->{{#if: {{#var: debug}} |<nowiki />
       -->|}}<!--
+
 
      -->{{#hashinclude:skillModeHash| {{#var:currentSkillName}}=Space}}<!--
+
  '''debug''' skillHash: {{#hashprint: skillHash | | <skillname> | <skillmodes> | <skillname>=<skillmodes><br/>}}
       -->{{#hashinclude:skillLevelHash| {{#var:currentSkillName}}=2}}<!--
+
}}<!--
  -->|<!--
+
 
 +
 
 +
  Apply skill point bumps
 +
   @todo: The next step is to apply spent skill points. We'll do some error-checking here.
 +
 
 +
-->{{#vardefine:skillPointsUsed|0}}<!--
 +
-->{{#vardefine:pointBuy|point buy}}<!--
 +
 
 +
-->{{#vardefine: skillBumps | {{{skill bump|}}} }}<!--
 +
 
 +
--></onlyinclude><!--
 +
-->{{#vardefine: skillBumps | Gunnery, Gunnery, Will, Notice, Fight, Notice }}<!--
 +
--><onlyinclude><!--
 +
 
 +
-->{{#arraydefine: skillBumpArray | {{#var:skillBumps}} }}<!--
 +
-->{{#arrayprint: skillBumpArray ||<skill>|<!--
 +
      -->{{#hashinclude: skillHash | <skill> = {{#hashvalue: skillHash | <skill>}}<MANY>{{#var:pointBuy}} }}<!--
 +
-->}}<!--
 +
 
 +
-->{{#arraydefine: skillArray | {{#hashprint: skillHash |,| <skillname> | <skillmodes> | <skillname><PROP><skillmodes>}} }}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
 
 +
  '''debug''' skillArray: {{#arrayprint: skillArray | <br/> }}
 +
}}<!--
 +
 
 +
  Now iterate over all the skills returned from our query
 +
 
 +
-->{{#hashprint: skillHash | | <skillname> | <skillmodes> | <!--
 +
 
 +
  -->{{#hashdefine: currentSkill}}<!--
 +
 
 +
  -->{{#vardefine: currentSkillName         | <skillname> }}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
 
 +
  '''debug''' currentSkillName: {{#var: currentSkillName }}
 +
}}<!--
 +
 
 +
      First we create an array containing all the modes the current skill
 +
      belongs to. Then we use that array as a filter so we end up with the
 +
      intersection of the skill's modes and the character's modes -- i.e, all
 +
      the character's modes that contain the current skill. This final array
 +
      is currentSkillModes.
 +
  -->{{#arraydefine: currentSkillAllModes  | <skillmodes> | <MANY> }}<!--
 +
  -->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
  '''debug''' currentSkillAllModes: {{#arrayprint: currentSkillAllModes | , }}
 +
  '''debug''' currentSkillModes: {{#arrayprint: currentSkillModes | , }}
 +
}}<!--
 +
 
 +
      Now the number of entries in currentSkillModes is the number of the
 +
      character's modes the current skill appears in. This also happens to be
 +
      the bonus the skill has as a result of skill reinforcement [FSTK 30].
 +
      And the last element of currentSkillModes should be the character's
 +
      highest-ranked mode for this skill.
 +
  -->{{#vardefine: currentSkillPrimaryMode | {{#arrayindex: currentSkillModes | -1 }} }}<!--
 +
  -->{{#vardefine: synergySkillLevel      | {{#arraysize: currentSkillModes}} }}<!--
 +
  -->{{#vardefine: totalSkillLevel        | {{#arraysize: currentSkillAllModes}} }}<!--
 +
  -->{{#ifexpr: {{#var: totalSkillLevel}} > 3 | {{#vardefine: totalSkillLevel | 3}} }}<!--
 +
  -->{{#vardefine: pointBuyBumps          | {{#expr: {{#var:totalSkillLevel}} - {{#var:synergySkillLevel}} }} }}<!--
 +
  -->{{#vardefine: pointsSpent            | {{#expr: {{#var:synergySkillLevel}} * {{#var:pointBuyBumps}} + {{#var:pointBuyBumps}} * ( {{#var:pointBuyBumps}} - 1 ) / 2 }} }}<!--
 +
  -->{{#vardefine: skillPointsUsed        | {{#expr: {{#var:skillPointsUsed}} + {{#var:pointsSpent}} }} }}<!--
 +
  -->{{#vardefine: currentSkillLevel      | {{#arrayindex: levelArray | {{#var: totalSkillLevel}} }} }}<!--
 +
 
 +
      Hash of all the levels of the primary mode, keyed by level name. We're
 +
       going to append the current skill to it and then put it back in modeHash.
 +
  -->{{#hashdefine:  levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
  '''debug''' currentSkillPrimaryMode: {{#var: currentSkillPrimaryMode }}
 +
  '''debug''' synergySkillLevel: {{#var: synergySkillLevel }}
 +
  '''debug''' totalSkillLevel: {{#var: totalSkillLevel }}
 +
  '''debug''' pointBuyBumps: {{#var: pointBuyBumps }}
 +
  '''debug''' pointsSpent: {{#var: pointsSpent }}
 +
  '''debug''' skillPointsUsed: {{#var: skillPointsUsed }}
 +
  '''debug''' currentSkillLevel: {{#var: currentSkillLevel }}
 +
  '''debug''' levelsOfPrimaryMode: {{#hashprint: levelsOfPrimaryMode | <br/> | <level> | <skills> | <level> = <skills> }}
 +
}}<!--
 +
 
 +
      Array of the skills defined for the primary mode, at this level. Here we
 +
      append the current skill along with a separator. The first time we do
 +
      this for any given mode-level combination we'll get an empty element, so
 +
      we ensure that the elements are unique. We also sort them because
 +
      sorting is nice :)
 +
  -->{{#arraydefine: modeSkillsAtLevel <!--
 +
       -->| {{#hashvalue: levelsOfPrimaryMode | {{#var: currentSkillLevel }} }} <LEVELSKILL> {{#var: currentSkillName}} <!--
 +
      -->| <LEVELSKILL> | unique,sort=asc <!--
 
   -->}}<!--
 
   -->}}<!--
  -->{{#arraysearch:currentSkillModes|Science|0| <!--
+
       Now we reassemble the original hash:
       -->{{#hashkeyexists:skillModeHash|{{#var:currentSkillName}}|<!--
+
  -->{{#hashinclude: levelsOfPrimaryMode | {{#var: currentSkillLevel }} = {{#arrayprint: modeSkillsAtLevel | <LEVELSKILL> }} }}<!--
        -->{{#hashinclude:skillLevelHash| {{#var:currentSkillName}}={{#eval:{{#hashvalue:skillLevelHash|{{#var:currentSkillName}}}}+1}}}}<!--
+
  -->{{#hashinclude: modeHash            | <!--
      -->|}}<!--
+
       -->   {{#var: currentSkillPrimaryMode}} = {{#hashprint: levelsOfPrimaryMode | <LEVELSEP> | <K> | <V> | <K><LEVELVAL><V> }} <!--
       -->{{#hashinclude:skillModeHash| {{#var:currentSkillName}}=Science}}<!--
 
      -->{{#hashinclude:skillLevelHash| {{#var:currentSkillName}}=1}}<!--
 
  -->|<!--
 
 
   -->}}<!--
 
   -->}}<!--
 +
 +
  -->{{#arrayreset: modeSkillsAtLevel | currentSkillAllModes | currentSkillModes }}<!--
 +
  -->{{#hashreset: currentSkill | levelsOfPrimaryMode }}<!--
 +
 
-->}}<!--
 
-->}}<!--
  
-->{{#hashinclude: sectionParams
+
  Once the above loop is done modeHash should have the desired structure.
| ldata1  = Hemocrat
 
| ldata2  = &nbsp;
 
| ldata3  = &nbsp;
 
| ldata4  = Culture/Tech<br/>Resources<br/>Contacts<br/>...
 
| ldata5  = &nbsp; <!-- {{#hashprint:skillModeHash}} -->
 
| ldata6  = &nbsp; <!-- {{#hashprint:skillLevelHash}} -->
 
| cdata1  = Space
 
| cdata2  = &nbsp;
 
| cdata3  = &nbsp;
 
| cdata4  = &nbsp;
 
| cdata5  = Engineering<br/>EVA<br/>Gunnery<br/>Pilot<br/>Systems
 
| cdata6  = &nbsp;
 
| rdata1  = Science
 
| rdata2  = &nbsp;
 
| rdata3  = &nbsp;
 
| rdata4  = &nbsp;
 
| rdata5  = &nbsp;
 
| rdata6  = ''all sciences''
 
}}<!-- end section
 
  
-->{{#hashtotemplate:   Character sheet/section | sectionParams }}<!--
+
-->{{#if: {{#var: debug}} |<nowiki />
  
  Print the section footer, if required
+
  modeHash: {{#hashprint: modeHash | | <modename> | <levels> | <br/> <modename> = <levels> }}
 +
}}<!--
  
-->{{#vardefine:skillsused|0}}<!--
 
-->{{#vardefine:skillsallowed|7}}<!--
 
-->{{Character sheet/section
 
| columns  = {{#var:cols}}
 
| llabel1  = Points used  | ldata1    = {{#var:skillsused}}
 
| label1    = remaining    | data1    = {{#expr: {{#var:skillsallowed}} - {{#var:skillsused}} }}
 
| rlabel1  = total        | rdata1    = {{#var:skillsallowed}}
 
}}<!-- end section
 
-->}}<!-- end if
 
  
  end debug
 
  
-->{{#vardefine: defaultskillclass | skill }}<!--
+
  Process and print all three modes:
-->{{#vardefine: defaultskillranks | Average (+1) :: Decent (+2) :: Good (+3) :: Great (+4) :: Superb (+5) }}<!--
 
-->{{#vardefine: defaultskilltypes | }}<!--
 
-->{{#vardefine: defaultskillmarks | }}<!--
 
  
  Parse a list of skills and their attributes
+
  Each element of modeLoopArray is composed of a rank name, the prefix of the
-->{{#if: {{{skilllist|}}} |<!--
+
  fields each mode should use, and the index of the field that should contain the
   -->{{#hashdefine: skilllisthash }}<!--
+
  "trained" level skills.
   -->{{#arraydefine: skillgroupsarray | {{{skilllist}}} | ;; }}<!--
+
-->{{#arraydefine: modeLoopArray | Good;ldata;4, Fair;cdata;5, Average;rdata;6}}<!--
   -->{{#arrayprint: skillgroupsarray | | $skilllistline$ | <!--
+
-->{{#arrayprint:  modeLoopArray | | <currentModeArray> |<!--
      -->{{#arraydefine: skillgrouparray | $skilllistline$ | :: }}<!--
+
 
       -->{{#vardefine:   skillgroupname | {{#arrayindex: skillgrouparray | 0}} }}<!--
+
   -->{{#vardefine: currentModeRank    | {{#explode: <currentModeArray> | ; | 0 }} }}<!--
       -->{{#arrayslice: skillgrouparray | skillgrouparray | 1 }}<!--
+
   -->{{#vardefine: currentFieldPrefix  | {{#explode: <currentModeArray> | ; | 1 }} }}<!--
       -->{{#arrayprint: skillgrouparray | | $skillstring$ | <!--
+
   -->{{#vardefine: currentTrainedIndex | {{#explode: <currentModeArray> | ; | 2 }} }}<!--
        -->{{#vardefine: skillname | {{#explode: $skillstring$ | // | 0 }} }}<!--
+
  -->{{#vardefine: currentModeName    | {{#var: mode{{#var:currentModeRank}}  }} }}<!--
        -->{{#vardefine: skillattr | {{#explode: $skillstring$ | // | 1 }} }}<!--
+
 
         -->{{#hashinclude: skilllisthash | {{$var:skillname}} = 0 }}<!--
+
       Head each column with a mode name
         -->{{#hashinclude: skillhash-{{#var:skillname}}  
+
  -->{{#hashinclude: sectionParams | {{#var: currentFieldPrefix}}1 = {{#var:currentModeName}} }}<!--
            | group = {{#var:skillgroupname}}  
+
 
             | attributes = {{#var:skillgroupattr}}  
+
       Create a hash, currentModeHash, to contain all the information we need about
             }}<!--
+
      the current mode's skills.
 +
  -->{{#hashdefine: currentModeHash | {{#hashValue: modeHash | {{#var: currentModeName}} }} | <LEVELSEP> | <LEVELVAL> }}<!--
 +
 
 +
       Iterate over the indices of our parameter fields to populate our param
 +
      hash with skill names.
 +
  -->{{#loop: fieldIndex | 6 | -5 | <!--
 +
      -->{{#vardefine: fieldName  | {{#var: currentFieldPrefix}}{{#var: fieldIndex}} }}<!--
 +
      -->{{#vardefine: fieldClass | {{#var: currentFieldPrefix}}class{{#var: fieldIndex}} }}<!--
 +
 
 +
         Map the elements of our list of levels onto the indices of our fields.
 +
        This means that for the Good mode, trained skills will go in field 4,
 +
        focused in field 3 and specialized in field 2.
 +
      -->{{#vardefine: currentLevelIndex | {{#expr: {{#var: currentTrainedIndex}} - {{#var: fieldIndex}} }} }}<!--
 +
      -->{{#vardefine: currentLevel | <!--
 +
         -->{{#ifexpr: ( {{#var: currentLevelIndex}} >= 0 ) and ( {{#var: currentLevelIndex}} < {{#arraysize: levelSubarray}}) <!--
 +
             -->| {{#arrayindex: levelSubarray | {{#var: currentLevelIndex}} }}<!--
 +
             -->| <!--
 +
        -->}}<!--
 
       -->}}<!--
 
       -->}}<!--
   -->}}<!--
+
    
-->}}<!--
+
        By default, give all fields a non-breaking space for content and the
 +
        "shaded" class:
 +
      -->{{#hashinclude: sectionParams | {{#var: fieldName}} = &nbsp; | {{#var: fieldClass}} = shaded }}<!--
 +
      -->{{#if: {{#var: currentLevel}} |<!--
 +
 
 +
-->{{#if: {{#var: debug}} |<nowiki />
 +
 
 +
  currentModeName: {{#var: currentModeName}}
 +
  currentLevel: {{#var: currentLevel }}
 +
}}<!--
 +
 
 +
            Here the current loop index corresponds to a level. We set the
 +
            appropriate CSS class and look for skills at this level.
 +
 
 +
        -->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!--
 +
 
 +
            Now look for skills and print them, if any
 +
 
 +
        -->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!--
 +
        -->{{#if: {{#arrayprint: levelSkills}} | <!--
  
  Define the types of skills available. These each have their own class, too.
+
-->{{#if: {{#var: debug}} |<nowiki />
-->{{#vardefine:   skillClass    | {{{skillclass  |{{#var:defaultskillclass}} }}} }}<!--
+
  '''debug''' levelSkills: {{#arrayprint: levelSkills}}
-->{{#arraydefine: skilltypearray | {{{skilltypes  |{{#var:defaultskilltypes}} }}} | /\s+/ }}<!--
+
}}<!--
-->{{#arraytohash: classhash      | skilltypearray | skilltypearray }}<!--
 
  
  We may have custom skill ranks.
+
              If a skill belongs to more than one mode, we note it with an <abbr> tag:
-->{{#arraydefine: skilllevelarray | {{{skillranks  |{{#var:defaultskillranks}} }}} | :: }}<!--
 
-->{{#arraymerge: skilllevelsreverse | skilllevelarray }}<!--
 
-->{{#arraysort:  skilllevelsreverse | reverse }}<!--
 
-->{{#vardefine:  numSkLvl    | {{#arraysize: skilllevelarray}} }}<!--
 
  
  There are various skill markers that may be defined -- these go into a hash.
+
            -->{{#arraydefine: levelSkillsPrintable | <!--
-->{{#hashdefine: skillmarkerhash | {{{skillmarkers|{{#var:defaultskillmarks}} }}} | :: | /\/\// }}<!--
+
              -->{{#arrayprint: levelSkills | , | <skillname> | <!--
 +
                  -->{{#arraydefine: currentSkillAllModes | {{#hashvalue: skillHash | <skillname> }} | <MANY> | unique }}<!--
 +
                  -->{{#ifeq: {{#arraysize: currentSkillAllModes}} | 1 <!--
 +
                    -->| <skillname> <!--
 +
                    -->| <abbr title="{{#arrayprint:currentSkillAllModes}}"><skillname></abbr> <!--
 +
                  -->}}<!--
 +
                  --><includeonly><!--
 +
                    -->{{#set: has {{#var: currentLevel }} skill = <skillname> }}<!--
 +
                  --></includeonly><!--
 +
              -->}}<!--
 +
            -->}}<!--
  
  Use a hash to store and then print the skills
+
-->{{#if: {{#var: debug}} |<nowiki />
-->{{#hashdefine: skillhash}}<!--
+
   '''debug''' levelSkillsPrintable: {{#arrayprint: levelSkillsPrintable}}
   Keep track of how many skill slots have been used
+
}}<!--
-->{{#vardefine: skillsused | 0}}<!--
 
  
  We either have a long section of skills, or one entry per level.
+
              There are skills at this level. Save them to the param hash.
-->{{#if: {{{skills|}}}|<!--
 
  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}}}  | ;; }}<!--
+
            -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{#arrayprint: levelSkillsPrintable}} }}<!--
  -->{{#arrayslice: skillsbylevel | skillsbylevel | 0 }}<!--
 
  -->{{#arraytohash: skillhash    | skillsbylevel | skilllevelsreverse }}<!--
 
  -->{{#arrayreset:  skillsbylevel}}<!--
 
-->|<!--
 
  No single skills section. We look for multiple sections: 'skills1', 'skills2', etc.
 
  There are several parameters: skills1, skill2, and so on. Each corresponds
 
  to a single skill rank, and each is of the form:
 
  | skillN = SkillName//OpType//OpModifier :: SkillName//OpType//OpModifier ...
 
  as in the previous form. We no longer assume that all skill lines are
 
  present; gaps may be left if desired.
 
  
  -->{{#forargs: skills | thelevel | theskilllist | <!--
 
      -->{{#ifeq: {{#var:theskilllist}} | M_NUL ||<!--
 
        -->{{#rmatch: {{#var:thelevel}} | /^\d+$/ | <!--
 
            -->{{#hashinclude: skillhash | {{#var: thelevel}}={{#var:theskilllist}} }}<!--
 
 
         -->}}<!--
 
         -->}}<!--
 
       -->}}<!--
 
       -->}}<!--
   -->}}<!--
+
   -->}}<!-- end loop
-->}}<!-- end if
+
 
 +
      End mode processing.
 +
 
 +
-->}}<!-- end arrayprint
 +
 
  
  Get the keys of our skill hash:
+
-->{{#if: {{#var: debug}} |<nowiki />
-->{{#hashtoarray:|skillhash|skillhashkeys}}<!--
 
-->{{#arraysort:skillhashkeys|desc}}<!--
 
-->{{#arraydefine: skillpartkeys | name, marker}}<!--
 
  
   Print the section header
+
   '''debug''' sectionParams: {{#hashprint: sectionParams | | <key> | <value> | <br/> <key> = <value> }}
-->
+
}}<!--
{{Character sheet/section
 
| columns  = {{#var:cols}}
 
| subhead  = {{{label|Skills}}}
 
| righthead = {{#if:{{{skilltypes|}}}|<!--
 
  -->skill types: {{#hashprint: classhash | , | %%%% | @@@@ | <span class="{{#var:skillClass}} @@@@"> %%%%</span> }}<!--
 
  -->}}
 
}}<!-- end section
 
  
  Print the skill listings
+
--></onlyinclude><nowiki />
-->{{#hashprint: skillhash || $skillrank$ | $skline$ | <!--
+
{| class="infobox"
  -->{{#arraydefine: skilllineary | $skline$ | :: }}<!--
+
<onlyinclude><!--
  -->{{#if: $skline$ |<!--
+
 
      -->{{Character sheet/section<!--
+
  Now print the table section
      -->| labelclass1 = label <!--
 
      -->| dataclass1  = {{#var: skillClass }} <!--
 
      -->| label1 = {{#arrayindex: skilllevelarray | {{#expr: $skillrank$ -1}} }}<!--
 
      -->| data1  = <!--
 
        -->{{#arrayprint: skilllineary | ,&nbsp; | $theskill$ | <!--
 
            -->{{#arraydefine: theskillarray | $theskill$ | /\/\// }}<!--
 
            -->{{#arraytohash: theskillhash | theskillarray | skillpartkeys }}<!--
 
            -->{{#vardefine: theskillname | {{#hashvalue: theskillhash | name}} }}<!--
 
            -->{{#vardefine: theskilltag  | {{lc:{{#replace:{{#var: theskillname}}||-}}}}}}<!--
 
  
            --><span class="{{#var:skillClass}} skill-{{#var:theskilltag}}"><!--
+
-->{{#hashtotemplate:   Character sheet/section | sectionParams }}<!--
            -->{{#var: theskillname }}<!--
 
            --></span> <!--
 
            -->{{#hashvalue: skillmarkerhash | {{#hashvalue: theskillhash | marker}} }}<!--
 
              Add SMW properties
 
            -->{{#if:{{#var:theskillname}}|<!--
 
              -->{{#set:
 
                  | skill/{{lc:{{#var:theskillname}}}}=$skillrank$
 
                  | has skill at rank $skillrank$={{#var:theskillname}}
 
                  }}<!--
 
            -->}}<!--
 
  
              Increment skill slot counter
 
            -->{{#vardefine: skillsused | {{#expr: {{#var:skillsused|0}} + $skillrank$}} }}<!--
 
  
            -->{{#arrayreset: theskillarray}}<!--
+
  Print the section footer. This contains a summary of advancement points available and spent.
            -->{{#hashreset: theskillhash}}<!--
 
        -->}}<!-- end arrayprint
 
      -->}}<!-- end section
 
  -->}}<!-- end if skline
 
  -->{{#arrayreset: skilllinearray}}<!--
 
--><!--|skilllevelsreverse}}--><!-- end hashprint
 
-->|skillhashkeys}}<!-- end hashprint
 
  
  Print the section footer, if required
+
-->{{#vardefine:skillsAllowed|7}}<!--
-->{{#if: {{#vardefineecho:skillsallowed|{{{defaultskillpoints|}}}}}|
+
-->{{Character sheet/section  
{{Character sheet/section  
 
 
| columns  = {{#var:cols}}
 
| columns  = {{#var:cols}}
| llabel1  = Points used  | ldata1    = {{#var:skillsused}}
+
| llabel1  = bonus points  | ldata1    = {{#var:skillsAllowed}}
| label1    = remaining    | data1    = {{#expr: {{#var:skillsallowed}} - {{#var:skillsused}} }}
+
| label1    = used          | data1    = {{#var:skillPointsUsed}}
| rlabel1  = total        | rdata1    = {{#var:skillsallowed}}
+
| rlabel1  = remaining    | rdata1    = {{#expr: {{#var:skillsAllowed}} - {{#var:skillPointsUsed}} }}
 
}}<!-- end section  
 
}}<!-- end section  
 
-->}}<!-- end if
 
-->}}<!-- end if
  
-->{{#hashreset: skillhash | skillmarkerhash | classhash }}<!--
+
--></onlyinclude><nowiki />
-->{{#arrayreset: skilltypearray, skilllevelarray, skilllevelsreverse, skillhashkeys, skillpartkeys }}<!--
+
|}
 +
<onlyinclude><!--
 +
 
  
 
--></onlyinclude>
 
--></onlyinclude>
|}
 

Latest revision as of 02:36, 29 July 2014

[create]
Error creating thumbnail: File missing
Template documentation

Skill modes
  Banter Space Action
Superb (+5) Gunnery, Notice    
Great (+4) Fight, Will    
Good (+3)      
Fair (+2)      
Average (+1)      
bonus points 7 used -4 remaining 11