Difference between revisions of "User:©TriMoon™/Sandbox"

From Salem Wiki
Jump to: navigation, search
Line 105: Line 105:
 
*[http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Semantic_Forms_and_templates#Multiple_values_for_the_same_field Multiple values for the same field]
 
*[http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Semantic_Forms_and_templates#Multiple_values_for_the_same_field Multiple values for the same field]
 
----
 
----
===SetProp===
 
 
__SHOWFACTBOX__
 
__SHOWFACTBOX__
<ol>
 
<li>Automatic property setting in mind: {{t|SetProp|propname<nowiki>=</nowiki>propvalues|propname<nowiki>=</nowiki>propvalues|...}}<br/>
 
Where ''propvalues'' consist of <u>single values</u> separated by commas, that are used to set ''propname'' multiple times using each value.<br/>
 
The single-values are depended on the format of the property to set, which can't have commas in their format ofcourse...<ol type="a">
 
<li><code><nowiki>{{#arraymap: propvalues |, |xXx |{{#set:propname=xXx}} |}}</nowiki></code></li>
 
<li>{{t|SetProp|RequiresTech<nowiki>=</nowiki>Simple Fences,Quarrying|RequiresObj<nowiki>=</nowiki>Anvil,Flint;1,Stone;3,Lime;15;Startpost,Flint;15;Startpost,Stone;30;Startpost,Lime;8;Cornerpost,Flint;8;Cornerpost,Stone;15;Cornerpost,Board;10,Nails;4}}<br/>Would execute:{{SetProp|RequiresTech=Simple Fences,Quarrying|RequiresObj=Anvil,Flint;1,Stone;3,Lime;15;Startpost,Flint;15;Startpost,Stone;30;Startpost,Lime;8;Cornerpost,Flint;8;Cornerpost,Stone;15;Cornerpost,Board;10,Nails;4}}<ol type="i">
 
<li><code><nowiki>{{#arraymap: Simple Fences,Quarrying |, |xXx |{{#set:RequiresTech=xXx}} |}}</nowiki></code></li>
 
<li><code><nowiki>{{#arraymap: Anvil,Flint;1,Stone;3,Lime;15;Startpost,Flint;15;Startpost,Stone;30;Startpost,Lime;8;Cornerpost,Flint;8;Cornerpost,Stone;15;Cornerpost,Board;10,Nails;4 |, |xXx |{{#set:RequiresObj=xXx}} |}}</nowiki></code></li>
 
</ol></li>
 
<li>{{t|PropVals|prop<nowiki>=</nowiki>RequiresTech|page<nowiki>=</nowiki>User:©TriMoon™/Sandbox}} gives:<br/>{{PropVals|prop=RequiresTech|page=User:©TriMoon™/Sandbox}}</li>
 
<li>{{t|PropVals|prop<nowiki>=</nowiki>RequiresObj|page<nowiki>=</nowiki>User:©TriMoon™/Sandbox}} gives:<br/>{{PropVals|prop=RequiresObj|page=User:©TriMoon™/Sandbox}}</li>
 
</ol></li>
 
</ol>
 
  
 
===HasProp===
 
===HasProp===

Revision as of 19:22, 4 July 2012

Infobox

{{infobox}}:
Template:Infobox/debugTheme Template:Infobox/debugTheme
Template:Infobox/debugTheme Template:Infobox/debugTheme

Semantic Wiki related

Lets try to describe properties of Objects using their placement in the game-menus to aid in later auto-categorization....

See Property:IsinGameMenu for current menu-names.

fe. Blazing Brazier, would need:

  • isGameMenu=n
  • isinGameMenu=Claims & Defenses
See these pages for documentation


HasProp

{{#if: {{HasProp|Has icon}}
| [[{{#show:User:©TriMoon™/PropVals testdata|?Has icon|link=none}}]]
}}


Property:RequiresObj

  1. Listing values for Property:RequiresObj on current test data page
    1. {{#show: User:©TriMoon™/PropVals testdata |?RequiresObj |link=none |sep=<br/> }}
    2. {{#ask: [[User:©TriMoon™/PropVals testdata]] [[RequiresObj::+]] | ?RequiresObj= |link=none |sep=<br/> }}
    3. Automatic listing in mind: {{PropVals |prop={{{prop|RequiresObj}}} |page={{FULLPAGENAME}}}}
      1. {{PropVals/getRecords|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata }}
      2. {{PropVals/Group | <output from step above> }} internally using {{PropVals/Split}}
        • As you can see the usage below doesn't work because the parser does not recognize the records as extra arguments...
          • {{PropVals/Group |{{PropVals/getRecords|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata }} }}
          • PropVals/Group:
            You need to provide records tobe processed !
        • Therefore we need to use {{#arraymap:}} as a wrapper to inject the records as extra arguments...
          • {{#arraymap: {{PropVals/getRecords|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata }}{{{grpsep|/\}}} |{{{grpsep|/\}}} |xXx |{{PropVals/Group |sep={{{sep|;}}} |grpsep={{{grpsep|/\}}} |xXx }} |}}
          • {{PropVals/getGroupedRecords|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata |sep={{{sep|;}}}|grpsep={{{grpsep|/\}}} }}
      3. <ul>{{#arraymap: <output from step above> |{{{grpsep|/\}}} |xXx |{{PropVals/List|sep={{{sep|;}}}|xXx}} |}}</ul>
      4. {{PropVals|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata}} gives:

    Property:RequiresTech

    1. Listing pages using Property:RequiresTech
      1. {{#ask: [[RequiresTech::+]] }}
      2. {{#ask: [[:+]] [[RequiresTech::+]] }}
      3. Listing values for Property:RequiresTech on current test data page
        1. {{PropVals|prop=RequiresTech|page=User:©TriMoon™/PropVals testdata}} gives:

      Property:RequiredBy

      1. Listing all values for Property:RequiredBy on certain page
        1. {{#ask: [[Axe]] |?RequiredBy |link=none |format=template |template=PropVals/List RequiredBy/query template |named args=yes}}
          {{PropVals/List RequiredBy/query template |#querycondition=Axe |#querylimit=50 |#resultoffset=0 |#rowcount=1 |1=Flint Axe |RequiredBy= |#=0 |#rownumber=1}}
        2. {{#ask:[[-RequiredBy::{{{page|Nails}}}]]
          |format=ul
          |limit=10
          |link=none
          |template=PropVals/Print Entry
          }}