Template:KeyValue: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Quotes break the tooltip. (Used Special:ExpandTemplates to see the problem.) Used its style parameter to avoid having to box {{tooltip}} inside another span to apply additional style. Dotted is not a parameter.)
No edit summary
 
(27 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Lang}}
{{cleanup|Purge unused {{param|new}} formatting.}}
{{doc}}
{{doc}}
<includeonly><onlyinclude>{{#if:{{{new|}}}{{{sectiontitle|}}}||{{#switch:{{{1|}}}|start|divider|end=|<!--
 
-->; {{#if: {{{deprecated|}}} | <del> }}<!--
<includeonly>
 
<onlyinclude>
; {{#if: {{{deprecated|}}} | <del> }}<!--
-->{{{1}}}<!--
-->{{{1}}}<!--
--> {{#if: {{{intn|}}} | <code>{{Tooltip|style=font-weight:normal|{{KV/strings|KeyHelp}}|({{{intn}}})}}</code>| <code>{{Tooltip|style=font-weight:normal; color:red|Non-SmartEdit KV name ('intn') not defined|(???)}}</code> }} <!--
--> {{#if: {{{intn|}}} | {{#ifeq: {{{intn}}}|0||<kbd>{{Tooltip|style=font-weight:normal|{{KV/strings|KeyHelp}}|({{{intn}}})}}</kbd> }}| <small><kbd>(<abbr title="Non-SmartEdit KV name ('intn') not defined, see Template:KV documentation" style="color:#8BC53F;font-weight:lighter">[todo internal name [[Template:KeyValue#Examples_and_Parameters|(i)]]]</abbr>)</kbd></small> [[Category:Pages with undefined internal keyvalue names]] }} <!--
-->{{#if: {{{to|}}}{{{intn2|}}} | <span style="font-weight: normal;">to</span> {{{to}}}<!--
-->{{#if: {{{to|}}}{{{intn2|}}} | <span style="font-weight: normal;">to</span> {{{to}}}<!--
   -->{{#if:{{{intn2|}}} | &nbsp;<code>{{Tooltip|style=font-weight:normal|{{KV/strings|KeyHelp}}|({{{intn2}}})}}</code>}} <!--
   -->{{#if:{{{intn2|}}} | &nbsp;<kbd>{{Tooltip|style=font-weight:normal|{{KV/strings|KeyHelp}}|({{{intn2}}})}}</kbd>}} <!--
-->}} <!--
-->}} <!--
-->{{#if: {{{2|}}} | {{KV Type|{{{2}}}}} }}<!--
-->{{#if: {{{2|}}} | {{KV Type|{{{2}}}}} }}<!--
-->{{#if: {{{deprecated|}}}| </del> }}<!--
-->{{#if: {{{deprecated|}}}| </del> }}<!--
-->{{#if: {{{only|}}}      | &nbsp;{{#ifexist: Template:{{{only}}} only | {{{{{only}}} only}} | {{only|{{{only}}}}}}} }}<!--
-->{{#if: {{{only|}}}      | &nbsp;{{only|{{IO/gameicon|{{{only}}}}}}}}}<!--
-->{{#if: {{{since|}}}    | &nbsp;{{#ifexist: Template:{{{since}}} add | {{{{{since}}} add}} | {{since|{{{since}}}}}}} }}<!--
-->{{#if: {{{since|}}}    | &nbsp;{{since|{{IO/gameicon|{{{since}}}}}}}}}<!--
-->{{#if: {{{removed|}}}  | &nbsp;{{removed|{{{removed}}}}} }}<!--
-->{{#if: {{{removed|}}}  | &nbsp;{{removed|{{IO/gameicon|{{{removed}}}}}}}}}<!--
-->{{#if: {{{not|}}}      | &nbsp;{{#ifexist: Template:{{{not}}} not | {{{{{not}}} not}} | {{not|{{{not}}}}}}} }}<!--
-->{{#if: {{{not|}}}      | &nbsp;{{not|{{IO/gameicon|{{{not}}}}}}}}}<!--
-->{{#if: {{{also|}}}      | &nbsp;{{#ifexist: Template:{{{also}}} also | {{{{{also}}} also}} | {{also|{{{also}}}}}}} }}<!--
-->{{#if: {{{also|}}}      | &nbsp;{{also|{{IO/gameicon|{{{also}}}}}}}}}<!--
-->{{#if: {{{game|}}}     | &nbsp;{{{game}}}}}<!--
-->{{#if: {{{nofgd|}}}    | &nbsp;{{Not in FGD}} }}<!--
-->{{#if: {{{nofgd|}}}    | &nbsp;{{Not in FGD}} }}<!--
-->{{#if: {{{deprecated|}}} | &nbsp;{{obs}} }}
-->{{#if: {{{deprecated|}}} | &nbsp;{{obs}} }}{{{addtext|}}}
: {{#if: {{{deprecated|}}} | {{KV/strings|Deprecated}}&nbsp; }}<!--
: {{#if: {{{deprecated|}}} | {{Dictionary/Deprecated/{{language}}}}{{period}}<br> }}<!--


-->{{#if: {{{3|}}} | {{{3}}}}}<!--
-->{{#if: {{{3|}}} | {{{3}}}}}<!--
--></onlyinclude>


-->}}}}<!--
</includeonly>
 
New:
 
-->{{#switch:{{{1|}}}
|start=<table cellpadding="4" width="100%" style="border:1px solid #525252">
<tr style="z-index:100; background-color:#949494; box-shadow:0 2px 0 rgb(38 38 38); color:#141414; position:sticky; margin-bottom:2px; top:0;">
<th width="8%" style="box-shadow:2px 0 rgb(38 38 38)">{{KV/strings|Key}} <span style="opacity:.7; user-select:none; cursor:help" title="{{KV/strings|KeyHelp}}">(?)</span></th>
<th width="8%" style="box-shadow:2px 0 rgb(38 38 38)">{{KV/strings|Variable}}</th>
<th>{{KV/strings|Source}} <span style="opacity:.7; user-select:none; cursor:help" title="{{KV/strings|SourceHelp}}">(?)</span></th>
<th width="10%" style="box-shadow:2px 0 rgb(38 38 38)">{{KV/strings|PropertyName}}</th>
<th width="10%" style="box-shadow:2px 0 rgb(38 38 38)">{{KV/strings|DefaultValue}}</th>
<th>{{KV/strings|Desc}}</th>
</tr>
|}}<!--
 
Section title:
 
-->{{#if:{{{sectiontitle|}}}|<tr><td colspan="6" bgcolor="#303030" align="center"><h3 style="font-size:1em; color:#b9b7b5; padding:0; margin:2px 0">{{{sectiontitle|}}}</h3></td></tr>|}}<!--
 
Divider:
 
-->{{#switch:{{{1|}}}|divider=<tr><td colspan="6" bgcolor="#303030" align="center"><span style="pointer-events:none; user-select:none">&nbsp;</span></td></tr>|}}<!--
 
Text input:
 
-->{{#if:{{{new|}}}
|<tr bgcolor="#{{#if:{{{deprecated|}}}|423333|3a3a3a}}">
<td bgcolor="#{{#if:{{{deprecated|}}}|423333|363636}}" align="center"><kbd>{{{1|}}}{{#if:{{{toKey|}}}|&nbsp;<span style="opacity:.7">to</span> {{{toKey|}}}|}}</kbd></td>
<td align="center">{{KV Type|{{{2}}}}}</td>
<td align="center">{{#if:{{{src|}}}|'''{{{src|}}}'''}}</td>
<td>{{{3|}}}{{#if:{{{toPN|}}}|&nbsp;<span style="opacity:.7">to</span> {{{toPN|}}}|}}</td>
<td align="center" {{#if:{{{color|}}}|style="background-color:rgb({{{color|}}}); color:{{#switch:{{{color|}}}|255 255 255=#141414|}};"|}}>{{{color|{{{value|}}}}}}{{#if:{{{rawValue|}}}|<div>{{Code|{{{rawValue|}}}}}</div>|}}</td>
<td style="padding:0"><div style="max-height:240px; box-sizing:border-box; overflow-y:auto; padding:4px"><!--
--><div style="display:flex; align-items:center; flex-wrap:wrap; gap:6px"><!--
-->{{#if: {{{deprecated|}}} | {{obs|4}} }}<!--
-->{{#if: {{{only|}}} | {{#ifexist: Template:{{{only}}} only | {{{{{only}}} only}} | {{only|{{{only}}}}}}} }}<!--
-->{{#if: {{{since|}}} | {{#ifexist: Template:{{{since}}} add | {{{{{since}}} add}} | {{since|{{{since}}}}}}} }}<!--
-->{{#if: {{{removed|}}} | {{removed|{{{removed}}}}} }}<!--
-->{{#if: {{{not|}}} | {{#ifexist: Template:{{{not}}} not | {{{{{not}}} not}} | {{not|{{{not}}}}}}} }}<!--
-->{{#if: {{{also|}}} | {{#ifexist: Template:{{{also}}} also | {{{{{also}}} also}} | {{also|{{{also}}}}}}} }}<!--
-->{{#if: {{{nofgd|}}} | {{Not in FGD}} }}<!--
--></div>{{{4|}}}</div></td>
</tr>|}}<!--
 
End:
 
-->{{#switch:{{{1|}}}|end=</table>|}}</onlyinclude></includeonly>

Latest revision as of 16:03, 5 June 2025

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history
Icon-translate.png
This template uses a strings subpage
Please follow the format on this subpage(s) to add translations.

This template is used to generate Keyvalue definitions on entity pages.

Usage

{{KV|<name>|<variable type>|<description>}}
Note.pngNote:Don't forget to use Template:= to escape any "=" characters in the text.

Examples and Parameters

Parameter Description Example Preview
deprecated This Keyvalue is deprecated and should no longer be used.
{{KV|I'm deprecated|intn=deprecated|string|Really, don't use me anymore!|deprecated=1}}
I'm deprecated (deprecated) <string> Obsolete
Deprecated.
Really, don't use me anymore!
nofgd This Keyvalue isn't available in the official FGD.
{{KV|Add me to the FGD|intn=addfgd|boolean|Because I'm not there!|nofgd=1}}
Add me to the FGD (addfgd) <boolean> !FGD
Because I'm not there!
intn The internal/engine name for this Keyvalue.
Required; if absent, the page will display green todo text and applies Category:Pages with undefined internal keyvalue names. You can look for internal names in fgds. If internal name doesn't need to be specified use intn=0.
{{KV|Name|intn=targetname|string|The name that other entities refer to this entity by.}}</nowiki><br/><nowiki>
{{KV|Name|string|The name that other entities refer to this entity by.}}
Name (targetname) <string>
The name that other entities refer to this entity by.
Name ([todo internal name (i)]) <string>
The name that other entities refer to this entity by.
since This Keyvalue is available since this game. Can use either {{<game> add}} or {{Since}} templates.
{{KV|I like Alien Swarm|intn=likealienswarm|bool|I'm available in Portal 2, too!|since=AS}}
I like Alien Swarm (likealienswarm) <boolean> (in all games since Alien Swarm)
I'm available in Portal 2, too!
also This Keyvalue is also available in this game. Can use either {{<game> also}} or {{Also}} templates.
{{KV|I like Alien Swarm|intn=likealienswarm|bool|I'm also available in Garry's Mod!|since=AS|also=GMOD}}
I like Alien Swarm (likealienswarm) <boolean> (in all games since Alien Swarm) (also in Garry's Mod)
I'm also available in Garry's Mod!
only This Keyvalue is available only in this game. Can use either {{<game> only}} or {{Only}} templates.
{{KV|I love Alien Swarm|intn=lovealienswarm|integer|I'm only available in Alien Swarm!|only=AS}}
I love Alien Swarm (lovealienswarm) <integer> (only in Alien Swarm)
I'm only available in Alien Swarm!
not This Keyvalue is not available just in this game. Only uses the template {{Not}}.
{{KV|I love Alien Swarm|intn=lovealienswarm|integer|I'm available in Portal 2 too, but not in CS:GO!|since={{as}}|removed={{csgo}}}}
I love Alien Swarm (lovealienswarm) <integer> (in all games since Alien Swarm) (not in Counter-Strike: Global Offensive)
I'm available in Portal 2 too, but not in CS:GO!
removed This Keyvalue was removed in this game onwards. Only uses the template {{Removed}}.
{{KV|I love Alien Swarm|intn=lovealienswarm|integer|Actually... I'm not here anymore since Portal 2, including CS:GO...|since={{as}}|removed={{csgo}}}}
I love Alien Swarm (lovealienswarm) <integer> (in all games since Alien Swarm) (removed since Portal 2)
Actually... I'm not here anymore since Portal 2, including CS:GO...
to Use this to define a set of Keyvalues with very similar names. Use intn2 for the second keyvalue's internal name.
{{KV|Sound 01|intn=Sound01|to=Sound 24|intn2=Sound24|string|There are many of us...}}
Sound 01 (Sound01) to Sound 24 (Sound24) <string>
There are many of us...

See also