Game text: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Cleanup)
Line 1: Line 1:
{{wrongtitle|title=game_text}}
[[File:Game text.png|left|link=]]
{{base_point}}[[Category:GUI Entities]]


== Entity description ==
{{base point|game_text}} It displays text on players' screens. This text can be defined directly in the Hammer editor (unlike the similar [[env_message]] entity which uses the <code>titles.txt</code> file). This entity is suitable only for standalone bsp maps.  
[[Image:Game text.png|left]]An entity that displays text on players' screens. This text can be defined directly in the Hammer editor (unlike the similar [[env_message]] entity which uses the <code>titles.txt</code> file). This entity is suitable only for standalone bsp maps.  


If your text is not displaying properly in a multiplayer game, try checking the "All Players" flag.
If your text is not displaying properly in a multiplayer game, try checking the "All Players" flag.
* See also [[point_message]] - A similar entity that displays a small custom message at a specific position in the game world.
* [[Customizable triggered HUD-message]] - How to create a new entity that is similar to '''game_text''' but can receive the message string via a triggered input.


{{Warning|It is not suitable for any other usage, as it prevents [[VGUI_Documentation#Localization|localization]] and makes text editing impossible without a recompilation.}}
{{Warning|It is not suitable for any other usage, as it prevents [[VGUI_Documentation#Localization|localization]] and makes text editing impossible without a recompilation.}}
Line 22: Line 14:


== Keyvalues ==
== Keyvalues ==
*{{KV Targetname}}
{{KV|Message Text|string|Message to display onscreen. \n signifies a new line in the text. {{bug|Hammer will automatically change <code>\n</code> to <code>/n</code>. The only known workaround is to edit the vmf in notepad.}}}}
*'''master'''
{{KV|X (0 - 1.0 {{=}} left to right) (-1 centers)|string|Horizontal position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the far left of the screen and 1 is the far right. -1 centers the text.}}
:<target_destination> Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.
{{KV|Y (0 - 1.0 {{=}} top to bottom) (-1 centers)|string|Vertical position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the top of the screen and 1 is the bottom. -1 centers the text.}}
*'''message'''
{{KV|Text Effect|choices|Text scan effect}}
:<string> Message to display onscreen. \n signifies a new line in the text. {{bug|Hammer will automatically change <code>\n</code> to <code>/n</code>. The only known workaround is to edit the vmf in notepad.}}
*'''x'''
:<float> Horizontal position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the far left of the screen and 1 is the far right. -1 centers the text.
*'''y'''
:<float> Vertical position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the top of the screen and 1 is the bottom. -1 centers the text.
*'''effect'''
:<choices> Text Effect.
:{| class=standard-table
:{| class=standard-table
! Literal value || Effect || Description
! Literal value || Effect || Description
Line 38: Line 23:
| 0 || Fade In/Out || The whole text is faded in, and then faded out.
| 0 || Fade In/Out || The whole text is faded in, and then faded out.
|-
|-
| 1 || Credits || {{TODO|Unknown - seems to act like Fade In/Out. Provide description.}}
| 1 || Credits || {{todo|Unknown - seems to act like Fade In/Out. Provide description.}}
|-
|-
| 2 || Scan Out || The text is scanned in letter by letter, and the whole text is then faded out.
| 2 || Scan Out || The text is scanned in letter by letter, and the whole text is then faded out.
|}
|}
*'''color'''
{{KV|Color1|color255|The primary color used by all the text effects. }}
:<[[color255]]> Color1 - The primary color used by all the text effects.  
{{KV|Color2|color255|The scanning color for the letter being scanned if the ''Text Effect'' keyvalue is set to ''Scan Out'' - usually a different shade of Color1.}}
*'''color2'''
{{KV|Fade in Time (or character scan time)|string|The time it should take for the text to fully fade in.}}
:<[[color255]]> Color2 - The scanning color for the letter being scanned if the ''Text Effect'' keyvalue is set to ''Scan Out'' - usually a different shade of Color1.
{{KV|Fade Out Time|string|The time it should take for the text to fade out, after the hold time has expired.}}
*'''fadein'''
{{KV|Hold Time|string|The time the text should stay onscreen, after fading in, before it begins to fade out.}}
:<float> The time it should take for the text to fully fade in.
{{KV|Scan time (scan effect only)|string|If the 'Text Effect' is set to Scan Out, this is the time it should take to scan out all the letters in the text.}}
*'''fadeout'''
{{KV|Text Channel|choices|You can have up to four individual game_text messages onscreen at once, stored in channels. Select which channel this text should be placed in, which will overwrite any active message already in that channel.}}
:<float> The time it should take for the text to fade out, after the hold time has expired.
:* 1 : Channel 1
*'''holdtime'''
:* 2 : Channel 2
:<float> The time the text should stay onscreen, after fading in, before it begins to fade out.
:* 3 : Channel 3
*'''fxtime'''
:* 4 : Channel 4
:<float> If the 'Text Effect' is set to Scan Out, this is the time it should take to scan out all the letters in the text.
{{KV|Master|string|Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.}}
*'''channel'''
{{KV Targetname}}
:<choices> Text Channel. You can have up to four individual game_text messages onscreen at once, stored in channels. Select which channel this text should be placed in, which will overwrite any active message already in that channel.
:{{note|Only Channels 1-4 are displayed in the choice list.}}
:{| class=standard-table
! Literal value || Description
|-
| 0 || Channel 0
|-
| 1 || Channel 1
|-
| 2 || Channel 2
|-
| 3 || Channel 3
|-
| 4 || Channel 4
|-
| 5 || Channel 5
|}


== Flags ==
== Flags ==
*1 : All Players
* 1 : All Players


== Inputs ==
== Inputs ==
*{{I Targetname}}
{{IO|Display|Display the message text.}}
*'''Display'''
{{I Targetname}}
:Display the message text.


== Outputs ==
== Outputs ==
*{{O Targetname}}
{{O Targetname}}
 
== See also ==
* [[point_message]] - A similar entity that displays a small custom message at a specific position in the game world.
* [[Customizable triggered HUD-message]] - How to create a new entity that is similar to '''game_text''' but can receive the message string via a triggered input.
 
[[Category:GUI Entities]]

Revision as of 06:48, 26 July 2011

Game text.png

Template:Base point It displays text on players' screens. This text can be defined directly in the Hammer editor (unlike the similar env_message entity which uses the titles.txt file). This entity is suitable only for standalone bsp maps.

If your text is not displaying properly in a multiplayer game, try checking the "All Players" flag.

Warning.pngWarning:It is not suitable for any other usage, as it prevents localization and makes text editing impossible without a recompilation.
Warning.pngWarning:Don't use quotation characters (") in the Text Message field (not even \" characters). It will cause fatal errors with opening and/or compiling your map and may need to be fixed by manually editing the VMF in a text editor. Instead, use use detailed quotes (i.e. and ).
Note.pngNote:Does not function in Counter-Strike Source.

In code it is represented by class CGameText, defined in maprules.cpp.

Keyvalues

Message Text ([todo internal name (i)]) <string>
Message to display onscreen. \n signifies a new line in the text.
Icon-Bug.pngBug:Hammer will automatically change \n to /n. The only known workaround is to edit the vmf in notepad.  [todo tested in ?]
X (0 - 1.0 = left to right) (-1 centers) ([todo internal name (i)]) <string>
Horizontal position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the far left of the screen and 1 is the far right. -1 centers the text.
Y (0 - 1.0 = top to bottom) (-1 centers) ([todo internal name (i)]) <string>
Vertical position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the top of the screen and 1 is the bottom. -1 centers the text.
Text Effect ([todo internal name (i)]) <choices>
Text scan effect
Literal value Effect Description
0 Fade In/Out The whole text is faded in, and then faded out.
1 Credits
Todo: Unknown - seems to act like Fade In/Out. Provide description.
2 Scan Out The text is scanned in letter by letter, and the whole text is then faded out.
Color1 ([todo internal name (i)]) <color255>
The primary color used by all the text effects.
Color2 ([todo internal name (i)]) <color255>
The scanning color for the letter being scanned if the Text Effect keyvalue is set to Scan Out - usually a different shade of Color1.
Fade in Time (or character scan time) ([todo internal name (i)]) <string>
The time it should take for the text to fully fade in.
Fade Out Time ([todo internal name (i)]) <string>
The time it should take for the text to fade out, after the hold time has expired.
Hold Time ([todo internal name (i)]) <string>
The time the text should stay onscreen, after fading in, before it begins to fade out.
Scan time (scan effect only) ([todo internal name (i)]) <string>
If the 'Text Effect' is set to Scan Out, this is the time it should take to scan out all the letters in the text.
Text Channel ([todo internal name (i)]) <choices>
You can have up to four individual game_text messages onscreen at once, stored in channels. Select which channel this text should be placed in, which will overwrite any active message already in that channel.
  • 1 : Channel 1
  • 2 : Channel 2
  • 3 : Channel 3
  • 4 : Channel 4
Master ([todo internal name (i)]) <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Flags

  • 1 : All Players

Inputs

Display
Display the message text.


Outputs

See also

  • point_message - A similar entity that displays a small custom message at a specific position in the game world.
  • Customizable triggered HUD-message - How to create a new entity that is similar to game_text but can receive the message string via a triggered input.