Developer console: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Translate chinese over!!!(may be....))
 
(42 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{otherlang2|title=开发者控制台|es=Developer Console:es|jp=Developer Console:jp|pl=Developer Console:pl|ru=Developer Console:ru|zh-tw=Developer |fr=Developer Console:fr |Console:zh-tw}}
{{LanguageBar}}


[[Image:Console.gif|right|Console output for Episode Two]]
[[File:Console.gif|right|Console output for Episode Two]]


'''控制台''' 是一个用来配置和修改游戏的[[Wikipedia:Command-line interface|命令行界面]]工具. 事实上任何东西都可以通过控制台来修改, 并且有许多都是 ''必须的''.
The '''console''' provides a [[Wikipedia:Command-line interface|command-line interface]] for the advanced configuration of {{gldsrc|1}}, {{source|1}} and {{src2|1}} games, aswell as the {{steamicon|1|nt=0}}. Just about any configuration task can be completed from the console, and in fact many ''have'' to be.


== 启用控制台 ==
== Enabling the console ==


控制台在默认情况下是无法启动的.激活它,需要开启游戏并在 ''设置 > 键盘 > 高级选项''. 这将会出现两个选项, 其中一个就是 "启用控制台". 一旦激活, 就可以通过 {{key|Tab}}上面的那个键, 也就是人民群众喜闻乐见的 "标题." {{key|~}}
On Source and Source 2 games, console starts disabled by default. To enable it, load the game and visit ''Options > Keyboard > Advanced''. There will be a pop-up that will include two options, one of them labeled "Enable Developer Console". Once enabled, it can be opened and closed by pressing the button above {{key|Tab}}, known as the "tilde." {{key|~}}


{{note|如果你的键盘上没有这个按键. 在游戏开始时,使用 <code>-console</code>启动游戏,然后输入<code>bind 按键 toggleconsole</code> (以代替原本的按键开启控制台).}}
GoldSrc games starts with console enabled by default (since Steam was released), but the previous version (also known as retail/WON version), needs {{code|-console}} launch option. The previous version of GoldSrc games cannot use {{key|~}} key to open console (unless the player is in-game), instead player click on Console menu option.


== 提交 ==
For {{steamicon|1}} client, to open developer console, you can use {{code|steam://nav/console}} or {{code|steam://open/console}} (simply click on it, or type this on "Run" command on Windows, or through your internet browser and submit). You can also launch Steam with {{code|-console}} to start Steam with "Console" option available on the client tabs, and in context menu.


底部灰色的输入框是用来输入命令的. 它支持两种输入格式: 命令和变量. 命令是一种的代码, 但是特殊变量指令 ("cvars") 需要赋值才能被控制台接受. 当你设置一个特殊变量指令时你应该这样做 :
{{note|This should work ''regardless'' of your keyboard layout. If it doesn't, add <code>-console</code> to the game's launch options to force it to open. Once open, type <code>bind your_key toggleconsole</code> to add a new binding and fix it in the future. Replace your_key with the key you wish to open the console with.}}


mat_wireframe 1
== Submitting ==


当你输入结束时,敲击{{key|Return}}或者{{key|Enter}}来提交. 之后你将会在控制台窗口的最前端看到控制台返回你的信息 <code>]</code>.
The grey box across the bottom of the console window is where commands are entered. They come in two forms: commands and variables. Commands are simply keywords, but variables ("cvars") require a value of some sort before they are accepted. When setting a [[cvar]] you might type something like this:


一些小提示:
<code>[[mat_wireframe]] 1</code>


* 使用空格键来分隔多个值. 如果一个值包含了字符, 请用双引号来区分这些字符. (例如<code>say "Hello everyone on the server"</code>.)
When you've finished typing, hit {{key|Return}} or {{key|Enter}} to submit. You'll see everything you type 'echoed' to the console with a preceding <code>]</code>.
* 控制台有时会自动识别出你将要输入的命令(在输入框的下方弹出你将可能输入的指令). 通过{{key|Up}}/{{key|Down}}键来翻阅这些指令并通过 {{key|Tab}}来选择这些指令.
* 只有"archived" 这个指令会在游戏结束后进行. 使用[[autoexec]]如果你想要在游戏开始自动运行一些指令.
* 一些命令是服务器指令, 一些是客户端命令.在多人游戏中,你只能使用客户端命令.
* 有许多命令都带有前缀.其中最常见的就是<code>cl</code> ("客户端命令")和<code>sv</code> ("服务器命令").


