Template:StoreVariables

来自Terraria Wiki
跳到导航 跳到搜索
Template-info.svg 文档 以下文档来自Template:StoreVariables/doc。(编辑 | 历史

This template is a simple helper template that stores its parameter input to variables. The variable names are prefixed with sv_, which can be adjusted via {{options}}.

It is mainly intended to be used in cargo and DPL queries.

Usage

{{ storeVariables | <variable name 1> = <variable value 1> | <variable name 2> = <variable value 2> | ... | <variable name n> = <variable value n> }}

There is another version of the template, {{storeVariables/sum}}, which, if it receives the name of a variable for which there is already a value, adds the existing value of the variable to the newly passed value. Note that this means that manual resetting of variables will likely be required.

For DPL queries, the template {{storeVariables/dpl}} should be used. Instead of regular variables, it sets {{#dplvar:}}s.

Examples

Code Result
{{storeVariables|damage=10|usetime=fast}}
damage: {{#var:sv_damage}}, usetime: {{#var:sv_usetime}}

damage: 10, usetime: fast
{{storeVariables|damage=10|usetime=fast}}
damage: {{#var:sv_damage}}, usetime: {{#var:sv_usetime}}
{{storeVariables|damage=20}}
damage: {{#var:sv_damage}}, usetime: {{#var:sv_usetime}}
{{options/set|storeVariables|fields=damage/usetime}}
{{storeVariables|damage=30}}
damage: {{#var:sv_damage}}, usetime: {{#var:sv_usetime}}
{{options/reset|storeVariables}}
damage: 10, usetime: fast

damage: 20, usetime: fast

damage: 30, usetime:

{{storeVariables/sum|crit=0.4|knockback=strong}}
{{storeVariables/sum|crit=0.7|knockback=weak}}
crit: {{#var:sv_crit}}, knockback: {{#var:sv_knockback}}


crit: 1.1, knockback: weak
{{#dpl:title=Terra Blade|include={item infobox¦storeVariables/dpl} }}
{{#dplvar:sv_auto}}
{{#dplvar:sv_hardmode}}
{{#dplvar:sv_listcat}}



Options

This template supports options through {{options}} template. All valid options are listed below, see {{options}} for usage and other infomation.

See Template:storeVariables/initOptions for the initial options setting of this template.

NameAliasInitial ValueValue Mapping[1]Note
prefixsv_
fields(empty)
fields_sep/
  1. Values with mapping will be stored and loaded as mapped value. Other values without mapping will be stored and loaded as-is.