Difference between revisions of "Template:SetProp/single/doc"

From Salem Wiki
Jump to: navigation, search
m (→‎Syntax: adding info)
m (Protected "Template:SetProp/single/doc": Documentation of key-feature ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Description==
 
==Description==
:This template is used to automate calls to <code><nowiki>{{#set:}}</nowiki></code>
+
:This template is used, by {{t|SetProp}}, to automate calls to <code><nowiki>{{#set:}}</nowiki></code>
 
:It uses <code><nowiki>{{#arraymap:}}</nowiki></code> as a wrapper to split and inject arguments.
 
:It uses <code><nowiki>{{#arraymap:}}</nowiki></code> as a wrapper to split and inject arguments.
  
 
==Syntax==
 
==Syntax==
:Type the below code somewhere oin your code: <code><nowiki>{{SetProp/single|prop=|val=}}</nowiki></code>
+
:Type the below code somewhere in your code: <code><nowiki>{{SetProp/single|prop=|val=}}</nowiki></code>
 
:It accepts these named-parameters:
 
:It accepts these named-parameters:
 
:*'''prop'''
 
:*'''prop'''
Line 15: Line 15:
  
 
==Examples==
 
==Examples==
#
+
#{{t|SetProp/single|prop<nowiki>=</nowiki>RequiresTech|val<nowiki>=Simple Fences, Quarrying</nowiki>}}
 +
#:Would execute:<br/><code><nowiki>{{#arraymap:Simple Fences, Quarrying|, |xXx |{{#set:RequiresTech=xXx}} |}}</nowiki></code>
 +
#::Would execute:<br/>{{#arraymap:Simple Fences, Quarrying|{{{sep|,}}} |xXx |<nowiki>{{#set:</nowiki>RequiresTech=xXx<nowiki>}}</nowiki> |<br/>}}
 +
#{{t|SetProp/single|prop<nowiki>=</nowiki>Locations|val<nowiki>=Grassland, Forests</nowiki>}}
 +
#:Would execute:<br/><code><nowiki>{{#arraymap:Grassland, Forests|, |xXx |{{#set:Locations=Terrain/xXx}} |}}</nowiki></code>
 +
#::Would execute:<br/>{{#arraymap:Grassland, Forests|{{{sep|,}}} |xXx |<nowiki>{{#set:</nowiki>Locations=Terrain/xXx<nowiki>}}</nowiki> |<br/>}}
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Latest revision as of 18:40, 25 July 2012

Description

This template is used, by {{SetProp}}, to automate calls to {{#set:}}
It uses {{#arraymap:}} as a wrapper to split and inject arguments.

Syntax

Type the below code somewhere in your code: {{SetProp/single|prop=|val=}}
It accepts these named-parameters:
  • prop
    Mandatory; The name of the property to set
  • val
    Mandatory; A sequence of values to assign to the property, one-at-a-time.
  • sep
    Optional; The separator used between the values in the sequence of val.
    Defaults to a comma ','.

Examples

  1. {{SetProp/single|prop=RequiresTech|val=Simple Fences, Quarrying}}
    Would execute:
    {{#arraymap:Simple Fences, Quarrying|, |xXx |{{#set:RequiresTech=xXx}} |}}
    Would execute:
    {{#set:RequiresTech=Simple Fences}}
    {{#set:RequiresTech=Quarrying}}
  2. {{SetProp/single|prop=Locations|val=Grassland, Forests}}
    Would execute:
    {{#arraymap:Grassland, Forests|, |xXx |{{#set:Locations=Terrain/xXx}} |}}
    Would execute:
    {{#set:Locations=Terrain/Grassland}}
    {{#set:Locations=Terrain/Forests}}