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
namestringThe command's long name.
Returns
Exceptions
- ArgumentNullException
nameisnull.
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
namestringThe command's long name.
Returns
- int?
Exceptions
- ArgumentNullException
nameisnull.
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
namestringThe command's long name.
Returns
- int?
Exceptions
- ArgumentNullException
nameisnull.
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
namestringThe command's long name.
Returns
Exceptions
- ArgumentNullException
nameisnull.
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
namestringThe command's long name.
Returns
Exceptions
- ArgumentNullException
nameisnull.
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
referenceTObjectReferenceThe reference the command targets.
namestringThe command's long name.
Returns
Type Parameters
TObjectReference
Exceptions
- ArgumentNullException
nameisnull.
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
commandLinestringThe 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
commandLineisnull.
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
referenceTObjectReferenceThe reference the command targets.
commandLinestringThe 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
commandLineisnull.
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
referenceTObjectReferenceThe reference the command targets.
namestringThe command's long name.
Returns
Type Parameters
TObjectReference
Exceptions
- ArgumentNullException
nameisnull.