Vorlage:Sell expr

Aus Terraria Wiki
Wechseln zu: Navigation, Suche
Lua logo.svg
Diese Vorlage verwendet Modul:Coin expr, ein Skript, das in der Programmiersprache Lua verfasst wurde. Siehe Lua und die Scribunto-Erweiterung, um mehr über Lua zu erfahren.
Template-info.svg Dokumentation Die folgende Dokumentation stammt von der Seite Vorlage:Sell expr/Dokumentation. (bearbeiten | Versionsgeschichte)
Siehe auch die englische Vorlagenseite: Template:Sell expr. Sie enthält möglicherweise umfassendere oder aktuellere Informationen.
Important.svg Diese Seite ist nicht oder unvollständig übersetzt.
Hilf mit, indem du den Text übersetzt und anschließend diesen Hinweis entfernst. Dies entfernt diese Seite auch aus der Liste von Seiten mit unzureichender Übersetzung.

This template can be used to handle elaborate expressions in conjunction with item sell values. The sell values are generated using {{iteminfo}}, hence they are dynamic and are adjusted accordingly should they be altered in a future Terraria update.

It aims at simplifying the convoluted syntax that is required for displaying sell value expressions: {{coin|{{#expr:{{iteminfo|Pixie Dust|value|raw=y}}/5*99+{{iteminfo|Crystal Shard|value|raw=y}}/5*33}}}} can be shortened to {{sell expr|Pixie Dust|*99+|Crystal Shard|*33}} using this template.

For handling buy prices instead of sell values, use {{buy expr}}. The syntax and usage is exactly the same.

Verwendung[Quelltext bearbeiten]

{{ sell expr | <item name or ID 1> | <expression operators/constants/etc. 1> | ... | ... | <item name or ID n> | <expression operators/constants/etc. n> | raw = y/yes (optional) | round = <digit to round to> (optional) }}

1st, 3rd, 5th, 7th, ..., nth unnamed parameter

Name or ID of an item whose sell value is to be inserted at that part of the expression. Can be empty.

2nd, 4th, 6th, 8th, ..., (n+1)-th unnamed parameter

Operators, constants, etc. – valid {{#expr:}} syntax. Can be empty.


Suppress the {{coin}} wrapping and instead display the numerical value, e.g. for use in other expressions.


Rounding functionality of {{coin}}, see Template:Coin for documentation and examples. Has no effect when using raw=y.

Concept[Quelltext bearbeiten]

Example: Multiply the sum of the sell values of 3 Pixie Dust and 1 Crystal Shard by 5 and add the sell value of 7 Souls of Light.

Think of writing the expression normally:

{{#expr: 5*( <Pixie Dust sell value>*3 + <Crystal Shard sell value> ) + <Soul of Light sell value>*7 }}

For this template, simply replace the <item name sell value> parts with |<item name>|:

{{sell expr| 5*( |Pixie Dust|*3 + |Crystal Shard| ) + |Soul of Light|*7 }}

Now check if the first unnamed parameter is still an item name or ID. If it is not, add an empty parameter to fix that:

{{sell expr| | 5*( |Pixie Dust|*3 + |Crystal Shard| ) + |Soul of Light|*7 }}



Proof: 5*( 100*1 *3 + 1600*16 ) + 200*2 *7   =   5*( 1900*19 ) + 1400*14   =   9500*95 + 1400*14   =   10900*19

Hinweise[Quelltext bearbeiten]

  • The template will not return anything if the first, third, etc. unnamed parameters are not names or IDs of items or if the second, fourth, etc. unnamed parameters are not valid {{#expr:}} syntax.
  • {{iteminfo}} can only handle items that are present in Desktopversion Desktop The sell value of items exclusive to non-Desktop platforms will evaluate to 0.

Beispiele[Quelltext bearbeiten]

Code Result
{{sell expr| Terra Blade }} 200000*20
{{sell expr| Terraklinge }} 200000*20
{{sell expr| True Excalibur|+|True Night's Edge }} 200000*20
{{sell expr|| (|Excalibur|+|Broken Hero Sword|) + (|Night's Edge|+|Broken Hero Sword|) }} 236000*2360
{{sell expr|| (12*|Hallowed Bar|+|Broken Hero Sword|) + ((|Blade of Grass|+|Fiery Greatsword|+|Light's Bane|+|Muramasa|)+|Broken Hero Sword|) }} 229000*2290
{{sell expr| Wood|*5 }} 0*0
{{sell expr| 12*|Terra Blade }} (1st parameter not an item name or ID, 2nd parameter an item name) (template error)
{{sell expr|| 12*|Terra Blade }} (fixed the above) 2400000*240
{{sell expr||||     |||  ||| 6*||||| Terra Blade |||||*2 ||}} (parameters can be empty) 2400000*240
{{sell expr| Terra Blade|*|12 }} (typo: 12 is treated as an item ID here) 10000000*10
{{sell expr| Tizona|+|Sharanga }} (items not available on Desktop (template error)
{{sell expr| Terra Blade|×12 }} (not valid syntax) 0*0
{{sell expr| Terra Blade |raw=y}} 200000