Help:Templates

From Valve Developer Community
Jump to: navigation, search
English (en)русский (ru)
Edit
Edit-copy.png
This is a help page
That means that this article contains information intended to advise or aid on the functions of the wiki, on how to use the wiki, or on general recommendations for users of the wiki.
Icon-broom.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

A template is a wiki page created to be included in other pages. Templates usually contain repetitive material that might need to show up on a larger number of articles or pages. They are commonly used for boilerplate messages, standardized warnings or notices, infoboxes, navigational boxes, and similar purposes.

They enable you to do things much faster and/or easier. Templates are used very frequently on pages, so it’s best to learn about them. When the wiki sees a template it recognizes on a page, it will automatically replace it with something else. What appears there is up to the users.

How to use a Template

To add a template to a page (which is called transcluding), simply type {{, the name of the template, and then }}. If you wish to add any parameters, put a | between the template's name and the }}, and define the parameters there. All parameters you define need to be separated by another |.

Note.pngNote:Any page can be transcluded by another one actually. A transclusion of the Main Page can be done using {{:Main Page}}, but we don't do this here because it would add all of the headlines of the Main Page to the table of contents of this page.

Examples

Here’s a template where we don’t define any parameters. When previewing, the expression {{restart}} (or {{Restart}}) will be replaced with the content of the page Template:Restart. If you visit it, you’ll see that it contains just those five words.

{{restart}} → Requires restart to take effect.
Note.pngNote:Below is an example with the sv_cheats console command, which is wrong, because it is not an entity. Please use {{Command}} for console commands.

