Zh/Env message: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(Created page with "{{lang|Env message}} left|link={{base point|env_message}} It draws a text message on player HUDs, predefined in the <code>/scripts/titles.txt</code> f...")
 
No edit summary
Line 1: Line 1:
{{lang|Env message}}
{{lang|Env message}}
[[File:env_message.png|left|link=]]{{base point|env_message}} It draws a text message on player HUDs, predefined in the <code>/scripts/titles.txt</code> file.
[[File:env_message.png|left|link=]]{{point_ent:zh|env_message}} 在玩家hud上显示信息的实体, 定义于 <code>/scripts/titles.txt</code> 文件。


{{code class|CMessage|EnvMessage.cpp}}
{{code class:zh|CMessage|EnvMessage.cpp}}


{{clr}}
{{clr}}


==Syntax==
==语法==
Each message entry in titles.txt follows a similar structure as other Valve text files. Example: <code>Title { Text Value }</code>. The message can reference a [[VGUI_Documentation#Localization|localized]] string prefixed with <code>#</code>.
每条信息都定义于titles.txt 遵循其他valve文本结构. 譬如: <code>Title { Text Value }</code>. 这条信息可以引用 [[VGUI_Documentation#Localization|localized]] 文本前缀是 <code>#</code>


This text can be formatted in many different ways, according to the syntax provided. The <code>resource/clientscheme.res</code> is responsible for the font family, size and weight of the message. To change the size find <code>CenterPrintText</code> in the res file.
文本可以采用不同的格式设置,取决于语法提供的内容. 这个<code>resource/clientscheme.res</code> 负责字体的族, 大小和信息的宽度,而改变大小在此文件的这个<code>CenterPrintText</code> 项目内。


Variables can be defined which will affect all the messages below them, until overwritten with another value.
可以定义变量,会影响以下信息直到被其他信息取代。


{| class="standard-table"
{| class="standard-table"
|-
|-
! Varaible !! Parameters !! Description
! 变量 !! 参数 !! 描述
|-
|-
| $position || float, float || Position of the text onscreen. First float is horizontal, second is vertical. -1 is centered
| $position || float, float || Position of the text onscreen. First float is horizontal, second is vertical. -1 is centered

Revision as of 09:10, 14 October 2019

English (en)Русский (ru)中文 (zh)Translate (Translate)
Env message.png

起源 env_message是一个存在于所有的 起源 游戏的点实体。 在玩家hud上显示信息的实体, 定义于 /scripts/titles.txt 文件。


待完善: This template is currently using deprecated suf or {{Lang}}-based translations. Please use the main {{Code class}} instead, which uses {{Autolang}}.

在源代码中,它由 class CMessage 代表,定义于 EnvMessage.cpp


语法

每条信息都定义于titles.txt 遵循其他valve文本结构. 譬如: Title { Text Value }. 这条信息可以引用 localized 文本前缀是 #

文本可以采用不同的格式设置,取决于语法提供的内容. 这个resource/clientscheme.res 负责字体的族, 大小和信息的宽度,而改变大小在此文件的这个CenterPrintText 项目内。

可以定义变量,会影响以下信息直到被其他信息取代。

变量 参数 描述
$position float, float Position of the text onscreen. First float is horizontal, second is vertical. -1 is centered
$effect integer How it is displayed. 0 is fade in/fade out, 1 is flickery credits, 2 is write out
$fxtime float The amount of time the highlight lags behind the leading edge of the text
$color R G B Color of the text as red blue green between 0-255
$fadein float Fade in time of message or each character in seconds
$fadeout float Fade out time in seconds
$holdtime float How long to wait after fade in before fade out

If you make a standalone modification you can alter this file with your own entries. The default titles from HL2 are listed below:

Message Value Printed Text
CR1 Testing 1
CR2 Testing 2
CR3 Testing 3
GAMEOVER_ALLY ASSIGNMENT: TERMINATED

SUBJECT: FREEMAN

REASON: FAILURE TO PRESERVE MISSION-CRITICAL PERSONNEL

GAMEOVER_OBJECT ASSIGNMENT: TERMINATED

SUBJECT: FREEMAN

REASON: FAILURE TO PRESERVE MISSION-CRITICAL RESOURCES

GAMEOVER_TIMER ASSIGNMENT: TERMINATED

SUBJECT: FREEMAN

REASON: FAILURE TO PREVENT TIME-CRITICAL SEQUENCE

GAMEOVER_STUCK ASSIGNMENT: TERMINATED

SUBJECT: FREEMAN

REASON: DEMONSTRATION OF EXCEEDINGLY POOR JUDGMENT

CHAPTER1_TITLE POINT INSERTION
CHAPTER2_TITLE "A RED LETTER DAY"
CHAPTER3_TITLE ROUTE KANAL
CHAPTER4_TITLE WATER HAZARD
CHAPTER5_TITLE BLACK MESA EAST
CHAPTER6_TITLE "WE DON'T GO TO RAVENHOLM..."
CHAPTER7_TITLE HIGHWAY 17
CHAPTER8_TITLE SANDTRAPS
CHAPTER9_TITLE NOVA PROSPEKT
CHAPTER9A_TITLE ENTANGLEMENT
CHAPTER10_TITLE ANTICITIZEN ONE
CHAPTER11_TITLE "FOLLOW FREEMAN!"
CHAPTER12_TITLE OUR BENEFACTORS
CHAPTER13_TITLE DARK ENERGY
GAMESAVED Saved...
GAMETITLE Half-Life

Flags

  • 1: Play Once
  • 2: All Clients

Keyvalues

Message Text (message) ([todo internal name (i)]) <字符串(en)>
Message to be shown. See above.
Sound Effect (messagesound) ([todo internal name (i)]) <sound(en)>
When the message is shown, this sound effect will be played, originating from this entity.
Volume 0-10 (messagevolume) ([todo internal name (i)]) <字符串(en)>
Volume of the sound effect.
Sound Radius (messageattenuation) ([todo internal name (i)]) <choices>
How big the radius of the sound is.
  • 0: Small Radius
  • 1: Medium Radius
  • 2: Large Radius
  • 3: Play Everywhere


Inputs

ShowMessage
Shows the message and plays the sound.


Outputs

OnShowMessage
Fired when the message is activated.


See Also

  • game_text - Similar entity that lets you define a text directly in the Hammer editor.
  • env_hudhint - Similar entity that displays predefined HUD hints about controls and other things.