Table of Contents

Interface IConsoleCommandRegistrar

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

Adds console commands that run managed handlers.

public interface IConsoleCommandRegistrar
Extension Methods

Remarks

The console command table has a fixed size, so each command replaces an entry the game has disabled: one whose name begins with a space, which the console cannot match. Skyrim 1.6.1170 has 43 such entries. A command remains until the game exits. Every argument is optional text. Call members on the game's thread.

Methods

Register(string, string?, string, IEnumerable<string>, Func<ObjectReference?, IReadOnlyList<string>, Task>)

Adds a console command whose handler returns a task.

void Register(string name, string? shortName, string help, IEnumerable<string> parameterNames, Func<ObjectReference?, IReadOnlyList<string>, Task> handler)

Parameters

name string

The name the console matches, regardless of case.

shortName string

A second name the console matches, or null.

help string

The text the console's help command shows.

parameterNames IEnumerable<string>

One name per argument. The console passes as many arguments as were entered, up to this count.

handler Func<ObjectReference?, IReadOnlyList<string>, Task>

Runs on the game's thread for a command typed in the console, and on the caller's thread for one run through IConsoleCommands. The console does not wait for its task. An exception it throws, or one its task faults with, is written to the plugin's log.

Exceptions

ArgumentNullException

name, help, parameterNames, or handler is null.

ArgumentException

name is empty, a name contains white space, or a console or script command already has name or shortName.

InvalidOperationException

No disabled entry remains.