From GamingWiki
Line 1: | Line 1: | ||
{{Documentation}}<!-- | {{Documentation}}<!-- | ||
+ | |||
+ | -->{{#if: {{#vardefineecho: debug | }} | debug mode enabled <br />}}<!-- | ||
-->{{#vardefine: cols | {{{columns|6}}} }}<!-- | -->{{#vardefine: cols | {{{columns|6}}} }}<!-- | ||
− | --> | + | --> |
− | |||
− | |||
<onlyinclude><!-- | <onlyinclude><!-- | ||
Line 34: | Line 34: | ||
-->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | -->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | ||
-->{{#vardefine:modeAverage|{{{mode average|Action}}}}}<!-- | -->{{#vardefine:modeAverage|{{{mode average|Action}}}}}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} | | ||
+ | '''debug''' Setting modes to: | ||
+ | * good = {{#vardefineecho:modeGood|Banter}} | ||
+ | * fair = {{#vardefineecho:modeFair|Space}} | ||
+ | * average = {{#vardefineecho:modeAverage|Action}} | ||
+ | }}<!-- | ||
Some initial arrays and hashes: | Some initial arrays and hashes: | ||
Line 52: | Line 59: | ||
-->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | -->{{#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. | Query all skills found belonging to our three modes. | ||
-->{{#hashdefine:skillModeHash | | -->{{#hashdefine:skillModeHash | | ||
{{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | {{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | ||
− | |? | + | |?Mode name |
|?Includes skill | |?Includes skill | ||
|format=array | |format=array | ||
Line 64: | Line 78: | ||
| <PROP> | | <PROP> | ||
}}<!-- | }}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' query result (skillModeHash): {{#hashprint: skillModeHash | | <modename> | <modeskills> | <modename>=<modeskills><br/>}} | ||
+ | }}<!-- | ||
+ | |||
+ | Now that we have all the skill mode details, we put them into a hashTable | ||
+ | that maps each skill to the modes it is found in: | ||
-->{{#hashdefine: skillHash}}<!-- | -->{{#hashdefine: skillHash}}<!-- | ||
Line 73: | Line 95: | ||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
− | |||
− | -->{{#if: {{#var: debug}} |< | + | -->{{#if: {{#var: debug}} |<nowiki /> |
− | + | ||
− | + | '''debug''' skillHash: {{#hashprint: skillHash | | <skillname> | <skillmodes> | <skillname>=<skillmodes><br/>}} | |
− | + | }}<!-- | |
− | + | ||
+ | -->{{#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 | Now iterate over all the skills returned from our query | ||
+ | |||
-->{{#hashprint: skillHash | | <skillname> | <skillmodes> | <!-- | -->{{#hashprint: skillHash | | <skillname> | <skillmodes> | <!-- | ||
Line 88: | Line 116: | ||
-->{{#vardefine: currentSkillName | <skillname> }}<!-- | -->{{#vardefine: currentSkillName | <skillname> }}<!-- | ||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' currentSkillName: {{#var: currentSkillName }} | ||
+ | }}<!-- | ||
First we create an array containing all the modes the current skill | 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 | belongs to. Then we use that array as a filter so we end up with the | ||
Line 95: | Line 127: | ||
-->{{#arraydefine: currentSkillAllModes | <skillmodes> | <MANY> }}<!-- | -->{{#arraydefine: currentSkillAllModes | <skillmodes> | <MANY> }}<!-- | ||
-->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | -->{{#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 | Now the number of entries in currentSkillModes is the number of the | ||
Line 107: | Line 144: | ||
going to append the current skill to it and then put it back in modeHash. | going to append the current skill to it and then put it back in modeHash. | ||
-->{{#hashdefine: levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- | -->{{#hashdefine: levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- | ||
− | -->{{#if: {{#var: debug}} |< | + | |
− | + | -->{{#if: {{#var: debug}} |<nowiki /> | |
− | + | '''debug''' currentSkillPrimaryMode: {{#var: currentSkillPrimaryMode }} | |
+ | '''debug''' levelsOfPrimaryMode: {{#hashprint: levelsOfPrimaryMode | <br/> | <level> | <skills> | <level> = <skills> }} | ||
+ | }}<!-- | ||
+ | |||
Array of the skills defined for the primary mode, at this level. Here we | 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 | append the current skill along with a separator. The first time we do | ||
Line 132: | Line 172: | ||
Once the above loop is done modeHash should have the desired structure. | Once the above loop is done modeHash should have the desired structure. | ||
− | -->{{#if: {{#var: debug}} |< | + | -->{{#if: {{#var: debug}} |<nowiki /> |
− | + | modeHash: {{#hashprint: modeHash | | <modename> | <levels> | <br/> <modename> = <levels> }} | |
− | + | }}<!-- | |
Line 140: | Line 180: | ||
− | Process all three modes: | + | Process and print all three modes: |
Each element of modeLoopArray is composed of a rank name, the prefix of the | Each element of modeLoopArray is composed of a rank name, the prefix of the | ||
Line 181: | Line 221: | ||
-->{{#hashinclude: sectionParams | {{#var: fieldName}} = | {{#var: fieldClass}} = shaded }}<!-- | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = | {{#var: fieldClass}} = shaded }}<!-- | ||
-->{{#if: {{#var: currentLevel}} |<!-- | -->{{#if: {{#var: currentLevel}} |<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | currentLevel: {{#var: currentLevel }} | ||
+ | }}<!-- | ||
+ | |||
Here the current loop index corresponds to a level. We set the | Here the current loop index corresponds to a level. We set the | ||
appropriate CSS class and look for skills at this level. | appropriate CSS class and look for skills at this level. | ||
+ | |||
-->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!-- | -->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!-- | ||
− | Now look for skills and print them, if | + | |
+ | Now look for skills and print them, if any | ||
+ | |||
-->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!-- | -->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!-- | ||
− | -->{{#if: {{# | + | -->{{#if: {{#arrayprint: levelSkills}} | <!-- |
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' levelSkills: {{#arrayprint: levelSkills}} | ||
+ | }}<!-- | ||
+ | |||
+ | If a skill belongs to more than one mode, we note it with an <abbr> tag: | ||
+ | |||
+ | -->{{#arraydefine: levelSkillsPrintable | <!-- | ||
+ | -->{{#arrayprint: levelSkills | , | <skillname> | <!-- | ||
+ | -->{{#arraydefine: currentSkillAllModes | {{#hashvalue: skillHash | <skillname> }} | <MANY> }}<!-- | ||
+ | -->{{#ifeq: {{#arraysize: currentSkillAllModes}} | 1 <!-- | ||
+ | -->| <skillname> <!-- | ||
+ | -->| <abbr title="{{#arrayprint:currentSkillAllModes}}"><skillname></abbr> <!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' levelSkillsPrintable: {{#arrayprint: levelSkillsPrintable}} | ||
+ | }}<!-- | ||
+ | |||
There are skills at this level. Save them to the param hash. | There are skills at this level. Save them to the param hash. | ||
− | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{# | + | |
+ | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{#arrayprint: levelSkillsPrintable}} }}<!-- | ||
+ | |||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
Line 197: | Line 269: | ||
-->}}<!-- end arrayprint | -->}}<!-- end arrayprint | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' sectionParams: {{#hashprint: sectionParams | | <key> | <value> | <br/> <key> = <value> }} | ||
+ | }}<!-- | ||
+ | |||
+ | --></onlyinclude><nowiki /> | ||
+ | {| class="infobox" | ||
+ | <onlyinclude><!-- | ||
+ | |||
+ | Now print the table section | ||
-->{{#hashtotemplate: Character sheet/section | sectionParams }}<!-- | -->{{#hashtotemplate: Character sheet/section | sectionParams }}<!-- | ||
Line 212: | Line 295: | ||
}}<!-- end section | }}<!-- end section | ||
-->}}<!-- end if | -->}}<!-- end if | ||
+ | |||
+ | --></onlyinclude><nowiki /> | ||
+ | |} | ||
+ | <onlyinclude><!-- | ||
--></onlyinclude> | --></onlyinclude> | ||
− |
Revision as of 20:54, 27 July 2014
[create]
Error creating thumbnail: File missing
Template documentation Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |
Skill modes | |||||
Banter | Space | Action | |||
Superb (+5) | |||||
Great (+4) | |||||
Good (+3) | |||||
Fair (+2) | |||||
Average (+1) | |||||
Points used | 0 | remaining | 7 | total | 7 |