Difference between revisions of "Template:SetProp/single"
From Salem Wiki
(Initial setup) |
m (Changed protection level for "Template:SetProp/single": images get protected also, so no cascade :/ ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <onlyinclude></onlyinclude><noinclude>{{documentation}}</noinclude> | + | <onlyinclude><!-- |
+ | -->{{#switch: {{#if:{{{prop|}}}||0}}{{#if:{{{val|}}}||0}} | ||
+ | | 0 | ||
+ | | 00 = <dl class="error"><!-- | ||
+ | --><dt>SetProp/single:<!-- | ||
+ | --><dd>You need to provide both '''prop''' and '''val''' parameters !<!-- | ||
+ | --></dl> | ||
+ | | #default = {{ | ||
+ | #switch: {{{prop|}}} | ||
+ | | IsinGameMenu = {{#arraymap:{{{val|}}}|{{{sep|^}}} | ||
+ | |xXx | ||
+ | |{{ #ifeq: xXx | no (or the menu-name) | ||
+ | | <dl class="error"><!-- | ||
+ | --><dt>SetProp/single:<!-- | ||
+ | --><dd>You need to provide a proper value for the '''{{{prop}}}''' parameter !<br/>“xXx” is not a valid option...<!-- | ||
+ | --></dl> | ||
+ | | {{#set:{{{prop|}}}=xXx}} | ||
+ | }} | ||
+ | |}} | ||
+ | | RequiresObj = {{#arraymap:{{{val|}}}|{{{sep|,}}} | ||
+ | |xXx | ||
+ | |{{ #if:{{PropVals/Split|part=1|val=xXx}} | ||
+ | | {{#set:{{{prop|}}}=xXx}} | ||
+ | | <dl class="error"><!-- | ||
+ | --><dt>SetProp/single:<!-- | ||
+ | --><dd>You need to provide an '''''amount''''' for “{{PropVals/Split|part=head|val=xXx}}” in the '''{{{prop}}}''' parameter !<!-- | ||
+ | --></dl> | ||
+ | }} | ||
+ | |}} | ||
+ | | Locations = {{#arraymap:{{{val|}}}|{{{sep|,}}} |xXx |{{#set:{{{prop|}}}=Terrain/xXx}} |}} | ||
+ | | #default = {{#arraymap:{{{val|}}}|{{{sep|,}}} |xXx |{{#set:{{{prop|}}}=xXx}} |}} | ||
+ | }} | ||
+ | }}</onlyinclude><noinclude>{{documentation}}</noinclude> |
Latest revision as of 18:40, 25 July 2012
- SetProp/single:
- You need to provide both prop and val parameters !
Template documentation (for the template shown above, sometimes hidden or invisible)
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 ','.
- prop
Examples
- {{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}}
- Would execute:
- Would execute:
- {{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}}
- Would execute:
- Would execute:
Visit Template:SetProp/single/doc to edit this text! (How does this work?)