{{Ent}} can accept up to two unnamed parameters. As described on its page, the template works in a way that it will display the value of the first parameter in a monospace font and also making it a wikilink. Suppose we want a code style link to sv_cheats; To use this template, we type {{, followed by the template name which is ent or Ent, then for the first parameter we type a pipe and the value sv_cheats. If we want to, we can also specify a second parameter which (as the template specifies) will also be displayed in code style but not as a link. The order of unnamed parameters matters. If we specify no parameter, the template doesn't work as intended.

{{ent|sv_cheats}}sv_cheats
{{ent|sv_cheats|1}}sv_cheats 1
{{ent}}[[{{{1}}}|{{{1}}}]]

Template:KV is one of the most common templates used to display information about a keyvalue of an entity class. It accepts multiple optional named parameters such as only and nofgd. To specify a value for those, we need to type the name of the parameter, an equals sign and then the value. Named parameters can be defined in any order. Note that we can specify both unnamed and named parameters. In the following example, we have three unnamed parameters (ammo, integer and the last one) and two named parameters (only={{css}} and nofgd=1).

{{KV|only={{css}}|ammo|nofgd=1|integer|Amount of reserve ammo to be added. Fallback value is 0.}}
ammo <integer> (only in Counter-Strike: Source) !FGD
Amount of reserve ammo to be added. Fallback value is 0.

Without the |nofgd=1, the !FGD part would not have displayed.

Note.pngNote:Unnamed parameters can be specified like named parameters in any order, like so: {{ent|2=1|1=sv_cheats}}sv_cheats 1. In fact, unnamed parameters do have a name they can be defined with, namely their parameter number. This way one could also for example specify a third parameter but not a first and second.
Note.pngNote:When calling a template, you can always specify any number of named and unnamed parameters. The only question is whether the template regards them or not, yielding a different result or the same. By the way, specifying a parameter multiple times displays an error at the top of the page.

Templates can also use templates, named nesting. Recursion is not supported, so a template cannot use itself.

Substitution

This is for advanced users. Instead of transcluding a template, one can choose to substitute it. Substitution will replace the wikitext of a template call with the contents of the template. Do not substitute carelessly, because the substituted wikitext will not be updated when the template is. See Wikipedia:Help:Substitution for more information.

To substitute a template, transclude it like you normally would, then add subst: between {{ and the template's name. After that, click the save button and the wikitext will automatically be added.

For example, if you write {{restart}} on a page, save it, and edit the page again, you will still find {{restart}} at the same place in the wikitext. In contrast, if you save {{subst:restart}} and edit the page again, you'll find Requires restart to take effect. instead. It can be imagined that the wiki "copy-pastes" the content over, but it does regard parameter values:

{{subst:delete|This is a bad page.}}

If a page is saved with this, that text will be replaced with the content of Template:Delete where every occurrence of {{{1}}} is replaced with This is a bad page.:

{{Delete-meta|{{#if: This is a bad page. | This is a bad page. }} }}[[Category:Candidates for speedy deletion]]

Note the automatic forwarding of parameters. When substituting, the page should not appear any differently than it would if transcluded. The only difference is in the page code.

Tip.pngTip:When editing, be sure to make use of View Changes before saving substitutions to see what you're actually doing to the wikitext.

Making Templates

Before a template can be added somewhere, first its contents must be defined on its own page. Template pages start with the prefix Template:. See also: Help:Page Creation.

Making a template like Template:Restart is rather easy: Enter Template:Restart in the search bar in the top right, click on its red link (assuming the page doesn't exist yet), type the text you want, and save it. After that, this new template can be used as described above.

Tip.pngTip:When making templates, you may want to space out your code to make it easier to read, but watch out for unintentional whitespace, especially newlines. HTML comments (<!-- -->) can also be useful.
Note.pngNote:Named parameters (such as {{{title}}}) will have leading and trailing whitespace trimmed in the template's result, unnamed parameters (such as {{{1}}}) will not.

Unnamed Parameters

To add an unnamed parameter, simply put {{{1}}} wherever you want the value of the first unnamed parameter to be. Here's a part of the code for Template:Tip:

Tip:{{{1}}}

If you've seen this template before you know that it has its own special look, but this is all we will look at for now. All the user has to do when transcluding this is enter the text they want:

{{tip|Do not carve without vertex editing afterward.}}
Tip.pngTip:Do not carve without vertex editing afterward.

If you want to add more than one unnamed parameter, simply change the number. Here's the old (condensed) code for Template:Distinguish. This template has some things we haven't talked about yet, but you can still see that there's four unnamed parameters used: {{{1}}}, {{{2}}}, {{{3}}}, and {{{4}}}.

:''Not to be confused with [[:{{{1}}}]]{{#if:{{{2|}}} |{{#if:{{{3|}}} |, [[:{{{2}}}]]| or [[:{{{2}}}]].}}|.}}{{#if:{{{3|}}} |{{#if:{{{4|}}} |, [[:{{{3}}}]]|, or [[:{{{3}}}]].}}}}{{#if:{{{4|}}} |, or [[:{{{4}}}]].}}''

All the user has to do when transcluding is this:

{{distinguish|Combine|Civil Protection|Overwatch}}
Not to be confused with Combine, Civil Protection or Overwatch.

Named Parameters

Usually you would want to have named parameters affect anything only if they are defined when being transcluded. We'll talk about conditions later. For now, let's look at Template:IO, which has many named parameters. In this template, {{{param}}} marks a place to add wikitext that's defined by |param=texthere when transcluding.

With named parameter:

{{IO|SetString|Updates the string.|param=string}}
SetString <string>
Updates the string.

Without named parameter:

{{IO|SetString|Updates the string.}}
SetString
Updates the string.

Default Value

To make a parameter have a value by default, add a | to the right of the parameter name, and then define the default value. Both named and unnamed parameters can use this.

This would set the value for {{{1}}} to 3000 if the user does not specify it.

{{{1|3000}}}


This returns the empty string if the user does not specify |value=.... Note the difference between {{{value}}} and {{{value|}}}. The former would literally return the text {{{value}}} if the user doesn't define it.

{{{value|}}}
Note.pngNote:Specifying a default value for a parameter applies only to that specific occurrence of the parameter. If you have multiple occurrences of {{{1}}} and all of them should have the default value of 0, then you must type {{{1|0}}} for all of them. On the other hand, this allows you to use different default values at different occurrences, if appropriate.

Parser Functions

To make text (dis)appear only if a certain parameter is defined or set to a specific value, the following expressions are the way to go.

The parser function #if: checks if a string is empty or not. The syntax is {{#if: <string> | <then> | <else> }}. This expression evaluates to <then> iff <string> is not the empty string, otherwise to <else>. The <else> value can be omitted in which case it defaults to the empty string; The same applies to the following <else>s.

{{#if:   | Not empty | Empty }} → Empty
{{#if: X | Not empty | Empty }} → Not empty
{{#if:   | Not empty }}
{{#if: X | Not empty }} → Not empty
{{#if: {{{target|}}} | Target aqcuired | Sleep mode activated... }} → Sleep mode activated...
{{#if: Something is there! | Target aqcuired | Sleep mode activated... }} → Target aqcuired
Note.pngNote:The expression {{{target|}}} returns the empty string because you (probably) are not viewing this page through a transclusion, so it's never had a chance to be defined and thus returns its default value being the empty string.

#ifeq: checks for equality between two strings. The syntax is {{#ifeq: <string1> | <string2> | <then> | <else> }}. This evaluates to <then> iff the two (trimmed) strings are entirely equal, otherwise to <else>.

{{#ifeq: X | X | Equal | Not equal }} → Equal
{{#ifeq: X | Y | Equal | Not equal }} → Not equal
{{#ifeq: {{{target|}}} | friend | Friend... | Go away! }} → Go away!
{{#ifeq: friend | friend | Friend... | Go away! }} → Friend...

#switch: checks for equality between an input string and multiple strings. The syntax is {{#switch: <input> | <string1> = <value1> | <string2> = <value2> | ... | #default = <default> }}. This statement evaluates to the corresponsing <valueX> of the first <stringX> that equals the <input>. If that <stringX> is not followed by an equals sign such that there is no <valueX>, then the <valueY> of the next <stringY> that does have an equals sign is used instead. If no equality is found, <default> is returned which defaults to the empty string if not specified.

#expr: solves math problems. See Help:Calculation for all it's abilities. If an error occurs, a string within a <strong class="error"> element is returned.

{{#expr: 2 + 2}} → 4
{{#expr: cos(pi/3)^2}} → 0.25
{{#expr: 0 and 1 or 1}} → 1
{{#expr: 1 + }}Expression error: Missing operand for +.
{{#ifeq: {{#expr: 1 + }} | 1 | True | False}} → False

#ifexpr: tests whether a math expression is true or false and can returns different values depending on it.

{{#ifexpr: 6 + 3 =  9 | Right | Wrong }} → Right
{{#ifexpr: 6 + 3 = 63 | Right | Wrong }} → Wrong
Warning.pngWarning:When passing parameters to the expression, pay attention not to get errors if the parameter is empty. For example, if an integer parameter should behave like 0 if it is left empty, add a decimal point because . is converted to the same zero as 0..

For example, use {{{hl2|0}}}. instead of {{{hl2|0}}} because the latter may fail if hl2= is specified:

{{#ifexpr: 1 or . | True | False}} → True
{{#ifexpr: 1 or   | True | False}}Expression error: Missing operand for or.

lc: and uc: convert a string to lower case or upper case. Note that these don't have a hash sign as opposed to #if: and so on. There is also lcfirst: and ucfirst: that only manipulate the first character of the expression.

{{lc:Case Sensitivity}} → case sensitivity
{{uc:Case Sensitivity}} → CASE SENSITIVITY
{{lcfirst:Case Sensitivity}} → case Sensitivity

Documentation

Please give a description of what your template does, and especially examples. To keep describing text from appearing on pages that use the template or to make the template page itself look cleaner, there are three different HTML tags you can use.

  • <noinclude>...</noinclude> prevents wikitext from from being transcluded to other pages. It will show only on the template's page.
  • <onlyinclude>...</onlyinclude> makes only wikitext inside it appear on destination pages. Everything else is not transcluded but will still appear on the template's page.
  • <includeonly>...</includeonly> prevents wikitext inside from appearing on the template's page. It has no effect on the destination page.

So you can either surround everything that should be transcluded with <onlyinclude> or surround everything else with <noinclude>. In addition, you can use <includeonly> to hide the template text on the template page. The tags can sound very confusing at first. If you're confused on how to use them, check the source code for a template, because almost all use them for one purpose or another.

If the documentation cannot be kept short, then it is a good idea to move all explanations and/or examples to an own page. By convention, the documentation page of a template should be its subpage /doc. For instance, Template:Note has its documentation page Template:Note/doc. When created, the documentation is transcluded to the template page using just the expression {{doc}} which of course must be excluded using the above tags.

Sometimes, templates are used identically. As you might know, Template:Tip and Template:Note both use their one parameter in exactly the same manner, so there is no need for another page with an identical documentation for Tip. Tip can use the same documentation as Note using the expression {{documentation|Template:Note/doc}}; The only magic behind this is that Template:Note/doc uses the expression {{ROOTPAGENAME}} instead of Note for its examples so that the examples adapt to the page that they are displayed on. If Template:Note/doc wasn't made for this, this wouldn't work out. Other "generic docs" like this that are in use are Template:Hl2 and Template:Yes.

Templates not updating

If you've recently edited a template and the changes are not applying on pages that it's been transcluded to, add ?action=purge at the end of the URL for those pages. This will tell the server to update the page's HTML immediately. You can achieve the same effect by editing a page and saving it without making any changes. If you're on a template page with a documentation, you can also use the "[purge]" button for the same effect.

Template Shortcuts

Some templates may have template shortcuts, which are redirects that are abbreviated or otherwise different forms of their target templates. Template shortcuts can be transcluded just like their target templates.

Translations

Templates should include translations so that people who natively speak other languages can more easily understand the contents of the template. There are two ways this can be accomplished.

Method One: {{Autolang}}

This is usually used on smaller templates with little text. This template automatically detects the language of the UI and gives the appropriate translation, if available. This is usually sufficient, however on larger templates it is usually recommended to use Method Two.

Method Two: Strings Subpage

Larger templates (e.g. {{Software page}}) tend to have large amounts of text, and having them all on one page makes it pointlessly cluttered and very hard to edit. To solve this, almost all text on these templates go on a Strings Subpage (e.g. {{Software page/strings}}), which, when a specific string is specified, will present the appropriately translated text. This helps make not only text editing but translating much easier because editors don't have to shift through lots of code to find a small bit of text they want to edit/translate. This can he very complicated for smaller templates however, so it is usually reserved for larger templates.

Tip.pngTip:You may see some templates still using the old suffix translation method. Keep in mind that this is no longer the preferred method and, if you know how, should be updated to use the current methods.

Useful Templates

All templates in green text are that color so that they stand out against the greyscale tones of most pages. Most templates with that color also automatically add pages they are transcluded on into Category:TODO.

Per-game Templates

All games have templates named by their shortcut that can deliver their associated icon and/or a link to their page. See Category:Game icons for a full list of game shortcuts. All of them accept the same set of parameters that are described on every template page. The following table should give examples and also give ideas on when to use them.

Wikitext Example Description Formerly used template/Alternatives
{{<shortcut>}} {{hl2}} Half-Life 2 Displays the game's icon which links to its game's page and shows the game's name as a hover text. Putting this at the beginning (or end) of a word or line is the shortest and most common way of clarifying that something applies only to a specific game, but there are more ways.
{{<shortcut>|2}} {{hl2|2}} Half-Life 2 Half-Life 2 Displays the game's icon followed by its name which both link to the game's page. Useful in sentences when the icon alone is too little but the next style is too much. {{game link}} [Obsolete-notext.png Deprecated]
{{<shortcut>|4}} {{hl2|4}} Half-Life 2 Half-Life 2 Does the same but using colorful text which grabs more attention, so don't overuse this on a page. Especially if you name the same game multiple times in a text, you definitely don't need a long, colorful link every time, let alone a link. {{game name}} [Obsolete-notext.png Deprecated]
{{<shortcut>|in}} {{hl2|in}} (in Half-Life 2) Can be used to indicate that something applies to a specific game. Useful at the end of a line or key word; The same applies to the following variants. {{in}}
{{<shortcut>|since}} {{portal2|since}} (in all games since Portal 2) Can be used to quickly note features that were added in a game and are available in all Source games afterwards. {{since}}
{{<shortcut>|only}} {{csgo|only}} (only in Counter-Strike: Global Offensive) Indicates features that are exclusive to a specific game. {{only}}
{{<shortcut>|also}} {{as|since}} {{gmod|also}} (in all games since Alien Swarm) (also in Garry's Mod) Notes that earlier game also has a feature, usually backported from newer engine branches. These should be used with in conjunction with another game notice template. {{also}}
{{<shortcut>|removed}} {{l4d|removed}} (removed since Left 4 Dead) Indicates that a feature was removed in a game and all later engine branches. {{removed}}
{{<shortcut>|not}} {{czds|not}} (not in Condition Zero Deleted Scenes) Indicates that a feature might be in other games but not in a specific one. {{not}}

Inline Note Templates

The following are some of the inline note templates.

Description Wikitext and Result
Template:Bug notifies readers of a bug. {{bug|The amount is double what it should be. Be careful!}}
Icon-Bug.pngBug:The amount is double what it should be. Be careful!
Template:Clarify marks things that should be clarified. PAS is a kind of bounding-box for Player or NPC AI sound detection.{{clarify}}
PAS is a kind of bounding-box for Player or NPC AI sound detection.[Clarify]
Template:Confirm marks something that needs to be confirmed. It's green color is meant to stand out. {{confirm|Always goes to the left.}}
Confirm:Always goes to the left.
Always goes to the left.{{confirm}}
Always goes to the left.[confirm]
Template:Distinguish lets you notify users about pages that share similar names or may be confused for something else. {{distinguish|"Follow Freeman!"|desc1=The HL2 chapter}}
Not to be confused with "Follow Freeman!" (The HL2 chapter).
Template:How asks the question how? Players can get past these.{{how}}
Players can get past these.[How?]
Template:Idea is a nifty way to suggest ideas. {{idea|Reward players for being clever and creative, instead of forcing things to be only one way.}}
Idea: Reward players for being clever and creative, instead of forcing things to be only one way.
Template:Main notes that there is a more detailed article about a certain topic. {{main|Soundscripts}}
Main article:  Soundscripts
Template:Note is for making notes stand out more. {{note|This will spawn at the map origin if you do not specify the position.}}
Note.pngNote:This will spawn at the map origin if you do not specify the position.
Template:Question denotes a question {{question|Does this work in newer engine branches?}}
Question.png Question: Does this work in newer engine branches?
Template:Suggestion is for suggesting something {{suggestion|Levels should be optimized for peak performance.}}
Comment.pngSuggestion: Levels should be optimized for peak performance.
Template:Tip marks text as a tip to readers. {{tip|This is a much less tricky process when using the vertex edit tool as well.}}
Tip.pngTip:This is a much less tricky process when using the vertex edit tool as well.
Template:Todo marks things that need to be done. It's green color is meant to stand out. {{todo|Find where this is in the game files.}}
To do: Find where this is in the game files.
Template:Warning marks things that readers should take caution of when doing something. {{warning|This tool has been known to corrupt files. Try an alternative listed below.}}
Warning.pngWarning:This tool has been known to corrupt files. Try an alternative listed below.
Template:Workaround informs readers of a workaround {{workaround|This should be automated with logic instead.}}
PlacementTip.pngWorkaround: This should be automated with logic instead.
Template:Why asks the question why? This shader has been deprecated.{{why}}
This shader has been deprecated.[Why?]

Notice Templates

The following is a list of some notice templates.

Description Wikitext and Result
{{Cleanup}} marks a page that needs to be fixed up, preferably by someone knowledgeable. The text message is optional. If you do not give sufficient reason for the notice on the transclusion or the talk page, expect it to be removed by someone else. {{cleanup|The last section needs to be clarified.}}
Icon-broom.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
The last section needs to be clarified
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
{{Delete}} marks a page that should be deleted. If you do not give sufficient reason for the notice on the transclusion or the talk page, expect it to be removed by someone else. When putting this on a page, you should also list the reason on that page's talk page, for any future readers that may want to know the purpose of the deletion. {{delete}}
Warning icon.png
This help page has been marked as a candidate for speedy deletion.
If you object to this decision, then please discuss why hereIf this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators - Remember to check if anything links here and the page history (last edit) before deleting.
{{Merge}} is a notice that notifies editors that it's been suggested for two or more pages to be combined into one. All merges should be discussed before being done. {{merge|HDR}}
Merge-arrows.png
It has been suggested that this article or section be merged with HDR. (Discuss)
{{Messagebox}} provides a standard message box. This template is used by many notice templates. {{messagebox|text=Remember to follow wiki etiquette.}}
{{Metanotice}} is a modernized alternative to {{Messagebox}}. Its syntax is simple but very modular. {{metanotice|text=Is this what you are looking for?}}
Icon-help.png
Is this what you are looking for?
{{Morescreenshots}} marks pages that should have more images on them. It allows for an optional text message to clarify what needs images. {{morescreenshots|$envmapcontrast, $envmapsaturation}}
{{Obsolete}} marks things that should no longer be used. Accepts three parameters, entity, tool, and shader. {{obsolete|entity=1}}
{{Spammer}} marks users that should be banned for spamming. For suspicious but not bannable behavior, there is also Template:Minor Spammer.
Icon-Bug.pngBug:This template's formatting may look weird sometimes. It's intended to be the only thing on a page.
{{spammer}}
Spammer.jpg
Note.pngNote:This user is a spammer, vandal or other problem poster and should be considered for a ban

{{Banned user}} marks users that have been banned (usually by Valve employees) for spamming, vandalizing pages, edit warring or trolling along with many other reasons. {{Banned user}}
Icon-crystalclear-flag.png
This user has been banned for an unspecified reason, such as Wikipedia icon spamming, Wikipedia icon vandalism, Wikipedia icon copyright violations, Wikipedia icon sockpuppetry, Wikipedia icon edit warring, trolling or Wikipedia icon harassment, and/or violating the Valve Developer Community's Terms of Use along with other misbehavior.
{{Split-apart}} marks pages that should be split into multiple pages. All splits should be discussed before being done. {{split-apart}}

Split-arrows.png Split

It has been suggested that this article or section be split into multiple articles. (Discuss)

{{Stub}} marks pages that are very small. See Help:Stubs for info on using. {{stub}}

Stub

This article or section is a stub. You can help by adding to it.

{{Translate}} marks pages where translation is needed and adds the page to a category. {{Translate}}
Info content.png
This page needs to be translated.

This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.

Also, please make sure the article tries to comply with the alternate languages guide.
{{Update}} marks outdated pages. {{update}}
Icon-broom.png
This article or section needs to be updated to include current information regarding the subject.
Remember to check for any notes left by the tagger at this article's talk page.
{{Wip}} marks pages that are in the middle of major edits. The adder requests that other users do not edit in the meantime. {{Wip}}
Under construction.png
This Help is actively undergoing a major edit.
As a courtesy, please do not edit this Help while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.


{{Draft}} marks pages that are currently being worked on. {{draft}}
Under construction icon-blue.png
This is a draft help page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.


Miscellaneous Templates

These templates have the purpose of helping the editor.

Description Wikitext and Result
Template:= is a template that only returns an equal sign. The character is sometimes needed because multiple wiki features make use of it. Especially, the equals sign is a special character in template calls, so if an equals sign should be passed as a parameter value, then {{=}} is needed for "escaping". For the same purpose, there is also Template:! for a pipe, Template:((( for curly brackets and many more, see Category:Templates for within templates. {{=}}
=
{{note|If x {{=}} 0, you lose.}}
Note.pngNote:If x = 0, you lose.
Template:Clr clears the vertical space to the left and right of floating tables, floating images etc. To clear only one side, use {{clr|left}} or {{clr|right}}. This is commonly used before headlines to push them down so that they don't appear next to an image. In the example on the right, one could also use {{clr|left}} for the same effect. [[File:Skull and crossbones.png|50px|left]] This text is next to the image.{{clr}}This text is below the image.

Skull and crossbones.png
This text is next to the image.
This text is below the image.
Template:Ent is a really small template for making text that's both code and a link. {{ent|noclip}}
noclip
Template:Expand or Template:ExpandBox allows you to hide stuff inside a box that can be shrunk down so that it doesn't make pages as long. {{Expand|{{KV BaseEntity|noscroll=1}}}}

Base:
Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.pngTip:Entities transition to the next map with their parents
Tip.pngTip:phys_constraint can be used as a workaround if parenting fails.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.pngNote:Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.pngNote:This works on brush entities, although Hammer doesn't show the new angles.
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Tip.pngTip:Changing this on runtime still has use, like making matching an entry in S_PreserveEnts will persist the entity on new rounds!
Flags (spawnflags) <flags> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <flags> !FGD
Combination of effect flags to use.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the worldspawn entity will be placed in root scope.
Think function (thinkfunction) <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Is Automatic-Aim Target (is_autoaim_target) <boolean> (in all games since Counter-Strike: Global Offensive) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.
{{ExpandBox|{{KV BaseEntity|noscroll=1}}}}


Base:
Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.pngTip:Entities transition to the next map with their parents
Tip.pngTip:phys_constraint can be used as a workaround if parenting fails.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.pngNote:Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.pngNote:This works on brush entities, although Hammer doesn't show the new angles.
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Tip.pngTip:Changing this on runtime still has use, like making matching an entry in S_PreserveEnts will persist the entity on new rounds!
Flags (spawnflags) <flags> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <flags> !FGD
Combination of effect flags to use.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the worldspawn entity will be placed in root scope.
Think function (thinkfunction) <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Is Automatic-Aim Target (is_autoaim_target) <boolean> (in all games since Counter-Strike: Global Offensive) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.
Template:MultiPage is used for translations, which replaced the deprecated {{Lang}} template, which stands for language. This page itself uses the MultiPage template, using the wikitext {{MultiPage}}, and with the {{Language subpage}} template added to the language subpages (for example, it is located in Help:Templates/en for English language, containing everything else with the {{Language subpage}} template on top).

The {{MultiPage}}, and it's predecessor, {{Lang}} template creates flags at the top right corner of a page such as English (en) русский (ru) 中文 (zh) and thus must be the first template to be transcluded to be in the right position.

Every page can and should use this template as it lets the reader know of the existence of (correctly titled) language pages of the current page and clicking on the flags links to them. Read more on Template:MultiPage.

{{lang|Help:Templates}}
The result is at the very top of this page.
Template:Param displays the values like parameters in the way that they are used in templates. Useful for template documentations. {{param|color|#fff}}
{{{color|#FFF}}}
Template:Shortcut displays a small box noting (abbreviated) redirects to a page. {{shortcut|VDC:AL}}
Shortcut
VDC:AL
Template:Tl2 stands for Template Link (2 as it is a replacement for an older template). It creates a link to a template surrounded by {{ }}. It also accepts parameters that act like parameters for the template that is linked to. {{tl2|note|Example}}
{{note|Example}}
Template:Tlc does the same but not creating a link, which is useful when trying to display template examples (like this entire page!). {{tlc|note|Example}}
{{note|Example}}
Template:Toc-right shifts the table of contents over to the right side of a page. For an example, see Half-Life 2 map reference.
Template:Unsigned is for talk pages. It should be added at the ends of unsigned comments. {{unsigned|JeffLane}}
Unsigned comment added by JeffLane (talkcontribs). Please use four tildes (~~~~) or {{Message}} template to sign your username.

Magic Words

Magic words are special character strings that are kind of like templates. To apply one, simply type it on the page.

__TOC__

Forces the table of contents to be placed at this spot.

__FORCETOC__

Forces the table of contents to be placed at its normal spot. (Only useful on pages that don't have enough sections to automatically display a TOC.)

__NOTOC__

Hides the table of contents.

__HIDDENCAT__

Marks a category as hidden. To make the website show hidden categories for you, check the Show hidden categories box in Special:Preferences.

{{DISPLAYTITLE:title}}

Changes the title of a page at the top bar only.

See also