Plantilla:Command

De WikiMinecraft
Saltar a: navegación, buscar
Template-info.png Documentación
Lua logo.png
Esta plantilla usa Módulo:Command, un script escrito en el lenguaje de programación Lua. Por favor lea mw:Lua y mw:Extension:Scribunto para saber más del lenguaje Lua.
Atajo
cmd

This template is used to generate auto-formatted commands. Commands can either be pasted directly into the template (with or without a slash), or each parameter specified as a separate argument.

Any parameter that isn't specified or is set to an empty value or ? will be replaced with the default parameter for the command, if it is a known command and a valid parameter. Specified optional parameters will be displayed as if required, along with any other parameters in the optional group. Unspecified optional parameters won't be displayed.

These parameters are formatted as follows:

  • Parameters that do not have to be entered to use a command are given in parentheses.
  • If a given parameter can accept one of several different values, the values are listed in square brackets ([]) and separated by pipes, e.g. [val1|val2].
  • Parameter names are enclosed in angled brackets and italicized, e.g. <player>.
  • Parameter values are given as plaintext and enclosed with square brackets, e.g. [true].
  • These are combined as necessary, e.g. <operation:[start|stop]> or <operation:[add <player>|remove <player>|list|on|off|reload]>

Arguments

  • To output the rest of the command including optional parameters, add ... to the template.
  • To remove the forward slash, add |/=0 or |slash=0 to the template.
  • To change the command name's link, add |link=<link> to the template.
  • To remove the command name's link, add |link=none to the template.
  • To add HTML in the command, add |escape=0 to the template. It's then your responsibility to <nowiki> anything that looks like HTML but isn't.
  • If a command is long and may go off the edge of the screen, add |long=1 to the template. This allows the code to wrap as well as displaying it on its own line.

Examples

{{cmd|kill}} 
/kill
{{cmd|clear|?|diamond}} 
/clear <player> diamond <data-value>
{{cmd|give ? diamond 64}} 
/give <player> diamond 64
{{cmd|give ? diamond 64|...}} 
/give <player> diamond 64 (<damage-value>)
{{cmd|say I'm saying stuff!}} 
/say I'm saying stuff!
{{cmd|op|...}} 
/op <player>
{{cmd|give|...}} 
/give <player> <data-value> <amount> (<damage-value>)
{{cmd|time|...}} 
/time <operation:[set|add]> <number>
{{cmd|whitelist|...}} 
/whitelist <operation:[add <player>|remove <player>|list|on|off|reload]>
{{cmd|tp|...}} 
/tp <player> [<destination-player>|<x> <y> <z>]
{{cmd|?|...}} 
/? ([<page>|<command>])
{{cmd|give ? command_block 1 0 {BlockEntityTag:{Command:"{{cmd|setblock ~ ~ ~ diamond_block}}"<nowiki>}}</nowiki>}}
/give <player> command_block 1 0 {BlockEntityTag:{Command:"/setblock ~ ~ ~ diamond_block"}}
{{cmd|long=1|setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Chicken, MaxNearbyEntities:10, SpawnCount:6, SpawnRange:2, RequiredPlayerRange:16, MinSpawnDelay:50, MaxSpawnDelay:200, SpawnData:{Riding:{id:"Pig"<nowiki>}}}</nowiki>}}
/setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Chicken, MaxNearbyEntities:10, SpawnCount:6, SpawnRange:2, RequiredPlayerRange:16, MinSpawnDelay:50, MaxSpawnDelay:200, SpawnData:{Riding:{id:"Pig"}}}

Pitfalls

  • Commands containing equals signs or vertical pipes must be escaped to display correctly. For equals, if using a single argument place 1= at the start of the command, otherwise replace each equals sign with {{=}}. For vertical pipes replace each one with {{!}}.
  • Commands containing braces must be careful not to end with a brace or have two or more next to each other. In a case such as: {{cmd|data {some:"data"}}}, a space can simply be placed at the end of the command: {{cmd|data {some:"data"} }}. In a case such as: {{cmd|data {some:{more:"data"}}}}, <nowiki> tags must be placed around the problem area: {{cmd|data {some:{more:"data"<nowiki>}}</nowiki>}} or {{cmd|data <nowiki>{some:{more:"data"}}</nowiki>}}, whatever is more readable.
  • In order to count dataTags and sub-commands as a single parameter, spaces inside are ignored. However this won't work if a command contains multiple separate dataTags or multiple separate sub-commands. In that case, use separate arguments for the parameters.

La documentación anterior se transcluye de Plantilla:Command/doc. (edit | history)