Skip to content

Command List

offyerrocker edited this page Jun 11, 2019 · 6 revisions

Command Usage and Syntax

For documentation on usage and syntax of Lua functions within class Console, please invent a time travel machine, go to the future, and read the documentation page there.

Commands are always one word (special characters allowed), prefixed by "/".

A hypothetically unlimited number of arguments may follow, each separated by one (1) space.

All command arguments are interpreted as strings, and converted to other data types at the discretion of the command function in question.

General Command Format:

/COMMANDNAME ARGUMENT1 ARGUMENT2 ARGUMENT3 [...]

Please note that spaces divide arguments by default; to include arguments which contain spaces, you must use semicolons.

Example:

/COMMANDNAME ARGUMENT1; ARGUMENT 2; ARGUMENT3; ARGUMENT 4 AND STUFF; ARGUMENT4


/help [commandname]

commandname: [string or number]

Provides a basic description of the command to the Console window.

If commandname is not supplied, then lists all valid Commands to Console window. Also supplies a link to this documentation page, followed by a list of commands to use (by page).


//

Yes, that's right, two forward slashes. No spaces or anything, or else the command will fail. Repeats the last command or Lua snippet sent to the console. (Keybind-activated commands or Lua snippets are not counted.) If execution of the last command failed, I'd bet that this time will probably fail too. (This command does display the actual command that was sent beyond simply "//", so you can see what you're doing. At least, after you do it.)


/about

Displays information about PD2-Console mod, including general purpose and Creative Commons license.


/contact

Displays contact information for the author (me, offyerrocker!) to console.


/say [message]

message: [any datatype, converted tostring()] Sends a message to all players via PD2's chat, containing your message.


/whisper [peer_id] [message]

peer_id: [number 1-4]

message: [string]

Sends a private chat message to the peer specified.


/quit [confirm]

confirm: [boolean] Closes the game via Application:Close(). Displays a confirmation prompt so that you don't do it by accident. If confirm is true, the confirmation prompt will be skipped and you will quit immediately.


/restart (optional: timer)

timer: [number] Only works in offline mode or where you are the host. If timer is specified and above zero, initiates a countdown of timer seconds, after which the heist restarts. Else if timer is not specified, or is less than or equal to zero, the heist will restart immediately.


/date [formatting]

formatting: [string]

Outputs the date.

Can be: "weekday", "shortday", "day", "shortmonth", "month", "fullmonth", "year", or "shortyear". Can also be any normal formatting pattern as dictated by os.date(). See https://www.lua.org/pil/22.1.html for details. (Please note that patterns must contain an extra % character in order to escape it. For example: "%%m" for "%m")

If no arguments are supplied, then supplies os.date("%x") by default, which is formatted as DD/MM/YYYY hh:mm:ss.


/time [formatting]

formatting: [string]

Outputs the time.

Can be: "hour", "minutes", or variants thereof. Can also be any normal formatting pattern as dictated by os.date(). See https://www.lua.org/pil/22.1.html for details. (Please note that patterns must contain an extra % character in order to escape it. For example: "%%M" for "%M")

If no arguments are supplied, then supplies os.date("%X") by default, which is formatted as hh:mm:ss.


/epoch [formatting] Outputs the time since the Unix epoch: Jan 1, 1970. Can be any normal formatting pattern as dictated by os.time(). See https://www.lua.org/pil/22.1.html for details.


/clock [formatting] Outputs the runtime of the current session, in seconds. Can be any normal formatting pattern as dictated by os.clock(). See https://www.lua.org/pil/22.1.html for details.


/ping [peer_id]

peer_id: [number, 1-4]

Outputs the connection time (in milliseconds) to the selected peer.

If peer_id is not specified, outputs the connection time to each player in the lobby.


/exec [path]

path: [string] Also known as: /dofile Just a shortname for dofile() in a pcall().


/track [subcommand] [id] [arg3] [arg4] ... subcommand: [string] Action to execute. This can be : add, remove, list, select, setxy, or set.

Uses Console's Debug HUD to display values that may change too quickly for a standard debug log (eg. BLT's log() function and accompanying cmd prompt window) to keep up with, at least without extremely noticeable performance impact.
id: The name of the Debug HUD element.. If the Debug HUD element with this id already exists, that Debug HUD element's contents will be replaced with the contents of [info]. If the element with this id does not exist, one will be created, and it will be set to display the value of [info]. This will only update when called; to keep this value updated, see Console: Functions and Persist Script Tracker after I make it in 30 years when I'm a crotchety pile of creaky bones and dust bunnies

