Zh-tw/Developer console: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(39 intermediate revisions by 12 users not shown)
Line 1: Line 1:
==Overview==
{{LanguageBar}}
[[Image:Developer-console.jpg|right]]
The developer console allows you to enter commands to the Source engine while testing a map or mod.


Typing <code>[[help]]</code> will provide some instructions.
<h1>開發模式的控制台</h1>
==總覽==
[[File:Developer-console.jpg|right]]
在執行關卡或模組時,開發模式控制台允許您輸入控制指令給Source引擎來進行測試。
在控制台輸入<code>[[help]]</code>會告訴您一些指示。


Type <code>[[find]] <substring></code> to look for [[console command]]s or [[console variable]]s related to a specific topic (i.e. typing <code>find npc</code> would show a listing of [[NPC Debugging Command]]s such as [[npc_go]] and [[npc_create]].
藉由輸入<code>{{L|find}} <部分字串></code>用來尋找跟{{LCategory|Console commands|控制指令}}或{{LCategory|Console_variables|控制變數}}相關的指令(例如:輸入<code>find npc</code>將會顯示出NPC除錯指令的清單,像是{{L|npc_go}}和{{L|npc_create}})。


==介紹==


==Introduction==
開發模式控制台是開發者一個基本的工具,用來對程式碼進行除錯或讓使用者能自訂他們的想要的功能(無敵、飛行等等)。控制台是輸出入的文字模式,在遊戲運作期間接受執行命令或是改變全域變數的設定。


The developer console is an essential tool for game developers for debugging their code and also for players to customize their settings. The console is a text-based input/output interface to execute commands or change global settings during runtime.
==開啟命令列控制台==


以下是開啟命令列控制台的步驟:


==Enabling the Console==
# 開啟遊戲或模組。
# 點選主選單中的''選項''。
# 點選''鍵盤''標籤。
# 點選''進階...''按鈕。
# 將''啟用設計者命令列(~)''打勾。
# 確認。


To enable the console for use:
接者,命令列控制台可以藉由按鍵盤上的'''~'''(蚯蚓符號,在ESC鍵的下方)來開啟或關閉。


# Run the game/mod.
{{Note| '''~'''鍵可能不在某些鍵盤上,這時你必須手動設定其他的鍵來開啟,打開遊戲或模組資料夾中的''cfg/config.cfg''檔案,找出並更改:<code>bind "<你想要用來開啟控制台的鍵>" "toggleconsole"</code>。
# In the main menu click on ''Options''.
德式鍵盤的規劃:使用置於'''1'''鍵左邊的'''^'''鍵來開啟控制台命令列,<code>bind "\" "toggleconsole"</code>}}
# Click the ''Keyboard'' tab.
# Click the ''Advanced...'' button.
# Check the box next to ''Enable developer console (~)''.
# Click ''Apply''.


Henceforth, the console can be opened or closed with the key located top left below <Escape>, typically labelled '''~''' ("tilde") on a US keyboard.
命令列控制台也可以藉由加入參數<code>-dev</code>與<code>-console</code>執行遊戲來開啟。(開發者應該永遠使用<code>-dev</code>來開啟遊戲)


{{note|The '''~''' key may not work on some keyboards, in which case you must also manually set another key by opening the ''cfg/config.cfg'' file of the game/mod and changing this line:
如果Source引擎是藉由參數的方式來開啟命令列控制台,在進入主選單時控制台就會自動出現。
<code>bind "<key-you-want-to-use>" "toggleconsole"</code>
German keyboard layout: To use the key left to '''1''' which reads '''^''', do <code>bind "\" "toggleconsole"</code>}}


The console is also enabled when the game executable is started with the <code>-dev</code> or <code>-console</code> parameters. (Developers should always start the game with <code>-dev</code>.)
使用<code>-condebug</code>開啟遊戲會將所有的控制台內容紀錄在您遊戲資料夾中的<code>console.log</code>裡。


If the Source Engine is started with an attached debugger, the console output is shown in your debug output window.
==輸入指令==


Starting HL with <code>-condebug</code> will also log all console output in the text file <code>console.log</code> located in your game directory.
指令被輸入在控制台下的輸入欄裡。當輸入完新指令後,按下<Return>或點選''Submit''按鈕進行執行。


==Entering Commands==
一個指令有它獨特的識別名稱與一串可選擇的參數,每個參數中間使用<Space>鍵分開。


Commands are entered into the console by typing them in at the box at the bottom. After entering a new command, it is executed by hitting the <Return> key or pressing the ''Submit'' button.
{{Note|<code>]</code>是提示,並不是輸入的內容。}}


A command has a unique name and an optional list of parameters where each parameter is separated by a <Space> character.
語法: <code>命令 <參數一> [<參數二>]</code>。舉個例子:
 
{{note|The <code>]</code> is a prompt, and is not typed.}}
 
The syntax is: <code>command <parameter1> [<parameter2>]</code>. For example:


<pre>
<pre>
Line 51: Line 50:
</pre>
</pre>


If a command parameter contains <Space> characters, it must be encapsulated in quotes:
如果參數本身包含空格<Space>,則參數必須使用雙引號包起來:


<pre>
<pre>
Line 58: Line 57:
</pre>
</pre>


The console stores the last executed commands in a command history that is accessible with <UpArrow> and <DownArrow> keys. You can auto complete a command by pressing <Tab> and choose from a list of available commands if the console found multiple matches. Some commands (e.g. <code>map</code>, <code>load</code> etc) support auto completion for the first parameter too.
控制台將最後被執行的指令給儲存起來,藉由上鍵<UpArrow>與下鍵<DownArrow>將其出現到輸入欄裡。您能壓住對位鍵<Tab>來選擇一串清單可能的指令來完成一個指令(如果控制台找到多數符合對象)。某些指令也(如:<code>map</code><code>load</code>等等)提供自動完成第一個參數。


==Commands and Variables==
==指令與變數==


The console differs between console commands and console variables.
控制台中可輸入的內容分為控制指令與控制變數兩種。


''Console commands'' usually pass the parameters to some code function and execute it, but they don't remember these parameters.
''控制指令'' 通常藉由輸入參數給某些程式函式並執行之,但不把參數的內容保留下來。


''Console variables'' store the last parameters like a global setting. Console variables can only have one parameter, which can be a number or string; it depends on the game code how these values are interpreted. A lot of console variables act like triggers, 0 usually means off and 1 means on (e.g. <code>cl_showfps</code>). To see the current value of a console variable just type the name without any parameters.
''控制變數'' 將最後指定的參數當作全域設定來儲存。控制變數只能擁有一個參數,其可以是數字或字串;這是由遊戲程式碼來決定他們值為哪種型態。很多控制變數扮演觸發器,0通常為關閉,1為開啟(如:<code>cl_showfps</code>)。想要知道控制變數目前的值為多少,只需輸入控制變數的名稱而不接任何的參數即可。


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:
通常使用的控制指令和變數的字首為:
{|
{| class=standard-table
| <code>ai_</code> || single player AI
| <code>ai_</code> || 單人遊戲AI
|-
|-
| <code>cc_</code> || close caption system
| <code>cc_</code> || 隱藏式字幕系統
|-
|-
| <code>cl_</code> || multiplayer client
| <code>cl_</code> || 多人遊戲客戶端
|-
|-
| <code>demo_</code> || demo playback
| <code>demo_</code> || Demo記錄
|-
|-
| <code>disp_</code> || terrain displacement maps
| <code>disp_</code> || 地形置換的地圖
|-
|-
| <code>dsp_</code> || audio DSP settings
| <code>dsp_</code> || 聲音(DSP)設定
|-
|-
| <code>ent_</code> || entity control/debug
| <code>ent_</code> || 實體控制/除錯
|-
|-
| <code>fire_</code> || firing entity events
| <code>fire_</code> || 射擊實體事件
|-
|-
| <code>fog_</code> || fog renderer
| <code>fog_</code> || 迷霧呈現
|-
|-
| <code>g_</code> || single player game
| <code>g_</code> || 單人遊戲
|-
|-
| <code>hltv_</code> || Half-Life TV
| <code>hltv_</code> || Half-Life TV
|-
|-
| <code>host_</code> || host system
| <code>host_</code> || 用戶端系統
|-
|-
| <code>hud_</code> || client HUD
| <code>hud_</code> || 客戶端的抬頭顯示介面
|-
|-
| <code>joy_</code> || joystick input
| <code>joy_</code> || 搖桿控制
|-
|-
| <code>log_</code> || logging system
| <code>log_</code> || 日誌系統
|-
|-
| <code>m_</code> || mouse input
| <code>m_</code> || 滑鼠控制
|-
|-
| <code>mat_</code> || material system
| <code>mat_</code> || 材質系統
|-
|-
| <code>mp_</code> || multiplayer game (server)
| <code>mp_</code> || 多人遊戲(伺服端)
|-
|-
| <code>nav_</code> || navigation graphs
| <code>nav_</code> || 導航網絡圖
|-
|-
| <code>net_</code> || engine networking
| <code>net_</code> || 網路引擎
|-
|-
| <code>npc_</code> || single player game NPCs
| <code>npc_</code> || 單人遊戲NPC
|-
|-
| <code>phys_</code> || physics system
| <code>phys_</code> || 物理系統
|-
|-
| <code>r_</code> || video renderer
| <code>r_</code> || 影像呈現
|-
|-
| <code>rcon_</code> || remote control access
| <code>rcon_</code> || 遠端控制存取
|-
|-
| <code>sk_</code> || player skill / difficulty
| <code>sk_</code> || 遊戲難易度
|-
|-
| <code>snd_</code> || sound system
| <code>snd_</code> || 音效系統
|-
|-
| <code>sv_</code> || server settings (engine)
| <code>sv_</code> || 伺服端設定(引擎)
|-
|-
| <code>v_</code> || client view
| <code>v_</code> || 客戶端視圖
|-
|-
| <code>vgui_</code> || VGUI
| <code>vgui_</code> || VGUI
|-
|-
| <code>voice_</code> || ingame player voice
| <code>voice_</code> || 語音
|-
|-
| <code>vprof_</code> || code profiler
| <code>vprof_</code> || profiler程式碼
|-
|-
| <code>wc_</code> || WorldCraft/Hammer helpers
| <code>wc_</code> || WorldCraft/Hammer(關卡編輯器)幫手
|}
|}


如果您忘了指令或變數完整的名稱,使用<code>find <部分名稱></code>會顯示所有的指令或變數名稱中有包含所給的部份名稱。


If you forgot the exact name of a command or variable, <code>find <substring></code> shows all commands containing a given substring.
使用<code>help <指令或變數名稱></code>指令會顯示幫助訊息。
 
The command <code>help <command></code> shows help text for a given command (if available).
 
 
==See Also==
* [[Console Command List]] - A complete list of console commands and variables.
* [[:Category:Console Commands]] - A list of articles on console commands.
* [[:Category:Console Variables]] - A list of articles on console variables.
 
{{otherlang:en}} {{otherlang:en:ru|Консоль разработчика}}, {{otherlang:en:jp|Developer Console:jp}}, {{otherlang:en:pl|Developer Console:pl}}, {{otherlang:en:es|Developer Console:es}}


[[Category:Level Design]][[Category:Programming]]
==參見==
* {{L|Console Command List}} - 完整顯示所有控制指令與變數清單。
* {{LCategory|Console commands}} - 一份說明控制指令的清單。
* {{LCategory|Console variables}} - 一份說明控制變數的清單。
{{ACategory|Source_SDK_FAQ}}
{{ACategory|Modding}}
{{ACategory|Dedicated Server}}

Latest revision as of 16:13, 23 August 2024

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)
Info content.png
This translated page needs to be updated.
You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.(en)
This notice is put here by LanguageBar template and if you want to remove it after updating the translation you can do so on this page.


開發模式的控制台

總覽

Developer-console.jpg

在執行關卡或模組時,開發模式控制台允許您輸入控制指令給Source引擎來進行測試。 在控制台輸入help會告訴您一些指示。

藉由輸入find(en) <部分字串>用來尋找跟控制指令(en)控制變數(en)相關的指令(例如:輸入find npc將會顯示出NPC除錯指令的清單,像是npc_go(en)npc_create(en))。

介紹

開發模式控制台是開發者一個基本的工具,用來對程式碼進行除錯或讓使用者能自訂他們的想要的功能(無敵、飛行等等)。控制台是輸出入的文字模式,在遊戲運作期間接受執行命令或是改變全域變數的設定。

開啟命令列控制台

以下是開啟命令列控制台的步驟:

  1. 開啟遊戲或模組。
  2. 點選主選單中的選項
  3. 點選鍵盤標籤。
  4. 點選進階...按鈕。
  5. 啟用設計者命令列(~)打勾。
  6. 確認。

接者,命令列控制台可以藉由按鍵盤上的~(蚯蚓符號,在ESC鍵的下方)來開啟或關閉。

Note.png注意: ~鍵可能不在某些鍵盤上,這時你必須手動設定其他的鍵來開啟,打開遊戲或模組資料夾中的cfg/config.cfg檔案,找出並更改:bind "<你想要用來開啟控制台的鍵>" "toggleconsole"。 德式鍵盤的規劃:使用置於1鍵左邊的^鍵來開啟控制台命令列,bind "\" "toggleconsole"

命令列控制台也可以藉由加入參數-dev-console執行遊戲來開啟。(開發者應該永遠使用-dev來開啟遊戲)

如果Source引擎是藉由參數的方式來開啟命令列控制台,在進入主選單時控制台就會自動出現。

使用-condebug開啟遊戲會將所有的控制台內容紀錄在您遊戲資料夾中的console.log裡。

輸入指令

指令被輸入在控制台下的輸入欄裡。當輸入完新指令後,按下<Return>或點選Submit按鈕進行執行。

一個指令有它獨特的識別名稱與一串可選擇的參數,每個參數中間使用<Space>鍵分開。

Note.png注意:]是提示,並不是輸入的內容。

語法: 命令 <參數一> [<參數二>]。舉個例子:

]bind mouse1 +attack
]map dm_lockdown

