Template:Dv/doc

DV, or Dinosaur Values, serves as a one-stop database for data values that may frequently change during ARK's development that enables users to edit a single template rather than each individual creature's page and any other pages these values might appear. This template is not intended to replace Cargo, rather the two can work in unison when this template is called on a semantic page.

Database
The database resides in Module:Dv/data and is a nested array (or table in Lua speech).

The first tier's keys is the creature's names. The next tier contains key-value pairs. A value can also be another array/table with key-value pairs, in an arbitrary depth.

The keys build the. For example, the path to the value 5 is attacks/1/melee/damage, or in other words.

-- simplified syntax to show the principle, for the real syntax see Module:Dv/data

... +- dodo +- dodorex ... +- aberrantOverride +- abberantdodo +- inherits: dodo +- overridewith: aberrantOverride +- commonname: Aberrant Dodo +- ...
 * +- commonname: Dodo
 * +- group: Birds
 * +- stats
 * | +- health: 40
 * +- attacks
 * +- 1
 * +- name: Melee
 * +- melee
 * +- damage: 5
 * +- melee
 * +- damage: 5
 * +- damage: 5
 * +- stats -- a few stats that are different for most aberrant creatures
 * +- healthtamedmult: -0.04

There are two special keys,  and , which are considered only when they occur in the second tier. If  exists for a creature then the data are copied from the other creature which is named by the value. Then all data of the actual creature is recursively merged into. Values of existing keys will be overridden, non-existing keys with their values will be added. If also  exists then the values of the named section will also be merged afterwards, overriding all previously added values.

So, in the example above the Aberrant Dodo is a copy of the non-aberrant Dodo, but with an own common name, and some overridden (or added) stats that are common for most aberrant creatures.

Common Usage
The parts of the path can be written combined with a slash  as separator or as individual parameters separated by.

The attribute path needs to lead to a single value. Otherwise the text "path not specific enough" is returned.

If the path points to a non existing key nothing (an empty string) is returned.

Resolving the name
The of the creature usually corresponds to its page name. The Template/Module Dv removes all characters other than A-Za-z0-9 (e.g. space, punctuation and accented characters) from the parameter and converts it to lowercase. Then it checks if there is an alias defined in Module:Dv/aliases. The resulting name has to match with one of the keys of the first tier of the array/table defined in Module:Dv/data. Otherwise the text "creature data not found" is returned.

The same rule applies for the attribute path parts analogously, except the alias resolving.

Examples
will show " "

will show " "

will show " "

will show " "

will show " "

will show " "

will show " "

will show " "

will show " "

Defining variables
As an alternative add the named parameter  with no or an arbitrary prefix (equal sign is mandatory).

If the leads to a single value the behavior is the same as above. If it leads to a non-existing key then nothing (empty string) is returned. If it leads to an array/table then the text "variables defined" is the return value. In this case for each key-value pair a  is executed. If a value is a nested array/table then a variable with the current key and the string "table" is defined, and for each entry the key is prepended by the parent's path parts starting after the given and separated by slashes. Additionally, if the prefix is not empty, all variable names are prepended by the prefix followed by a slash.

In the example above the return text "variables defined" is ignored, but needs to be there (or rather a non-empty string) to satisfy the condition for the.