== 实用指令 ==
A few notes:


; <code>find <关键字></code>
* Multiple values are separated with spaces. If a value contains a space, surround it with quote marks. (e.g. <code>say "Hello everyone on the server"</code>.)
: 这个经常使用到的指令<code>find</code>是用来搜索带关键字的指令的.十分有用
* The console will suggest commands and sometimes values in a pop-out box beneath the input field. Press {{key|Up}}/{{key|Down}} to navigate the list and {{key|Tab}} to accept the highlighted suggestion.
; <code>find_ent <关键字></code>
* Only "archived" cvars are stored after the game closes. Use [[autoexec]] if you want to set any others when a game loads.
: 和find命令一样,只不过这个是用来搜索带有关键字的地图.
* Some commands are serverside, others clientside. In multiplayer you can only set clientside ones.
; <code>help <指令名></code>
* There are many command prefixes. The most common are <code>cl</code> ("clientside") and <code>sv</code> ("serverside").
: 简单的对所输入的指令名的功能进行介绍.
 
;<code>sv_cheats <[[bool]]></code>
== Useful commands ==
:有许多特殊变量指令将会影响游戏性, 在多人游戏中这些指令将被视为作弊行为. 提交<code>sv_cheats 1</code>指令用来接触这些指令的限制. {{note|使用这个指令的服务器即使受到[[Valve Anti-Cheat|VAC]]的保护也不会因作弊指令而被ban.}}
{{seealso|[[List of console scripting commands]] - small command palette for scripting the console,<br>[[:Category:Source base console commands]]}}
;<code>developer <0-2></code>
 
:开发者模式将会提供更多的控制台命令,允许作弊和让控制台自动启动, 并且使得指令变得更加的有用和不受限制. 如果是使用<code>2</code>模式,最后出书的几行将会显示在屏幕上.
=== The console window ===
;<code>con_log <文件名></code>
 
;<code>con_enable <[[boolean]]></code>
:Allows the console to be activated.
 