Argument id: [string] The identifier for this value. Two trackers cannot have the same identifier; instead, one will overwrite the other. id is a valid argument for all of the following subcommands.

Subcommand add: Also known as new or create Adds a tracker with name id. This tracker can then be manipulated or viewed.

Subcommand list: No arguments. Lists each tracker by its name and a number. You can then use subcommand select to select the tracker.

Subcommand select: id: [number] For this subcommand only, number is the listed number of the desired tracker, as listed by subcommand list.

Subcommand setxy: (arg3) x: [number] (arg4) y: [nuumber] Moves the tracker element on the HUD to the x/y coordinates specified.

Subcommand remove: Also known as delete Removes the tracker with name id. This deletes it from the HUD, and from memory.

Subcommand color: Also known as setcolor (arg3): r [number] (arg4): g [number] (arg5): b [number] (arg6): a [number] Sets the tracker with name id to the color specified. Default values are all 1.

Subcommand set: (arg3) value: [any] Sets the tracker to display this value.


/writetodisk [data] [pathname]

Also known as: /savetable, /dosavetable data: [table] pathname: [string] Writes data to a file in encoded JSON format. Identical to _G.SaveTable() or BLT's Utils.DoSaveTable().


/stop process_id

process_id: [string] Removes the persist_script with id [process_id], stopping it from running. For more information, see Console: Persist Script Trackers.


/bind and related commands

/bind and /bindid are extremely useful commands that run a command through the console whenever the key or keybind is pressed. This command may be a standard command (eg: /bindid dcc_keybind_1; /say Boop!; will output "Boop!" to chat whenever keybind with id "dcc_keybind_1" is pressed) or a snippet of Lua code (eg: "/bind m; Console:Log('I pressed keybind_1!',{color = Color.green});" will output "I pressed keybind_1" to the Console window in bright green whenever the key "m" is pressed).

Keys can be bound to multiple commands; however, they must currently be bound one at a time. Beware that you can cause infinite loops (and thus, effectively crashes) with this command; mod responsibly, kids. If command is not specified, Console will output to the console window all commands linked to this bind. These keybinds are separate from normal BLT or vanilla keybinds, and as such, will not interfere with them. Requires HoldTheKey probably idk

/bind [key_name] [command] [optional: held]

key_name: [string] The name of the key to bind. Example: "y"

