Difference between revisions of "Template:SetProp"
From Salem Wiki
m (adding code) |
m |
||
(35 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <onlyinclude><!-- | + | <onlyinclude><!-- Always make Boolean type properties set to false as default!<!-- |
− | --> | + | --><!-- |
− | + | If 'IsGameMenu' doesn't get a value then set it to 'false'. | |
− | + | -->{{#set:IsGameMenu={{{IsGameMenu|n}}} }}<!-- | |
− | + | If 'IsinGameMenu' doesn't get a value then set it to 'no'. | |
− | |||
− | |||
− | }}<!-- | ||
-->{{#if: {{{IsinGameMenu|}}} | -->{{#if: {{{IsinGameMenu|}}} | ||
| {{SetProp/single | | {{SetProp/single | ||
Line 13: | Line 10: | ||
|sep={{{sep|^}}} | |sep={{{sep|^}}} | ||
}} | }} | ||
+ | | {{#set:IsinGameMenu=no}} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{#pos:{{#if:{{{Has icon|}}}|{{{Has icon}}}|icon.png}} | icon.png}} | ||
+ | | {{#if: {{{Has icon|}}} | ||
+ | | {{#set:Has icon=Image:{{{Has icon}}} }} | ||
+ | | {{#set:Has icon=Image:{{#titleparts:{{PAGENAME}}||-1}} icon.png }} | ||
+ | }} | ||
+ | | {{#set:Has icon=Image:{{#titleparts:{{PAGENAME}}||-1}} icon.png }}<!-- | ||
+ | --><dl class="error"><!-- | ||
+ | --><dt>SetProp:<!-- | ||
+ | --><dd>You need to provide a proper value for the '''Has icon''' parameter !<br/>“{{{Has icon}}}” is not a valid icon name...<!-- | ||
+ | --></dl> | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{Caption|}}} | ||
+ | | {{#set:Caption={{{Caption}}} }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{Has fullview|}}} | ||
+ | | {{#set:Has fullview=Image:{{{Has fullview}}} }} | ||
}}<!-- | }}<!-- | ||
-->{{#if: {{{RequiresTech|}}} | -->{{#if: {{{RequiresTech|}}} | ||
Line 18: | Line 33: | ||
|prop=RequiresTech | |prop=RequiresTech | ||
|val={{{RequiresTech}}} | |val={{{RequiresTech}}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{UnlocksTech|}}} | ||
+ | | {{SetProp/single | ||
+ | |prop=UnlocksTech | ||
+ | |val={{{UnlocksTech}}} | ||
|sep={{{sep|,}}} | |sep={{{sep|,}}} | ||
}} | }} | ||
Line 28: | Line 50: | ||
}} | }} | ||
}}<!-- | }}<!-- | ||
+ | -->{{#if: {{{RepairedWith|}}} | ||
+ | | {{SetProp/single | ||
+ | |prop=RepairedWith | ||
+ | |val={{{RepairedWith}}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | Only consider 'IsLiftable' when no value given for 'IsLiftableWhenEmpty'. | ||
+ | If 'IsLiftableWhenEmpty' gets any value, set it to be 'true', and automatically set 'IsLiftable' to true. | ||
+ | -->{{#ifeq: {{{IsLiftable|}}} | y/n or IsLiftableWhenEmpty=y | ||
+ | | <dl class="error"><!-- | ||
+ | --><dt>SetProp:<!-- | ||
+ | --><dd>You need to provide a proper value for the '''IsLiftable''' parameter !<br/>“y/n or IsLiftableWhenEmpty=y” is not a valid option...<!-- | ||
+ | --></dl> | ||
+ | | {{#if: {{{IsLiftableWhenEmpty|}}} | ||
+ | | {{#set:IsLiftableWhenEmpty=y }}<!-- | ||
+ | -->{{#set:IsLiftable=y }} | ||
+ | | {{#if: {{{IsLiftable|}}} | ||
+ | | {{#set:IsLiftable={{{IsLiftable}}} }} | ||
+ | }} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{Locations|}}} | ||
+ | | {{SetProp/single | ||
+ | |prop=Locations | ||
+ | |val={{{Locations}}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{HP|}}} | ||
+ | | {{#set:HP={{{HP}}} }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{Soak|}}} | ||
+ | | {{#set:Soak={{{Soak}}} }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{Loot|}}} | ||
+ | | {{SetProp/single | ||
+ | |prop=Loot | ||
+ | |val={{{Loot}}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{purity|}}} | ||
+ | | {{#set:Purity={{{purity}}} }} | ||
+ | }}<!-- | ||
+ | Alchemy values | ||
+ | set all to default 0 when either one is used. | ||
+ | -->{{#if: {{{heals|}}}{{{events1|}}}{{{events2|}}}{{{events3|}}}{{{events4|}}} | ||
+ | | {{#if: {{{heals|}}} | ||
+ | | {{#set:hebl={{#if: {{#explode:{{{heals}}}|;|0}} | {{#explode:{{{heals}}}|;|0}} | 0}} }}<!-- | ||
+ | -->{{#set:heph={{#if: {{#explode:{{{heals}}}|;|1}} | {{#explode:{{{heals}}}|;|1}} | 0}} }}<!-- | ||
+ | -->{{#set:heyb={{#if: {{#explode:{{{heals}}}|;|2}} | {{#explode:{{{heals}}}|;|2}} | 0}} }}<!-- | ||
+ | -->{{#set:hebb={{#if: {{#explode:{{{heals}}}|;|3}} | {{#explode:{{{heals}}}|;|3}} | 0}} }} | ||
+ | }}{{#if: {{{events1|}}} | ||
+ | | {{#set:sabl={{#if: {{#explode:{{{events1}}}|;|0}} | {{#explode:{{{events1}}}|;|0}} | 0}} }}<!-- | ||
+ | -->{{#set:saph={{#if: {{#explode:{{{events1}}}|;|1}} | {{#explode:{{{events1}}}|;|1}} | 0}} }}<!-- | ||
+ | -->{{#set:sayb={{#if: {{#explode:{{{events1}}}|;|2}} | {{#explode:{{{events1}}}|;|2}} | 0}} }}<!-- | ||
+ | -->{{#set:sabb={{#if: {{#explode:{{{events1}}}|;|3}} | {{#explode:{{{events1}}}|;|3}} | 0}} }} | ||
+ | }}{{#if: {{{events2|}}} | ||
+ | | {{#set:mebl={{#if: {{#explode:{{{events2}}}|;|0}} | {{#explode:{{{events2}}}|;|0}} | 0}} }}<!-- | ||
+ | -->{{#set:meph={{#if: {{#explode:{{{events2}}}|;|1}} | {{#explode:{{{events2}}}|;|1}} | 0}} }}<!-- | ||
+ | -->{{#set:meyb={{#if: {{#explode:{{{events2}}}|;|2}} | {{#explode:{{{events2}}}|;|2}} | 0}} }}<!-- | ||
+ | -->{{#set:mebb={{#if: {{#explode:{{{events2}}}|;|3}} | {{#explode:{{{events2}}}|;|3}} | 0}} }} | ||
+ | }}{{#if: {{{events3|}}} | ||
+ | | {{#set:subl={{#if: {{#explode:{{{events3}}}|;|0}} | {{#explode:{{{events3}}}|;|0}} | 0}} }}<!-- | ||
+ | -->{{#set:suph={{#if: {{#explode:{{{events3}}}|;|1}} | {{#explode:{{{events3}}}|;|1}} | 0}} }}<!-- | ||
+ | -->{{#set:suyb={{#if: {{#explode:{{{events3}}}|;|2}} | {{#explode:{{{events3}}}|;|2}} | 0}} }}<!-- | ||
+ | -->{{#set:subb={{#if: {{#explode:{{{events3}}}|;|3}} | {{#explode:{{{events3}}}|;|3}} | 0}} }} | ||
+ | }}{{#if: {{{events4|}}} | ||
+ | | {{#set:lebl={{#if: {{#explode:{{{events4}}}|;|0}} | {{#explode:{{{events4}}}|;|0}} | 0}} }}<!-- | ||
+ | -->{{#set:leph={{#if: {{#explode:{{{events4}}}|;|1}} | {{#explode:{{{events4}}}|;|1}} | 0}} }}<!-- | ||
+ | -->{{#set:leyb={{#if: {{#explode:{{{events4}}}|;|2}} | {{#explode:{{{events4}}}|;|2}} | 0}} }}<!-- | ||
+ | -->{{#set:lebb={{#if: {{#explode:{{{events4}}}|;|3}} | {{#explode:{{{events4}}}|;|3}} | 0}} }} | ||
+ | }}{{#if: {{{purity|}}} | ||
+ | | | ||
+ | | {{#set:Purity=1.0}} | ||
+ | }} | ||
+ | |<!-- Alternative old manual way | ||
+ | set all to default 0 when either one is used. | ||
+ | -->{{#if: {{{hebl|}}}{{{sabl|}}}{{{mebl|}}}{{{subl|}}}{{{lebl|}}}{{{heph|}}}{{{saph|}}}{{{meph|}}}{{{suph|}}}{{{leph|}}}{{{heyb|}}}{{{sayb|}}}{{{meyb|}}}{{{suyb|}}}{{{leyb|}}}{{{hebb|}}}{{{sabb|}}}{{{mebb|}}}{{{subb|}}}{{{lebb|}}} | ||
+ | | {{#set:hebl={{#if: {{{hebl|}}} | {{{hebl}}} | 0}} }}<!-- | ||
+ | -->{{#set:sabl={{#if: {{{sabl|}}} | {{{sabl}}} | 0}} }}<!-- | ||
+ | -->{{#set:mebl={{#if: {{{mebl|}}} | {{{mebl}}} | 0}} }}<!-- | ||
+ | -->{{#set:subl={{#if: {{{subl|}}} | {{{subl}}} | 0}} }}<!-- | ||
+ | -->{{#set:lebl={{#if: {{{lebl|}}} | {{{lebl}}} | 0}} }}<!-- | ||
+ | -->{{#set:heph={{#if: {{{heph|}}} | {{{heph}}} | 0}} }}<!-- | ||
+ | -->{{#set:saph={{#if: {{{saph|}}} | {{{saph}}} | 0}} }}<!-- | ||
+ | -->{{#set:meph={{#if: {{{meph|}}} | {{{meph}}} | 0}} }}<!-- | ||
+ | -->{{#set:suph={{#if: {{{suph|}}} | {{{suph}}} | 0}} }}<!-- | ||
+ | -->{{#set:leph={{#if: {{{leph|}}} | {{{leph}}} | 0}} }}<!-- | ||
+ | -->{{#set:heyb={{#if: {{{heyb|}}} | {{{heyb}}} | 0}} }}<!-- | ||
+ | -->{{#set:sayb={{#if: {{{sayb|}}} | {{{sayb}}} | 0}} }}<!-- | ||
+ | -->{{#set:meyb={{#if: {{{meyb|}}} | {{{meyb}}} | 0}} }}<!-- | ||
+ | -->{{#set:suyb={{#if: {{{suyb|}}} | {{{suyb}}} | 0}} }}<!-- | ||
+ | -->{{#set:leyb={{#if: {{{leyb|}}} | {{{leyb}}} | 0}} }}<!-- | ||
+ | -->{{#set:hebb={{#if: {{{hebb|}}} | {{{hebb}}} | 0}} }}<!-- | ||
+ | -->{{#set:sabb={{#if: {{{sabb|}}} | {{{sabb}}} | 0}} }}<!-- | ||
+ | -->{{#set:mebb={{#if: {{{mebb|}}} | {{{mebb}}} | 0}} }}<!-- | ||
+ | -->{{#set:subb={{#if: {{{subb|}}} | {{{subb}}} | 0}} }}<!-- | ||
+ | -->{{#set:lebb={{#if: {{{lebb|}}} | {{{lebb}}} | 0}} }}<!-- | ||
+ | -->{{#if: {{{purity|}}} | ||
+ | | | ||
+ | | {{#set:Purity=1.0}} | ||
+ | }} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | Skill values, set all to default 0 when either one is used. | ||
+ | -->{{#if: {{{arts|}}}{{{cloak|}}}{{{faith|}}}{{{flora|}}}{{{hammer|}}}{{{hunting|}}}{{{law|}}}{{{mines|}}}{{{pots|}}}{{{sparks|}}}{{{stocks|}}}{{{sugar|}}}{{{thread|}}}{{{natural|}}}{{{perennial|}}} | ||
+ | | {{#set:arts={{#if: {{{arts|}}} | {{{arts}}} | 0}} }}<!-- | ||
+ | -->{{#set:cloak={{#if: {{{cloak|}}} | {{{cloak}}} | 0}} }}<!-- | ||
+ | -->{{#set:faith={{#if: {{{faith|}}} | {{{faith}}} | 0}} }}<!-- | ||
+ | -->{{#set:flora={{#if: {{{flora|}}} | {{{flora}}} | 0}} }}<!-- | ||
+ | -->{{#set:hammer={{#if: {{{hammer|}}} | {{{hammer}}} | 0}} }}<!-- | ||
+ | -->{{#set:hunting={{#if: {{{hunting|}}} | {{{hunting}}} | 0}} }}<!-- | ||
+ | -->{{#set:law={{#if: {{{law|}}} | {{{law}}} | 0}} }}<!-- | ||
+ | -->{{#set:mines={{#if: {{{mines|}}} | {{{mines}}} | 0}} }}<!-- | ||
+ | -->{{#set:pots={{#if: {{{pots|}}} | {{{pots}}} | 0}} }}<!-- | ||
+ | -->{{#set:sparks={{#if: {{{sparks|}}} | {{{sparks}}} | 0}} }}<!-- | ||
+ | -->{{#set:stocks={{#if: {{{stocks|}}} | {{{stocks}}} | 0}} }}<!-- | ||
+ | -->{{#set:sugar={{#if: {{{sugar|}}} | {{{sugar}}} | 0}} }}<!-- | ||
+ | -->{{#set:thread={{#if: {{{thread|}}} | {{{thread}}} | 0}} }}<!-- | ||
+ | -->{{#set:natural={{#if: {{{natural|}}} | {{{natural}}} | 0}} }}<!-- | ||
+ | -->{{#set:perennial={{#if: {{{perennial|}}} | {{{perennial}}} | 0}} }}<!-- | ||
+ | -->{{#if: {{{purity|}}} | ||
+ | | | ||
+ | | {{#set:Purity=1.0}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | -->{{#if: {{{RequiredBy|}}} | ||
+ | | {{SetProp/single | ||
+ | |prop=RequiredBy | ||
+ | |val={{{RequiredBy}}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }} | ||
+ | }}<!-- | ||
+ | Automatically set RequiredBy using results of a SMW-Query. | ||
+ | --><includeonly>{{SetProp/RequiredBy auto | ||
+ | |page={{#titleparts:{{PAGENAME}}||-1}} | ||
+ | |sep={{{sep|,}}} | ||
+ | }}</includeonly><!-- | ||
--></onlyinclude><noinclude>{{documentation}}</noinclude> | --></onlyinclude><noinclude>{{documentation}}</noinclude> |
Latest revision as of 02:13, 19 February 2016
Template documentation (for the template shown above, sometimes hidden or invisible)
Description
- This is a wrapper-template that calls {{SetProp/single}} to automatically set property values.
- It has a fixed-set of properties it supports, and can be expanded when needed in code...
- Some properties are fit to assign multiple values to, using a sep, but those of type Boolean are obviously not...
- For more documentation on functions used see
Syntax
- Type the below code on top of a page:
{{SetProp |propname=propvalues |propname=propvalues |... }}
- It supports this optional named-parameter for multi-value propname's:
- sep
- The default separator used in the propvalues to separate single-values from each other.
- It defaults to a comma ','
- sep
Supported propname's
It currently supports these properties in preferred sequence:
- IsGameMenu (Type: Boolean, single-value)
- Will always be set.
- Defaults to 'false'.
- IsinGameMenu (Type: String, multi-value)
- Will always be set.
- Defaults to 'no'.
- Default separator in this case is a ^ when no over-ride is used in sep, be careful this property can use a comma in its valid value!
- Has icon (Type: Page, single-value)
- Only supply the filename, it will automatically prepend the final property-value with
Image:
- When not used, it will auto-set this property to
Image:{{SUBPAGENAME}} icon.png
- Only supply the filename, it will automatically prepend the final property-value with
- Caption (Type: Text, single-value)
- Can hold free text.
- Has fullview (Type: Page, single-value)
- Only supply the filename, it will automatically prepend the final property-value with
Image:
- Only supply the filename, it will automatically prepend the final property-value with
- RequiresTech (Type: Page, multi-value)
- UnlocksTech (Type: Page, multi-value)
- RequiresObj (Type: String, multi-value)
- RepairedWith (Type: String, multi-value)
- IsLiftable (Type: Boolean, single-value)
- IsLiftableWhenEmpty (Type: Boolean, single-value)
- When used will always be set to 'true', and auto-set IsLiftable='true'.
- Locations (Type: Page, multi-value)
- HP (Type: Number, single-value)
- Soak (Type: Number, single-value)
- Loot (Type: String, multi-value)
- purity (Type: Number, single-value) (No auto calculations done yet)
- This will default to 1.0 when not provided together with Alchemical values or Skills.
- Alchemical values (Type: Number, single-value)
- These can be provided in 2 formats, manual and "record".
- The manual format will only be accepted when no "record" format is being used at all for any of them.
- In "record" format with dot-comma as field separators:
- heals - List the amounts that this object heals your humours, separated by dot-comma's, in sequence as it's been listed in game.
- events1 - List the RED numbers, separated by dot-comma's, in sequence as it's been listed in game.
- events2 - List the GREEN numbers, separated by dot-comma's, in sequence as it's been listed in game.
- events3 - List the BLUE numbers, separated by dot-comma's, in sequence as it's been listed in game.
- events4 - List the YELLOW numbers, separated by dot-comma's, in sequence as it's been listed in game.
- In manual format, single number per propname:
- Skills (Type: Number, single-value)
- These are called Proficiencies ingame.
- If either one of the below Skills are set, then all will be set at same time.
- They will all default to '0', when not given a value explicitly.
- arts = Arts & Crafts
- cloak = Cloak & Dagger
- faith = Faith & Wisdom
- frontier = Frontier & Wilderness
- hammer = Hammer & Nail
- hunting = Hunting & Gathering
- law = Law & Lore
- mines = Mines & Mountains
- pots = Pots & Pans
- sparks = Sparks & Embers
- stocks = Stocks & Cultivars
- sugar = Sugar & Spice
- thread = Thread & Needle
- natural = Natural Philosophy
- perennial = Perennial Philosophy
- RequiredBy (Type: Page, multi-value)
- This will be automatically set using {{SetProp/RequiredBy auto}}, after any eventual manual assignments using this propname.
Copy&Paste code for easy use
- Type the below code at the top of the page, with values assigned to relevant parameters.
- Parameters can be in any order, and not all need to be used, but its preferred to use the ordering above for uniformity.
- The shown parameters are examples and most used.
- You can remove the unused ones if they are not likely to be set for your page.
- See Help:Infobox
Examples
See the example(s) in the documentation of {{SetProp/single}}, this template just passes known multi-value properties with their values to it.
Or directly uses {{#set:propname=propvalue}}
for single-value properties.
Visit Template:SetProp/doc to edit this text! (How does this work?)