如果參數本身包含空格<Space>,則參數必須使用雙引號包起來:

]bind h "say hello world"
]name "Gordon Freeman"

控制台將最後被執行的指令給儲存起來,藉由上鍵<UpArrow>與下鍵<DownArrow>將其出現到輸入欄裡。您能壓住對位鍵<Tab>來選擇一串清單可能的指令來完成一個指令(如果控制台找到多數符合對象)。某些指令也(如:mapload等等)提供自動完成第一個參數。

指令與變數

控制台中可輸入的內容分為控制指令與控制變數兩種。

控制指令 通常藉由輸入參數給某些程式函式並執行之,但不把參數的內容保留下來。

控制變數 將最後指定的參數當作全域設定來儲存。控制變數只能擁有一個參數,其可以是數字或字串;這是由遊戲程式碼來決定他們值為哪種型態。很多控制變數扮演觸發器,0通常為關閉,1為開啟(如:cl_showfps)。想要知道控制變數目前的值為多少,只需輸入控制變數的名稱而不接任何的參數即可。

大部分的控制指令和變數在它們名稱有字首,這代表它們屬於哪個子系統,但並不是總是這樣,特別是從戰慄時空一來的指令,舊名稱被保留著而沒有改變。

通常使用的控制指令和變數的字首為:

