콘텐츠로 이동

The F8 console

이 콘텐츠는 아직 번역되지 않았습니다.

Every player can press F8 in a GDMP session (Play and Build) for the GDMP console: it drops down from the top of the game with the client log as it is written, a command line, and the Draw FPS / Draw network overlays. F8 or ESC closes it; while it is open the game gets no input.

  • The log: every line GDMP writes, with its time, level and tag ([SESSION], [JS], [VOICE] …). Filter by Info / Warnings / Errors, search (matches are highlighted), Copy log puts the whole log on the clipboard – the fastest way to send a creator or the GDMP team what happened.
  • Commands: type and press Enter. Tab completes a command, the arrow keys go through the history.
  • Draw FPS: frames per second, the frame time and the worst frame, with a 15-second graph.
  • Draw network: the ping, UDP or TCP, upload and download, packets in, players, with a ping graph.
GDMP command
help every command, GDMP’s and the experience’s
clear empties the console
fps [on|off] / net [on|off] Draw FPS / Draw network
ping the round trip to the server
players who is here: id, name, GDMP account
version GDMP’s protocol and API, the experience and its version
respawn respawn (Play)
menu opens the GDMP menu
copy the whole log to the clipboard
leave back to the launcher

Your own commands: gdmp.console (client, API 120)

Section titled “Your own commands: gdmp.console (client, API 120)”
register(name, description, handler) offers a command; handler(args, line) runs when a player types it and may return what the console shows
print(...values) warn(...values) error(...values) a line in the console
  • name: 1..24 of a-z 0-9 _ -, starting with a letter; GDMP’s own names cannot be taken. The same name again replaces the handler. At most 32 commands.
  • args is what follows the name, split on spaces; line is the same text as typed.
gdmp.console.register('give', 'give yourself an item: give <item> [count]', (args) => {
const [item, count = '1'] = args;
if (!item) return 'give <item> [count]';
inventory.add(item, Number(count));
return `Gave you ${count} ${item}.`;
});

Commands run on the player’s own client, like everything else in a client script. Anything that matters to other players (an item, a score) still goes through the server: send it with gdmp.net and let the server decide.

The declarations from the GDMP types (namespace GDMP):

interface Console {
/** `name`: 1..24 of `a-z 0-9 _ -`, starting with a letter. The handler may return what the console shows. */
register(name: string, description: string, handler: (args: string[], line: string) => unknown): void;
print(...values: unknown[]): void;
warn(...values: unknown[]): void;
error(...values: unknown[]): void;
}