Skip to main content
Version: 0.1.0

Console commands

The WukongMP SDK includes a command console accessible by pressing F1 on your keyboard.

Keyboard shortcuts​

BindingAction
TABAuto-complete the selected command
Alt + ↑Previous command
Alt + ↓Next command

Defining custom commands​

Use the Console API to define custom commands.

Register commands without parameters​

void RebirthAtShrine() { ... }
// ...
{
WukongApi.Console.AddCommand("rebirth_shrine", ConsoleCommand.Create(RebirthAtShrine));
}

Require parameters​

The command parameters are deducted from the handler signature - supported types are string, int, float, double, and bool. Parameters can be optional, in which case a default value must be provided.

void TeleportToShrine(int shrine = 1001) { ... }
// ...
{
WukongApi.Console.AddCommand("teleport_shrine", ConsoleCommand.Create(TeleportToShrine));
}

Define auto-completed paremeters​

You can define a list of parameter values that will be displayed when the command is typed in. These values will be selectable with arrow keys and auto-completeable with TAB.

IEnumerable<string> GetAllValidUnitNames() => ["wolf_soldier", "wolf_sentinel", "gold_rhino"];

void SpawnMonster(string monsterType) { ... }
// ...
{
WukongApi.Console.AddCommand("spawn", ConsoleCommand.Create(SpawnMonster), GetAllValidUnitNames());
}