ai_ 單人遊戲AI
cc_ 隱藏式字幕系統
cl_ 多人遊戲客戶端
demo_ Demo記錄
disp_ 地形置換的地圖
dsp_ 聲音(DSP)設定
ent_ 實體控制/除錯
fire_ 射擊實體事件
fog_ 迷霧呈現
g_ 單人遊戲
hltv_ Half-Life TV
host_ 用戶端系統
hud_ 客戶端的抬頭顯示介面
joy_ 搖桿控制
log_ 日誌系統
m_ 滑鼠控制
mat_ 材質系統
mp_ 多人遊戲(伺服端)
nav_ 導航網絡圖
net_ 網路引擎
npc_ 單人遊戲NPC
phys_ 物理系統
r_ 影像呈現
rcon_ 遠端控制存取
sk_ 遊戲難易度
snd_ 音效系統
sv_ 伺服端設定(引擎)
v_ 客戶端視圖
vgui_ VGUI
voice_ 語音
vprof_ profiler程式碼
wc_ WorldCraft/Hammer(關卡編輯器)幫手

如果您忘了指令或變數完整的名稱,使用find <部分名稱>會顯示所有的指令或變數名稱中有包含所給的部份名稱。

使用help <指令或變數名稱>指令會顯示幫助訊息。

參見