Template:DataProp/doc: Difference between revisions

Update not-found examples to show both entity and prop error messages (with help from vergir-bot LLM)
Vergir (talk | contribs)
Document Convar lookup mode: usage note, TemplateData, and Convar example (with help from vergir-bot LLM)
Line 1: Line 1:
== Usage ==
== Usage ==
A shorthand template to retrieve raw technical values from datamined game data. Searches across abilities, heroes, and items automatically.
A shorthand template to retrieve raw technical values from datamined game data. Searches across abilities, heroes, and items automatically, and can also look up [[Console commands|console variables]] (convars) on request.


Powered by [[Module:GameData|Module:GameData]].
Powered by [[Module:GameData|Module:GameData]].


Dot notation is supported for nested properties (e.g. <code>Scale.Value</code>). Tables with a <code>Value</code> field are automatically unwrapped.
Dot notation is supported for nested properties (e.g. <code>Scale.Value</code>). Tables with a <code>Value</code> field are automatically unwrapped.
To retrieve a [[Console commands|console variable]] value, pass <code>Convar</code> as the first parameter and the convar name as the second (e.g. <code>&#123;&#123;DataProp|Convar|citadel_camera_fov&#125;&#125;</code>). When a convar is stored together with a description, only its value is returned.


== Parameters ==
== Parameters ==
Line 12: Line 14:
"1": {
"1": {
"label": "Entity name",
"label": "Entity name",
"description": "Name of the ability, hero, or item.",
"description": "Name of the ability, hero, or item. Pass the literal value Convar to look up a console variable instead.",
"type": "string",
"type": "string",
"required": true,
"required": true,
"example": "Singularity, Drifter, Grit"
"example": "Singularity, Drifter, Grit, Convar"
},
},
"2": {
"2": {
"label": "Property",
"label": "Property",
"description": "Property key to retrieve. Supports dot notation for nested values.",
"description": "Property key to retrieve. Supports dot notation for nested values. When the first parameter is Convar, this is the console variable name instead.",
"type": "string",
"type": "string",
"required": true,
"required": true,
"example": "DPS, BaseHealthRegen, BarrierDuration"
"example": "DPS, BaseHealthRegen, citadel_camera_fov"
}
}
},
},
"format": "inline",
"format": "inline",
"paramOrder": ["1", "2"],
"paramOrder": ["1", "2"],
"description": "Retrieves a raw data value from abilities, heroes, or items."
"description": "Retrieves a raw data value from abilities, heroes, items, or console variables."
}
}
</templatedata>
</templatedata>
Line 52: Line 54:


Grit's barrier lasts {{DataProp|Grit|BarrierDuration}}s.
Grit's barrier lasts {{DataProp|Grit|BarrierDuration}}s.
=== Convar ===
<code>The default camera field of view is &#123;&#123;DataProp|Convar|citadel_camera_fov&#125;&#125;.</code>
The default camera field of view is {{DataProp|Convar|citadel_camera_fov}}.


=== Errors ===
=== Errors ===
Line 65: Line 72:


{{DataProp|Abrams|FakeProp}}
{{DataProp|Abrams|FakeProp}}
If the convar does not exist:
<code>&#123;&#123;DataProp|Convar|fake_convar&#125;&#125;</code>
{{DataProp|Convar|fake_convar}}


<includeonly>[[Category:Data templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
<includeonly>[[Category:Data templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>