控制台

From Team Fortress Wiki
Jump to: navigation, search
军团要塞2 中的开发者控制台、

控制台是用户界面的一部分,它用于为游戏开发者、内容创建者和进阶玩家提供服务。这是一个以文本为基础的信息面板,允许使用者通过输入游戏识别的文本指令来进行特殊操作。

开启控制台

The advanced keyboard options dialog that hides the option to enable the console

默认情况下开发者控制台是被禁用的.想要开启控制台,必须绑定一个键位来开启它. 在美式键盘上,它默认为波浪号键~ .此外,还必须在进阶设置中启用控制台.

即使未被启用,控制台也将自动打开, 当使用 -console指令时.-developer指令也会自动使控制台打开,而developersv_cheats两个变量不会被启动. Xbox和PlayStation版的军团要塞2无法访问控制台.

使用控制台

控制台分为两部分,一个大的命令输出面板和一排命令提示符.

输出面板

除了显示玩家输入的各种指令的输出外,输出面板还记录各种游戏事件,比如玩家的死亡信息和聊天内容.

控制台输出的最后几行可以覆盖在游戏左上角.这是由developer变量控制的.

指令提示符

命令提示符能接收输入的指令,按下Return或者↵ Enter能执行命令.

与GUI中其他字段一样,控制台支持剪贴板,允许玩家们剪切,复制并粘贴文本.

命令提示符支持辅助指令完成功能.当玩家正在输入指令时,游戏将根据玩家输入的内容提供建议.按下Tab键Tab ⇆接受建议,并继续输入指令.

指令类型

控制台有两种不同的指令类型,纯指令和所谓的控制台变量.区别在于,控制台变量能保留一个值,而纯指令只执行一次.

命令通常被标为一种或多种特殊形式的指令.

输入指令

有些指令很特殊,其开头为一个加号.这些指令提供游戏内的命令.当绑定到某个键时,它们便具有特殊的属性,使得它们在释放键时能自动发出孪生的关闭命令(以减号开头而不是加号开头).

作弊

主条目: Cheats/zh-hans, 作弊

许多指令被玩家们认为过于强大而被标记为作弊指令. 除非服主使用并明确了sv_cheats变量的值,否则那些被标记为作弊指令的将不会被执行,并且变量会变回初始值.

离线指令

大多数指令只在已连接到服务器时才有意义,除非连接到服务器,否则游戏会拒绝它们的执行.但有些指令在即使没有连接到服务器的情况下也有意义,它们便被标记为离线指令.

Replicated variables

Some variables must have the same value on both the server and the client. The game will temporarily override those variables on the client when connected to a server.

Archived variables

Some variables contain user settings that should persist across play sessions. They are stored in the config.cfg file by the game.

Protected variables

Certain variables contain data that should not be sent between clients and the server, such as passwords.

Demo required/forbidden

Some variables influence the recording of gameplay demos and as such need to be included/excluded from the demo recording.

Change notification

Some variables are deemed to be important enough to alert all players on the server when they are changed. Changes to these variables are shown among the chat text overlay.

Change notify variables are included by default in server rule queries done by external tools.

Special script files

Team Fortress 2 automatically reads several game files and executes any commands within them. Here is the list of those files:

  • config.cfg - This is the default configuration file which is edited to reflect any in-game changes to keybinds or video settings. It is safe to edit this file, but it will change to reflect any modified keybinds on startup. This config will run every time the game starts up, before any other config.
    • config_default.cfg - This contains a basic set of keybinds, and will be executed as a backup if config.cfg is not present.
  • autoexec.cfg - This is the default config file for executing custom keybinds and aliases. This config will run every time the game starts up, after config.cfg.
  • Each class has a config file which automatically runs whenever a player switches to that class. Note that any settings set in one classes config file will be retained when switching classes unless explicitly rebound. They are as follows:
    • scout.cfg, soldier.cfg, pyro.cfg, demoman.cfg, heavyweapons.cfg, engineer.cfg, medic.cfg, sniper.cfg, spy.cfg
  • A config file can be created for any map if it shares the same name, and will run whenever that map is loaded. For example, a cp_well.cfg file will be automatically run any time Well (Control Point) is loaded.

Script paths

If on Windows, scripting files may be found in:
<Steam Folder>/SteamApps/common/team fortress 2/tf/cfg
If on a Mac, scripting files may be found in:
~/Library/Application Support/Steam/SteamApps/common/team fortress 2/tf/cfg
If on Linux, scripting files may be found in:
~/.steam/steam/SteamApps/common/Team Fortress 2/tf/cfg

Since the SteamPipe update, code can also be placed in .../team fortress 2/tf/custom/yourfoldernamehere/cfg

远程控制台

Dedicated servers are exclusively controlled from the console. However, logging in to the server and reattaching to the console is a major hassle. Instead server administrators can use the remote console system. The game server runs an additional service that accepts console commands from remote clients. This is secured using a dedicated password.

Map issued commands

Maps can issue console commands using the point_servercommand, point_clientcommand and point_broadcastclientcommand entities.

参见