Table of Contents

Interface IConsoleCommands

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

Runs the console commands the game declares, and reports the arguments one of them declares.

public interface IConsoleCommands

Remarks

Call members on the game's thread.

Methods

Exists(string)

Determines whether the game has a console command by this name.

bool Exists(string name)

Parameters

name string

The command's long name.

Returns

bool

Exceptions

ArgumentNullException

name is null.

GetArgumentCount(string)

Reads how many arguments a command declares, or null where the game has no such console command. An argument may be optional, so read GetRequiredArgumentCount(string) to determine whether Run(string) will call the command.

int? GetArgumentCount(string name)

Parameters

name string

The command's long name.

Returns

int?

Exceptions

ArgumentNullException

name is null.

GetRequiredArgumentCount(string)

Reads how many arguments a command requires, or null where the game has no such console command. Anything but zero means Run(string) will not call it, since no argument is passed.

int? GetRequiredArgumentCount(string name)

Parameters

name string

The command's long name.

Returns

int?

Exceptions

ArgumentNullException

name is null.

Run(string)

Runs a command with no reference selected and returns whether it ran and reported success.

Returns false without running anything where the game has no such console command, where the command requires an argument, and where the command declares that it runs on a reference.

bool Run(string name)

Parameters

name string

The command's long name.

Returns

bool

Exceptions

ArgumentNullException

name is null.

RunAndGetResult(string)

Runs a command with no reference selected and returns the number it reported, which the game writes for every command whether or not it means anything. It returns null where the game has no such console command, where the command requires an argument, and where the command declares that it runs on a reference. A command that reported false still returns its number.

double? RunAndGetResult(string name)

Parameters

name string

The command's long name.

Returns

double?

Exceptions

ArgumentNullException

name is null.

RunAndGetResult<TObjectReference>(TObjectReference, string)

Runs a command on this reference and returns the number it reported, which the game writes for every command whether or not it means anything. It returns null where the game has no such console command and where the command requires an argument. A command that reported false still returns its number.

double? RunAndGetResult<TObjectReference>(TObjectReference reference, string name) where TObjectReference : IObjectReference

Parameters

reference TObjectReference

The reference the command targets.

name string

The command's long name.

Returns

double?

Type Parameters

TObjectReference

Exceptions

ArgumentNullException

name is null.

RunLine(string)

Runs a whole command line, arguments and all, with no reference selected, by passing the text to the game's compiler. A line names its own reference where it needs one, as player.additem f 100 does.

bool RunLine(string commandLine)

Parameters

commandLine string

The text as it would be typed, such as coc WhiterunBanneredMare.

Returns

bool

Whether the text reached the compiler. It is false where the game has no factory for a script.

Remarks

The game returns no result, so what a command produced is read afterwards from ConsoleLog.LastMessage, where it prints. A command the compiler rejects prints its complaint there and returns true, the game reporting a rejection nowhere else.

Exceptions

ArgumentNullException

commandLine is null.

RunLine<TObjectReference>(TObjectReference, string)

Runs a whole command line, arguments and all, by passing the text to the game's compiler. It runs a command that requires an argument, which Run(string) does not call.

bool RunLine<TObjectReference>(TObjectReference reference, string commandLine) where TObjectReference : IObjectReference

Parameters

reference TObjectReference

The reference the command targets.

commandLine string

The text as it would be typed, such as player.additem f 100.

Returns

bool

Whether the text reached the compiler. It is false where the game has no factory for a script.

Type Parameters

TObjectReference

Remarks

The game returns no result, so what a command produced is read afterwards from ConsoleLog.LastMessage, where it prints. A command the compiler rejects prints its complaint there and returns true, the game reporting a rejection nowhere else.

Exceptions

ArgumentNullException

commandLine is null.

Run<TObjectReference>(TObjectReference, string)

Runs a command on this reference and returns whether it ran and reported success.

Returns false without running anything where the game has no such console command, and where the command requires an argument. That second case is the important one: no argument is passed, and a command needing one would read a value nothing wrote. Read GetRequiredArgumentCount(string) to tell a false that never ran from a false the command itself reported.

bool Run<TObjectReference>(TObjectReference reference, string name) where TObjectReference : IObjectReference

Parameters

reference TObjectReference

The reference the command targets.

name string

The command's long name.

Returns

bool

Type Parameters

TObjectReference

Exceptions

ArgumentNullException

name is null.