command: [string] The command string to interpret and execute. This can be a Lua snippet or a command. Examples: return 3 or `/say Hello!" Please note that arguments which contain spaces must be separated with a semicolon.

held: [boolean] Whether or not this command should run every frame while the key is held. If not specified, this defaults to false, which means that the function will only occur once per keypress.


/bindid [keybind_id] [command] [optional: held]

keybind_id: [string] The id of the BLT keybind to bind. Example: "dcc_commandprompt_toggle"

command: [string]


/unbind [bind] bind: [string] Unlinks all command from the specified key or keybind_id. This can be either a BLT keybind, or a key name. These keybinds are separate from normal BLT or vanilla keybinds, so /unbind cannot be used to unbind BLT or normal vanilla keybinds.


/unbindall

Unbinds all commands from all keybinds. These keybinds are separate from normal BLT or vanilla keybinds, so /unbind cannot be used to unbind BLT or normal vanilla keybinds.


/tp [x] [y] [z] Also known as: /teleport x,y,z: [numbers] The coordinates on the map to teleport to.

If position is not specified, then the local player (you) will move to the waypoint selected. See Console: Tagging and Manipulation

NOT IMPLEMENTED:

The subsequent listed commands are planned but not added or fully functional yet.


/tpbot [name] [optional: position] Also known as: /teleportbot name: [string] If position is a string equal to blah blah blah just see Console's documentation on position evaluation Name is the bot's character name. (Internal worknames can also be used.) For example, "Dallas", "Hoxton", or "Wolf"; or, "american", "spanish", or "russian". (i don't actually know them right now) Example: /tpbot "Dallas" Vector3(-420,69,1337)


/playsound [sound_id] [optional: sync]

sound_id: [string] sync: [boolean] Plays [sound_id] from your player. If sync evaluates to a non-false/non-nil value, the sound is played to any other players in your game.


/stopsound

Stops any sounds that are currently playing from your player, including ones played via /playsound.


/select unit

unit: [userdata-unit] Selects this unit. Only one unit can currently be selected at a time with this command. (Multi-select for mass-manipulation is planned in the future.) Your selected unit will, by default, have its information displayed on the Debug HUD. This information varies depending on the type of unit selected, but will include: Unit Type, Unit Health (where applicable) Unit Name, and Unit Idstring. For more information on the Debug HUD, please invent a second time travel machine, use it to travel back one paragraph ago, and steal the first time machine from that jerk.


/deselect

Deselects your currently selected unit. (In the future, this will take one argument [unit] and remove the unit from multi-selections, if active.)


/position [source]

source: [string or Vector3] Where to derive the Vector3 from. If source is a string equal to "waypoint" then Console will search for a Vector3 waypoint created with Console's waypoint keybind and use it if valid. If source is a string equal to "me" and the player is alive (in the world and not in custody), then Console will use the player's current position. If source is a string equal to "none" or "remove" then position will be reset to nil. If the source is a Vector3, Console will save that. This position value will be used by default for some unit-manipulation commands which require a location in the world as an argument, like /tp, /nearestunit or /spawn.

For more information on Console keybinds and the waypoint feature, please stop stealing my time machines, I need those to win the lottery and prevent 7/11.


/spawn unit path [optional: position]

unit: [userdata-unit] unit to spawn. (See Chat Commands for implementation) path: [string] path to spawn unit from. position: position to spawn unit at. If position is not specified, will use tagged position. If tagged position is not specified, will use fwd_ray.position or player location, depending on your settings. See documentation on Console Settings for more information.


/nearestunit [optional: position] [mask1] [mask2] [mask3] [...] position: [Vector3 or string] See "position interpretation". If not vector3 or string, uses default position. See documentation on Console Settings for more information. mask[n]: [integer] mask[n] arguments are filters for using the game's slotmask system. They are useful for getting only a specific type of unit (deployable equipment, cops, heisters, etc.) Also logs distance to this unit in the Console window.


/stats [target] [stat]

target: [string or userdata-unit] stat: [string] /stats is used to display tweakdata information about the indicated or selected object [target]. If [stat] is not specified, Console will display a preset list of tweakdata values about this object, depending on the type of object. For example, [target] "weapon" with no [stat] will print standard weapon tweakdata values (with attachment changes) including but not limited to Damage, Recoil/Kick, Magsize, Total Ammo, and Rate of Fire. Target can be "armor", "enemy", "weapon", or "player" some other stuff probably. More at 11.


/freezeai [enabled]

enabled: [boolean] Enables or disables AI according to enabled. If enabled is not specified, /freezeai will toggle AI to whatever state they were not in before (enabled if previously disabled; disabled if previously enabled)


/info

Not implemented


/printmods [optional: peer_id] peer_id: [integer [1-4] ] The player whose mods will be printed. If peer_id is not specified, Console will print out a list of your own mods. Else, Console will print out a list of their mods (as shared by that player; be aware that players can use mods to conceal or modify the appearance of their modlist to other players.)


/deployable [name] [optional: position] [data] name: [string] position: [string or vector3] data: [table] Spawns a deployable of type name at position specified. If no position argument is supplied, Console will use the currently selected position, or failing that, the player's position or fwd_ray.position, depending on settings. See Console Mechanics: Position for more information. data, if provided, will be applied to the deployable after spawning. This can be used to change the deployable's amount, or attributes such as its upgrade_level, or whether it has traits such as Uppers Aced. Example: /deployable "doctor_bag" {_amount = 8, upgrade_lvl = 2}


/custody Puts you in custody.


/uncustody Gives you an ice cream sandwich, what do you think it does?


/loadlevel [level_id] level_id: [string] Immediately loads the player into the selected level. Only works in singleplayer.


/loadasset [path] path: [string] Loads asset via DB:load_asset(). Returns true if operation successful, else returns false.

Clone this wiki locally