;<code>showconsole</code>
;<code>hideconsole</code>
;<code>toggleconsole</code>
:Simple command that opens/closes/toggles the console. <code>toggleconsole</code> is bound to {{key|`}} by default.
 
=== Find commands ===
 
;<code>[[find]] <term></code>
:The ever-useful <code>find</code> command searches console command names and descriptions for the term you provide.{{note|Use <code>[[cvarlist]]</code> in GoldSource.}}
 
;<code>help <command name></code>
:Displays any help text for a command, without affecting its value.
 
=== Controlling console output ===
 
;<code>clear</code>
:Clear console output, i. e. empties the console. This is useful to execute before other commands to tell where some text starts and ends such as after <code>find <string></code>.
 
;<code>echo <string></code>
:Display user-defined text in the console.
 
;<code>con_log <file></code>
;<code>condump</code>
;<code>condump</code>
:如果你想把控制台显示的内容保存成一个文件以便于以后使用,那么请使用这个命令吧. <code>con_log</code>是用来读取由<code>condump</code>保存的命令文件{{tip|控制台只能显示不超过241条的文件.也可以使用<code>con_log</code>来保存然后再继续操作.}}  
: Use one of these commands if you want to record what goes on in the console for later use. <code>con_log</code> writes output constantly, while <code>condump</code> records the current text in the console when invoked. {{tip|The console only displays 241 lines at a time. Use <code>con_log</code> if you run up against this.}}
{{note|这个命令在不同的source版本表现的也不同,在半条命2中,这两个命令无法被识别!在CS:GO中<code>con_log</code>这个命令正确写法是<code>con_logfile<文件名></code>}}
 
(中文译者注)
;<code>con_filter_enable <0-2></code>
: Filters console output based on the setting of <code>con_filter_text</code> and <code>con_filter_text_out</code>. If set to <code>1</code>, all other console output is not shown at all. If set to <code>2</code>, all other console output is printed in gray to highlight the filtered text.
;<code>con_filter_text <string></code>
: If this is not the empty string and <code>con_filter_enable</code> is not 0, then any console output is filtered out if it does not match this.
;<code>con_filter_text_out <string></code>
: If this is not the empty string and <code>con_filter_enable</code> is not 0, then any console output is filtered out if it does match this.
 
=== Cheats and debugging tools ===
 
;<code>[[developer]] <0-2></code>
:Developer mode enables more verbose console output, enables cheats and the console automatically, and makes various other useful changes. If set to <code>2</code>, the last few lines of console output will be printed at the top of the screen as well.
 
;<code>[[sv_cheats]] <[[boolean]]></code>
:Most cvars that affect gameplay, especially in multiplayer games, are flagged as "cheats". Submit <code>sv_cheats 1</code> to unlock them. {{Note|[[logic_achievement|Achievements]] will be disabled when cheats is enabled.}} {{note|You will never be [[Valve Anti-Cheat|VAC]] banned for using built-in cheat commands.}}
 
;<code>[[noclip]]</code>
:Allows you to fly trough your level without player collisions. Requires <code>sv_cheats</code> to be set to 1.
 
;<code>[[getpos]]</code>
:Prints the current position of the local player to the console. <code>[[cl_showpos]] <0-1></code> can be used to show the position on the screen continuously.
 
;<code>[[cl_showfps]] <0-2></code>
:Display the current frames per second. If set to "2", will also show the lowest and highest FPS, and the latency.
 
;<code>find_ent <term></code>
:Similar to the <code>find</code> command above, but searches for entities within the map by name.
 
;<code>[[impulse]] <number></code>
:A generic client command with various game dependent uses, both cheat and not cheat.
 
=== Game related ===
 
;<code>[[map]] <mapname></code>
:Starts a game on a map.


<!-- not convinced that this is useful == Command prefixes ==
;<code>connect <address></code>
:Tries to connect to a server and load its current map.


Commands traditionally come with prefixes that go some way to categorising them. Common ones include:
;<code>disconnect</code>
:Disconnects the game from the current server.


=== Clientside ===
;<code>[[status]]</code>
:Shows information about the server that a client is connected to.


;<code>cl_</code>
;<code>quit</code>
:Generic clientside
:Closes the game.
;<code>demo_</code>
:[[Demo]] recording and playback
;<code>r_</code>
:Generic rendering configuration
;<code>mat_</code>
:[[Material]] configuration
;<code>hud_</code>
:In-game user interface
;<code>net_</code>
:[[:Category:Networking|Networking]] configuration (a few are serverside)


=== Serverside ===
== Command prefixes ==


;sv_
Most console commands and variables have prefixes in their name to show the subsystem they belong to, but this isn't always the case, especially for commands coming from Half-Life 1, where the old name was kept unchanged.
:Generic serverside
;g_
:Generic singleplayer configuration
;mp_
:Generic multiplayer configuration
;ent_
:Direct entity control
;npc_
:Direct NPC control
;phys_
:Physics adjustments
;sk_
:Difficulty ("skill")
-->


== 查看更多 ==
Commonly used console command prefixes are:
{| class="wikitable mw-collapsible mw-collapsed"
|+ style="color:#bbb; white-space:nowrap; text-align:left"| Command prefixes
| <code>ai_</code> || single player AI
|-
| <code>bot_</code> || [[bot]] system
|-
| <code>cc_</code> || close caption system
|-
| <code>cl_</code> || multiplayer game (client; see also <code>mp_</code>)
|-
| <code>demo_</code> || [[Demo Recording Tools|demo playback]]
|-
| <code>disp_</code> || terrain displacement maps
|-
| <code>dsp_</code> || audio [[DSP]] settings
|-
| <code>ent_</code> || entity control/debug
|-
| <code>fire_</code> || firing entity events
|-
| <code>fog_</code> || [[Dust,_Fog,_%26_Smoke|fog]] override parameters for the  [[fogui]]
|-
| <code>g_</code> || single player game
|-
| <code>hltv_</code> || {{obs}} [[HLTV|Half-Life TV]] (see <code>tv_</code> for [[SourceTV]])
|-
| <code>host_</code> || host system
|-
| <code>hud_</code> || client [[:Category:HUD|HUD]]
|-
| <code>joy_</code> || joystick input
|-
| <code>log_</code> || logging system
|-
| <code>m_</code> || mouse input
|-
| <code>mat_</code> || [[material]] system
|-
| <code>mp_</code> || multiplayer game (server; see also <code>cl_</code>)
|-
| <code>nav_</code> || [[Nav Mesh|navigation meshes]]
|-
| <code>net_</code> || engine [[:Category:Networking|networking]]
|-
| <code>npc_</code> || single player game [[NPC]]s
|-
| <code>phys_</code> || [[physics]] system
|-
| <code>r_</code> || video renderer
|-
| <code>rcon_</code> || [[Source RCON Protocol|remote control access]]
|-
| <code>sk_</code> || player skill / difficulty
|-
| <code>snd_</code> || [[Sound and Music|sound system]]
|-
| <code>sv_</code> || server settings (engine)
|-
| <code>tv_</code> || [[SourceTV]]
|-
| <code>v_</code> || client view
|-
| <code>vgui_</code> || VGUI
|-
| <code>voice_</code> || ingame player voice
|-
| <code>vprof_</code> || code profiler
|-
| <code>wc_</code> || WorldCraft/Hammer helpers
|}
 
== See also ==


* [[Developer Console Control]] - for programmers
* [[Developer Console Control]] - for programmers
* [[Console Command List]] - partial list of console commands and variables
* [[Console Command List]] - partial list of console commands and variables available in all GoldSrc, Source and Source 2 games
* [[:Category:Console Commands]] - list of written articles for console commands
* [[List_of_Valve_Games_console_commands_and_variables|Game Specific Console Command List]] - List of all cvars for each game
* [[:Category:Console Variables]] - list of written articles for console variables
* [[:Category:Console commands]] - list of written articles for console commands
 
* [[:Category:Console variables]] - list of written articles for console variables
[[Category:Source_SDK_FAQ]]
[[Category:Source_SDK_FAQ]]
[[Category:Modding]]
[[Category:Modding]]
[[Category:Dedicated Server]]

Latest revision as of 07:03, 27 August 2025

English (en)Deutsch (de)Español (es)Français (fr)Italiano (it)日本語 (ja)Polski (pl)Português do Brasil (pt-br)Русский (ru)中文 (zh)中文(臺灣) (zh-tw)Translate (Translate)
Console output for Episode Two

The console provides a command-line interface for the advanced configuration of GoldSrc, Source and Source 2 games, aswell as the Steam client. Just about any configuration task can be completed from the console, and in fact many have to be.

Enabling the console

On Source and Source 2 games, console starts disabled by default. To enable it, load the game and visit Options > Keyboard > Advanced. There will be a pop-up that will include two options, one of them labeled "Enable Developer Console". Once enabled, it can be opened and closed by pressing the button above Tab , known as the "tilde." ~

GoldSrc games starts with console enabled by default (since Steam was released), but the previous version (also known as retail/WON version), needs -console launch option. The previous version of GoldSrc games cannot use ~ key to open console (unless the player is in-game), instead player click on Console menu option.

For Steam client, to open developer console, you can use steam://nav/console or steam://open/console (simply click on it, or type this on "Run" command on Windows, or through your internet browser and submit). You can also launch Steam with -console to start Steam with "Console" option available on the client tabs, and in context menu.

Note.pngNote:This should work regardless of your keyboard layout. If it doesn't, add -console to the game's launch options to force it to open. Once open, type bind your_key toggleconsole to add a new binding and fix it in the future. Replace your_key with the key you wish to open the console with.

Submitting

The grey box across the bottom of the console window is where commands are entered. They come in two forms: commands and variables. Commands are simply keywords, but variables ("cvars") require a value of some sort before they are accepted. When setting a cvar you might type something like this:

mat_wireframe 1

When you've finished typing, hit Return or Enter to submit. You'll see everything you type 'echoed' to the console with a preceding ].

A few notes:

  • Multiple values are separated with spaces. If a value contains a space, surround it with quote marks. (e.g. say "Hello everyone on the server".)
  • The console will suggest commands and sometimes values in a pop-out box beneath the input field. Press / to navigate the list and Tab to accept the highlighted suggestion.
  • Only "archived" cvars are stored after the game closes. Use autoexec if you want to set any others when a game loads.
  • Some commands are serverside, others clientside. In multiplayer you can only set clientside ones.
  • There are many command prefixes. The most common are cl ("clientside") and sv ("serverside").

Useful commands

See also:  List of console scripting commands - small command palette for scripting the console,
Category:Source base console commands

The console window

con_enable <boolean>
Allows the console to be activated.
showconsole
hideconsole
toggleconsole
Simple command that opens/closes/toggles the console. toggleconsole is bound to ` by default.

Find commands

find <term>
The ever-useful find command searches console command names and descriptions for the term you provide.
Note.pngNote:Use cvarlist in GoldSource.
help <command name>
Displays any help text for a command, without affecting its value.

Controlling console output

clear
Clear console output, i. e. empties the console. This is useful to execute before other commands to tell where some text starts and ends such as after find <string>.
echo <string>
Display user-defined text in the console.
con_log <file>
condump
Use one of these commands if you want to record what goes on in the console for later use. con_log writes output constantly, while condump records the current text in the console when invoked.
Tip.pngTip:The console only displays 241 lines at a time. Use con_log if you run up against this.
con_filter_enable <0-2>
Filters console output based on the setting of con_filter_text and con_filter_text_out. If set to 1, all other console output is not shown at all. If set to 2, all other console output is printed in gray to highlight the filtered text.
con_filter_text <string>
If this is not the empty string and con_filter_enable is not 0, then any console output is filtered out if it does not match this.
con_filter_text_out <string>
If this is not the empty string and con_filter_enable is not 0, then any console output is filtered out if it does match this.

Cheats and debugging tools

developer <0-2>
Developer mode enables more verbose console output, enables cheats and the console automatically, and makes various other useful changes. If set to 2, the last few lines of console output will be printed at the top of the screen as well.
sv_cheats <boolean>
Most cvars that affect gameplay, especially in multiplayer games, are flagged as "cheats". Submit sv_cheats 1 to unlock them.
Note.pngNote:Achievements will be disabled when cheats is enabled.
Note.pngNote:You will never be VAC banned for using built-in cheat commands.
noclip
Allows you to fly trough your level without player collisions. Requires sv_cheats to be set to 1.
getpos
Prints the current position of the local player to the console. cl_showpos <0-1> can be used to show the position on the screen continuously.
cl_showfps <0-2>
Display the current frames per second. If set to "2", will also show the lowest and highest FPS, and the latency.
find_ent <term>
Similar to the find command above, but searches for entities within the map by name.
impulse <number>
A generic client command with various game dependent uses, both cheat and not cheat.

Game related

map <mapname>
Starts a game on a map.
connect <address>
Tries to connect to a server and load its current map.
disconnect
Disconnects the game from the current server.
status
Shows information about the server that a client is connected to.
quit
Closes the game.

Command prefixes

Most console commands and variables have prefixes in their name to show the subsystem they belong to, but this isn't always the case, especially for commands coming from Half-Life 1, where the old name was kept unchanged.

Commonly used console command prefixes are:

Command prefixes
ai_ single player AI
bot_ bot system
cc_ close caption system
cl_ multiplayer game (client; see also mp_)
demo_ demo playback
disp_ terrain displacement maps
dsp_ audio DSP settings
ent_ entity control/debug
fire_ firing entity events
fog_ fog override parameters for the fogui
g_ single player game
hltv_ Obsolete Half-Life TV (see tv_ for SourceTV)
host_ host system
hud_ client HUD
joy_ joystick input
log_ logging system
m_ mouse input
mat_ material system
mp_ multiplayer game (server; see also cl_)
nav_ navigation meshes
net_ engine networking
npc_ single player game NPCs
phys_ physics system
r_ video renderer
rcon_ remote control access
sk_ player skill / difficulty
snd_ sound system
sv_ server settings (engine)
tv_ SourceTV
v_ client view
vgui_ VGUI
voice_ ingame player voice
vprof_ code profiler
wc_ WorldCraft/Hammer helpers

See also