Simple Command Console


The simple command console provides an easy to use dos-style command parser featuring commands, helps, and aliases.

The simple command console is ready to go right out of the box. Simply import the entity into your project, and add it to your screen. Then use the following public methods to add new commands, helps or aliases:

void RegisterCommand(string name, string helpText, CommandTarget target)
void RegisterCommandAlias(string alias, string commandName)
void RegisterHelp(string name, string helpText)
void RegisterHelpAlias(string alias, string helpName)

CommandTarget is provided by the entity and is defined as:
public delegate void CommandTarget(string args)

While using the console, you can scroll the back-buffer up and down using page-up, page-down, home, and end. You can also scroll through the input history using the up and down arrow keys.

The console can be toggled from full to mini display mode by pressing the tilde(~) key. While in mini display mode the console will not respond to any key presses other than the tilde key.

All commands in the simple command console begin with a forward slash. If you type anything without the forward slash it will look to see if you have registered a "say" command allowing the console to double as a chat console.

If the output display is too wide for the console's settings, it will auto-wrap the output to the last available space between characters.

The console window display can be customized using the various variables that have been exposed.

X,Y : sets the bottom left corner of the console window
Z : sets the z-buffer of the display so it can show up over other sprites
NumOutputLines : The number of output lines visible in full display mode
NumCharOnLine : The number of characters allowed on each line
CursorBlinkRate : How fast the cursor should blink, smaller number is faster blink
FullDisplay : if the console is currently in full display mode
NumLinesInPartialDisplay : how many lines should be shown while in partial display mode
InputHistoryLength : how many different inputs should it remember at once
BackBufferHistoryLength : the total number of lines to be stored in the backbuffer

NOTE: The console currently only accepts input from InputManager.Keyboard

Product File: 
Syndicate content