Developer console: Difference between revisions
Brandished (talk | contribs) m (please comment on the article using the discussion page, not the article itself) |
TomEdwards (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[Image:Console.gif|right|Console output for Episode Two]] | |||
[[Image: | |||
The '''console''' provides a [[Wikipedia:Command-line interface|command-line interface]] for the advanced configuration of Source games. Just about any configuration task can be completed from the console, and indeed they often have to be. | |||
== Enabling the console == | == Enabling the console == | ||
The console starts disabled. To enable it, load the game and visit ''Options > Keyboard > Advanced''. Once enabled, it can be opened and closed by pressing the button above {{key|Tab}}. | |||
(This should work regardless of your keyboard layout. If it doesn't, add <code>-console</code> to the game's launch options and type <code>bind your_key toggleconsole</code>.) | |||
== 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 : | |||
find_ent [[point_viewcontrol]] | |||
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>. | |||
A few notes: | |||
* 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>.) | |||
* 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. | |||
* 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 <code>cl</code> ("clientside") and <code>sv</code> ("serverside"). | |||
== Useful commands == | |||
{{note| | ; <code>find <term></code> | ||
: The ever-useful <code>find</code> command searches console command names and descriptions for the term your provide. | |||
; <code>help <command name></code> | |||
: Displays any help text for a command, without affecting its value. | |||
;<code>sv_cheats <[[bool]]></code> | |||
: Most cvars that affect gameplay, especially in multiplayer games, are flagged as "cheats". Submit <code>sv_cheats 1</code> to unlock them. {{note|You will never be [[Valve Anti-Cheat|VAC]] banned for using built-in cheat commands.}} | |||
;<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>con_log <file></code> | |||
;<code>condump</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 only when invoked. {{tip|The console only displays 241 lines at a time. Use <code>con_log</code> if you run up against this.}} | |||
<!-- not convinced that this is useful == Command prefixes == | |||
Commands traditionally come with prefixes that go some way to categorising them. Common ones include: | |||
=== Clientside === | |||
< | ;<code>cl_</code> | ||
] | :Generic clientside | ||
] | ;<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 === | |||
== | ;sv_ | ||
:Generic serverside | |||
;g_ | |||
:Generic singleplayer configuration | |||
;mp_ | |||
:Generic multiplayer configuration | |||
;ent_ | |||
:Direct entity control | |||
;npc_ | |||
:Direct NPC control | |||
;phys_ | |||
:Physics adjustments | |||
;sk_ | |||
:Difficulty ("skill") | |||
--> | |||
== Setting cvars with C++ == | |||
Simply: | |||
[the_cvar]->SetValue( [value] ); | |||
If you do not have access to a cvar, do this first: | |||
ConVar *[the_cvar] = cvar->FindVar( "[the_cvar]" ); | |||
{{tip|This code works even for closed-source cvars.}} | |||
{{todo|How to directly execute concommands?}} | |||
== | == See also == | ||
* [[Console Command List]] - partial list of console commands and variables | |||
* [[Console Command List]] - | * [[:Category:Console Commands]] - list of written articles for console commands | ||
* [[:Category:Console Commands]] - | * [[:Category:Console Variables]] - list of written articles for console variables | ||
* [[:Category:Console Variables]] - | |||
{{otherlang:en}} | {{otherlang:en}} | ||
Line 156: | Line 102: | ||
{{otherlang:en:zh-tw|Developer Console:zh-tw}} | {{otherlang:en:zh-tw|Developer Console:zh-tw}} | ||
[[Category: | [[Category:Modding]] | ||
[[Category:Programming]] | [[Category:Programming]] |
Revision as of 13:41, 15 January 2009
The console provides a command-line interface for the advanced configuration of Source games. Just about any configuration task can be completed from the console, and indeed they often have to be.
Enabling the console
The console starts disabled. To enable it, load the game and visit Options > Keyboard > Advanced. Once enabled, it can be opened and closed by pressing the button above Tab ⇆.
(This should work regardless of your keyboard layout. If it doesn't, add -console
to the game's launch options and type bind your_key toggleconsole
.)
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 :
find_ent point_viewcontrol
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") andsv
("serverside").
Useful commands
find <term>
- The ever-useful
find
command searches console command names and descriptions for the term your provide. help <command name>
- Displays any help text for a command, without affecting its value.
sv_cheats <bool>
- Most cvars that affect gameplay, especially in multiplayer games, are flagged as "cheats". Submit
sv_cheats 1
to unlock them.Note:You will never be VAC banned for using built-in cheat commands.
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. 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, whilecondump
records only when invoked.Tip:The console only displays 241 lines at a time. Use
con_log
if you run up against this.
Setting cvars with C++
Simply:
[the_cvar]->SetValue( [value] );
If you do not have access to a cvar, do this first:
ConVar *[the_cvar] = cvar->FindVar( "[the_cvar]" );

See also
- Console Command List - partial list of console commands and variables
- Category:Console Commands - list of written articles for console commands
- Category:Console Variables - list of written articles for console variables
Template:Otherlang:en Template:Otherlang:en:es, Template:Otherlang:en:jp, Template:Otherlang:en:pl, Template:Otherlang:en:ru, Template:Otherlang:en:zh-tw