From GamingWiki
Line 1: | Line 1: | ||
{{Documentation}} | {{Documentation}} | ||
+ | {{#if: {{#vardefineecho: debug | }} | debug mode enabled}} | ||
{| class="infobox" | {| class="infobox" | ||
<onlyinclude><!-- | <onlyinclude><!-- | ||
Line 29: | Line 30: | ||
* Level: skill level, i.e, untrained, trained, focused or specialized | * Level: skill level, i.e, untrained, trained, focused or specialized | ||
− | -->{{#vardefine:modeGood|{{{mode good| | + | -->{{#vardefine:modeGood|{{{mode good|Banter}}}}}<!-- |
-->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | -->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | ||
− | -->{{#vardefine:modeAverage|{{{mode average| | + | -->{{#vardefine:modeAverage|{{{mode average|Action}}}}}<!-- |
Some initial arrays and hashes: | Some initial arrays and hashes: | ||
Line 43: | Line 44: | ||
* values are arrays of skill names | * values are arrays of skill names | ||
− | -->{{#arraydefine: modeArray | {{#var: | + | -->{{#arraydefine: modeArray | {{#var: modeAverage}}, {{#var: modeFair}}, {{#var: modeGood}} | , }}<!-- |
-->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!-- | -->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!-- | ||
-->{{#arrayslice: levelSubarray | levelArray | 1 }}<!-- | -->{{#arrayslice: levelSubarray | levelArray | 1 }}<!-- | ||
− | -->{{# | + | -->{{#hashdefine: modeHash}}<!-- |
-->{{#arrayprint: modeArray | | <mode> | <!-- | -->{{#arrayprint: modeArray | | <mode> | <!-- | ||
-->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | -->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | ||
Line 52: | Line 53: | ||
Query all skills found belonging to our three modes. | Query all skills found belonging to our three modes. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!--{{#arraydefine:skillArray | | --><!--{{#arraydefine:skillArray | | ||
− | |||
{{#ask: [[is a :: skill]] [[skill in mode :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | {{#ask: [[is a :: skill]] [[skill in mode :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | ||
|?Name | |?Name | ||
Line 67: | Line 60: | ||
}} | }} | ||
}}--><!-- | }}--><!-- | ||
+ | -->{{#hashdefine:skillModeHash | | ||
+ | {{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | ||
+ | |?Name | ||
+ | |?Includes skill | ||
+ | |format=array | ||
+ | |mainlabel=- | ||
+ | }} | ||
+ | | , | ||
+ | | <PROP> | ||
+ | }}<!-- | ||
+ | |||
+ | -->{{#hashdefine: skillHash}}<!-- | ||
+ | -->{{#hashprint: skillModeHash | | <modename> | <modeskills> | <!-- | ||
+ | -->{{#arraydefine: modeSkills | <modeskills> | <MANY> | unique}}<!-- | ||
+ | -->{{#arrayprint: modeSkills | | <skillname> | <!-- | ||
+ | -->{{#arraydefine: skillModes | {{#hashvalue: skillHash | <skillname>}} <MANY> <modename> | <MANY> | unique,sort=asc}}<!-- | ||
+ | -->{{#hashinclude: skillHash | <skillname>={{#arrayprint: skillModes | <MANY>}} }}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->{{#arraydefine: skillArray | {{#hashprint: skillHash |,| <skillname> | <skillmodes> | <skillname><PROP><skillmodes><PROP>}} }}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<!-- | ||
+ | -->query result (skillModeHash): {{#hashprint: skillModeHash | | <modename> | <modeskills> | <modename>=<modeskills><br/>}}<!-- | ||
+ | -->skillHash: {{#hashprint: skillHash | | <skillname> | <skillmodes> | <skillname>=<skillmodes><br/>}}<!-- | ||
+ | -->skillArray: {{#arrayprint: skillArray | <br/> }}<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> | <!-- |
-->{{#hashdefine: currentSkill}}<!-- | -->{{#hashdefine: currentSkill}}<!-- | ||
− | + | -->{{#vardefine: currentSkillName | <skillname> }}<!-- | |
− | |||
− | -->{{#vardefine: 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 | ||
Line 81: | Line 99: | ||
the character's modes that contain the current skill. This final array | the character's modes that contain the current skill. This final array | ||
is currentSkillModes. | is currentSkillModes. | ||
− | -->{{#arraydefine: currentSkillAllModes | | + | -->{{#arraydefine: currentSkillAllModes | <skillmodes> | <MANY> }}<!-- |
-->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | -->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | ||
Line 95: | Line 113: | ||
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}} |<!-- | ||
+ | -->levelsOfPrimaryMode ({{#var: currentSkillPrimaryMode}}): {{#hashprint: levelsOfPrimaryMode | <br/> | <level> | <skills> | <level> = <skills> }}<br/><!-- | ||
+ | -->}}<!-- | ||
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 101: | Line 122: | ||
sorting is nice :) | sorting is nice :) | ||
-->{{#arraydefine: modeSkillsAtLevel <!-- | -->{{#arraydefine: modeSkillsAtLevel <!-- | ||
− | -->| {{#hashvalue: | + | -->| {{#hashvalue: levelsOfPrimaryMode | {{#var: currentSkillLevel }} }} <LEVELSKILL> {{#var: currentSkillName}} <!-- |
-->| <LEVELSKILL> | unique,sort=asc <!-- | -->| <LEVELSKILL> | unique,sort=asc <!-- | ||
-->}}<!-- | -->}}<!-- | ||
Now we reassemble the original hash: | Now we reassemble the original hash: | ||
− | -->{{#hashinclude: | + | -->{{#hashinclude: levelsOfPrimaryMode | {{#var: currentSkillLevel }} = {{#arrayprint: modeSkillsAtLevel | <LEVELSKILL> }} }}<!-- |
-->{{#hashinclude: modeHash | <!-- | -->{{#hashinclude: modeHash | <!-- | ||
− | --> {{#var: currentSkillPrimaryMode}} = {{#hashprint: | + | --> {{#var: currentSkillPrimaryMode}} = {{#hashprint: levelsOfPrimaryMode | <LEVELSEP> | <K> | <V> | <K><LEVELVAL><V> }} <!-- |
-->}}<!-- | -->}}<!-- | ||
+ | |||
+ | -->{{#arrayreset: modeSkillsAtLevel | currentSkillAllModes | currentSkillModes }}<!-- | ||
+ | -->{{#hashreset: currentSkill | levelsOfPrimaryMode }}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
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}} |<!-- | ||
+ | -->modeHash: {{#hashprint: modeHash | <br/> | <modename> | <levels> | <modename> = <levels> }}<br/><!-- | ||
+ | -->}}<!-- | ||
Line 190: | Line 218: | ||
}}<!-- end section | }}<!-- end section | ||
-->}}<!-- end if | -->}}<!-- end if | ||
− | |||
− | |||
--></onlyinclude> | --></onlyinclude> | ||
|} | |} |
Revision as of 12:13, 27 May 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 |