IConsole

Interface to the engine console.

C++
struct IConsole {
};
File

IConsole.h

Description

The engine console allow to manipulate the internal engine parameters and to invoke commands. This interface allow external modules to integrate their functionalities into the console as commands or variables.

IMPLEMENTATIONS NOTES: The console takes advantage of the script engine to store the console variables, this mean that all variables visible through script and console.

IConsole::~IConsole Destructor
C++
virtual ~IConsole();
IConsole::AddCommand Method (char *, ConsoleCommandFunc, int, char *)
C++
virtual void AddCommand(const char * sCommand, ConsoleCommandFunc func, int nFlags = 0, const char * sHelp = NULL) = 0;
Parameters
Parameters
Description
const char * sCommand
Command name.
ConsoleCommandFunc func
Pointer to the console command function to be called when command is invoked.
int nFlags = 0
Bitfield consist of VF_ flags (e.g. VF_CHEAT)
const char * sHelp = NULL
Help string, will be displayed when typing in console "command ?".
Description

Register a new console command.

IConsole::AddCommand Method (char *, char *, int, char *)
C++
virtual void AddCommand(const char * sName, const char * sScriptFunc, int nFlags = 0, const char * sHelp = NULL) = 0;
Parameters
Parameters
Description
const char * sScriptFunc
Script function to be executed when command is invoked.
int nFlags = 0
Bitfield consist of VF_ flags (e.g. VF_CHEAT)
const char * sHelp = NULL
Help string, will be displayed when typing in console "command ?".
sCommand
Command name.
Description

Register a new console command that execute script function. EG "Game.Connect(%1)" the symbol "%1" will be replaced with the command parameter 1 writing in the console "connect 127.0.0.1" will invoke Game.Connect("127.0.0.1")

IConsole::AddCommandToHistory Method
C++
virtual void AddCommandToHistory(const char * szCommand) = 0;
Description

! param szCommand must not be 0

IConsole::AddConsoleVarSink Method
C++
virtual void AddConsoleVarSink(IConsoleVarSink * pSink) = 0;
Description

Console variable sink. Adds a new console variables sink callback.

IConsole::AddOutputPrintSink Method
C++
virtual void AddOutputPrintSink(IOutputPrintSink * inpSink) = 0;
Description

add output sink (clases which are interested in the output) - order is not guaranteed @param inpSink must not be 0 and is not allowed to be added twice

IConsole::AutoComplete Method
C++
virtual const char* AutoComplete(const char* substr) = 0;
IConsole::AutoCompletePrev Method
C++
virtual const char* AutoCompletePrev(const char* substr) = 0;
IConsole::CalcCheatVarHash Method
C++
virtual void CalcCheatVarHash() = 0;
Description

Calculate the hash from current cvars

IConsole::Clear Method
C++
virtual void Clear() = 0;
Description

Clear the console text

IConsole::CreateKeyBind Method
C++
virtual void CreateKeyBind(const char * sCmd, const char * sRes) = 0;
Description

Bind a console command to a key @param sCmd console command that must be executed @param sRes name of the key to invoke the command

IConsole::Draw Method
C++
virtual void Draw() = 0;
Description

Draw the console

IConsole::DumpCVars Method
C++
virtual void DumpCVars(ICVarDumpSink * pCallback, unsigned int nFlagsFilter = 0) = 0;
Description

Dump all console-variables to a callback-interface @param Callback callback-interface which needs to be called for each element

IConsole::DumpKeyBinds Method
C++
virtual void DumpKeyBinds(IKeyBindDumpSink * pCallback) = 0;
Description

Dump all key bindings to a callback-interface @param Callback callback-interface which needs to be called for each element

IConsole::EnableActivationKey Method
C++
virtual void EnableActivationKey(bool bEnable) = 0;
Description

Enable or disable the activation key (tilde by default). This is useful when user is in a text field and want to be able to enter the default key. bEnable=true console will show bEnable=false console will no show

IConsole::ExecuteString Method
C++
virtual void ExecuteString(const char * command, const bool bSilentMode = false, const bool bDeferExecution = false) = 0;
Parameters
Parameters
Description
const char * command
console command e.g. "map testy" - no leading slash
const bool bSilentMode = false
true=suppresses log in error case and logging the command to the console
const bool bDeferExecution = false
true=the command is stored in special fifo that allows delayed execution by using wait_seconds and wait_frames commands
Description

Execute a string in the console

IConsole::Exit Method
C++
virtual void Exit(const char * command, ...);
Description

Print a message into the log and abort the execution of the application @param message error string to print in the log

IConsole::FindKeyBind Method
C++
virtual const char* FindKeyBind(const char * sCmd) const = 0;
IConsole::GetCheatVarAt Method
C++
virtual char* GetCheatVarAt(uint32 nOffset) = 0;
IConsole::GetCheatVarHash Method
C++
virtual uint64 GetCheatVarHash() = 0;
Description

Get the hash calculated

IConsole::GetCVar Method
C++
virtual ICVar* GetCVar(const char * name) = 0;
Description

Retrieve a console variable by name - not case sensitive @param name variable name @return a pointer to the ICVar interface, NULL if is not found @see ICVar

IConsole::GetHistoryElement Method
C++
virtual const char* GetHistoryElement(const bool bUpOrDown) = 0;
Description

param bUpOrDown true=after pressed "up", false=after pressed "down" return 0 if there is no history line or pointer to the null terminated history line

IConsole::GetImage Method
C++
virtual ITexture * GetImage() = 0;
Description

Retrieves the background-image @return background-image

IConsole::GetLineCount Method
C++
virtual int GetLineCount() const = 0;
Description

return current number of lines in the console

IConsole::GetLineNo Method
C++
virtual bool GetLineNo(const int indwLineNo, char * outszBuffer, const int indwBufferSize) const = 0;
Description

Iterate through the lines - used for dedicated server (truncated if needed) @param indwLineNo 0.. counted from the last printed line on @param outszBuffer pointer to the destination string buffer (zero terminated afterwards), must not be 0 @param indwBufferSize 1.. size of the buffer @return true=line was returned, false=there are no more lines

IConsole::GetMemoryUsage Method
C++
virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
Description

Calculation of the memory used by the whole console system

IConsole::GetNumCheatVars Method
C++
virtual int GetNumCheatVars() = 0;
Description

Get Number of cvars that can be hashed

IConsole::GetNumVars Method
C++
virtual int GetNumVars() = 0;
Description

Auto completion.

IConsole::GetSortedVars Method
C++
virtual size_t GetSortedVars(const char ** pszArray, size_t numItems, const char * szPrefix = 0) = 0;
Parameters
Parameters
Description
const char * szPrefix = 0
0 or prefix e.g. "sys_spec_" Return used size
IConsole::GetStatus Method
C++
virtual bool GetStatus() = 0;
Description

Retrieve the status of the console (active/not active) @return the variable value(true = active/false = not active)

IConsole::GetVariable Method (char *, char *, char *)
C++
virtual char * GetVariable(const char * szVarName, const char * szFileName, const char * def_val) = 0;
Description

Read a value from a configuration file (.ini) and return the value @param szVarName variable name @param szFileName source configuration file @param def_val default value (if the variable is not found into the file) @return the variable value

IConsole::GetVariable Method (char *, char *, float)
C++
virtual float GetVariable(const char * szVarName, const char * szFileName, float def_val) = 0;
Description

Read a value from a configuration file (.ini) and return the value @param szVarName variable name @param szFileName source configuration file @param def_val default value (if the variable is not found into the file) @return the variable value

IConsole::IsHashCalculated Method
C++
virtual bool IsHashCalculated() = 0;
Description

Since hash is calculated async, check if it's completed

IConsole::IsOpened Method
C++
virtual bool IsOpened() = 0;
Description

Return true if the console is opened @return the variable value(true = opened/false = closed)

IConsole::LoadConfigVar Method
C++
virtual void LoadConfigVar(const char * sVariable, const char * sValue) = 0;
IConsole::LoadInternalState Method
C++
virtual void LoadInternalState(struct IDataReadStream& reader) = 0;
IConsole::PrintCheatVars Method
C++
virtual void PrintCheatVars(bool bUseLastHashRange) = 0;
IConsole::PrintLine Method
C++
virtual void PrintLine(const char * s) = 0;
Description

Print a string in the console and go to the new line @param s the string to print

IConsole::PrintLinePlus Method
C++
virtual void PrintLinePlus(const char * s) = 0;
Description

Append a string in the last console line @param s the string to print

IConsole::ProcessCompletion Method
C++
virtual const char * ProcessCompletion(const char * szInputBuffer) = 0;
IConsole::Register Method (char *, char**, char*, int, char *, ConsoleVarFunc, bool)
C++
virtual ICVar * Register(const char * name, const char** src, const char* defaultvalue, int nFlags = 0, const char * help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0;
Parameters
Parameters
Description
const char** src
pointer to the memory that will be updated
int nFlags = 0
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
bool allowModify = true
allow modification through config vars, prevents missing modifications in release mode
sName
console variable name
Return
pointer to the interface ICVar
Description

Create a new console variable that will update the user defined pointer to null terminated string

IConsole::Register Method (char *, float *, float, int, char *, ConsoleVarFunc, bool)
C++
virtual ICVar * Register(const char * name, float * src, float defaultvalue, int nFlags = 0, const char * help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0;
Parameters
Parameters
Description
float * src
pointer to the memory that will be updated
int nFlags = 0
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
bool allowModify = true
allow modification through config vars, prevents missing modifications in release mode
sName
console variable name
Return
pointer to the interface ICVar
Description

Create a new console variable that will update the user defined float

IConsole::Register Method (char *, int *, int, int, char *, ConsoleVarFunc, bool)
C++
virtual ICVar * Register(const char * name, int * src, int defaultvalue, int nFlags = 0, const char * help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0;
Parameters
Parameters
Description
int * src
pointer to the memory that will be updated
int nFlags = 0
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
bool allowModify = true
allow modification through config vars, prevents missing modifications in release mode
sName
console variable name
Return
pointer to the interface ICVar
Description

Create a new console variable that will update the user defined integer

IConsole::RegisterAutoComplete Method
C++
virtual void RegisterAutoComplete(const char * sVarOrCommand, IConsoleArgumentAutoComplete * pArgAutoComplete) = 0;
IConsole::RegisterFloat Method
C++
virtual ICVar * RegisterFloat(const char * sName, float fValue, int nFlags, const char * help = "", ConsoleVarFunc pChangeFunc = 0) = 0;
Parameters
Parameters
Description
const char * sName
console variable name
float fValue
default value
int nFlags
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
Return
pointer to the interface ICVar
Description

Create a new console variable that store the value in a float

IConsole::RegisterInt Method
C++
virtual ICVar * RegisterInt(const char * sName, int iValue, int nFlags, const char * help = "", ConsoleVarFunc pChangeFunc = 0) = 0;
Parameters
Parameters
Description
const char * sName
console variable name
int iValue
default value
int nFlags
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
Return
pointer to the interface ICVar
Description

Create a new console variable that store the value in a int

IConsole::RegisterInt64 Method
C++
virtual ICVar * RegisterInt64(const char * sName, int64 iValue, int nFlags, const char * help = "", ConsoleVarFunc pChangeFunc = 0) = 0;
Parameters
Parameters
Description
const char * sName
console variable name
int64 iValue
default value
int nFlags
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
Return
pointer to the interface ICVar
Description

Create a new console variable that store the value in a int64

IConsole::RegisterString Method
C++
virtual ICVar * RegisterString(const char * sName, const char * sValue, int nFlags, const char * help = "", ConsoleVarFunc pChangeFunc = 0) = 0;
Parameters
Parameters
Description
const char * sName
console variable name
const char * sValue
default value
int nFlags
user defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data)
const char * help = ""
help text that is shown when you use ? in the console
Return
pointer to the interface ICVar
Description

Create a new console variable that store the value in a string

IConsole::Release Method
C++
virtual void Release() = 0;
Description

Deletes the console

IConsole::RemoveCommand Method
C++
virtual void RemoveCommand(const char * sName) = 0;
Parameters
Parameters
Description
sCommand
Command name
Description

Removes a console command which was previously registered with AddCommand.

IConsole::RemoveConsoleVarSink Method
C++
virtual void RemoveConsoleVarSink(IConsoleVarSink * pSink) = 0;
Description

! Removes a console variables sink callback.

IConsole::RemoveOutputPrintSink Method
C++
virtual void RemoveOutputPrintSink(IOutputPrintSink * inpSink) = 0;
Description

remove output sink (clases which are interested in the output) - order is not guaranteed @param inpSink must not be 0 and has to be added before

IConsole::ResetAutoCompletion Method
C++
virtual void ResetAutoCompletion() = 0;
IConsole::ResetProgressBar Method
C++
virtual void ResetProgressBar(int nProgressRange) = 0;
Description

Function related to progress bar

IConsole::SaveInternalState Method
C++
virtual void SaveInternalState(struct IDataWriteStream& writer) const = 0;
Description

Save/Load internal state (CVars) - used by LiveCreate

IConsole::SetCheatVarHashRange Method
C++
virtual void SetCheatVarHashRange(size_t firstVar, size_t lastVar) = 0;
Description

Set the range of cvars

IConsole::SetImage Method
C++
virtual void SetImage(ITexture * pImage, bool bDeleteCurrent) = 0;
Description

Sets the background-image @param pImage background-image

IConsole::SetInputLine Method
C++
virtual void SetInputLine(const char * szLine) = 0;
Parameters
Parameters
Description
const char * szLine
must not be 0
IConsole::SetLoadingImage Method
C++
virtual void SetLoadingImage(const char * szFilename) = 0;
Description

Sets the loading-background-image @param pImage background-image

IConsole::SetScrollMax Method
C++
virtual void SetScrollMax(int value) = 0;
Description

Set the y coordinate where the console will stop to scroll when is dropped @param value y in screen coordinates

IConsole::ShowConsole Method
C++
virtual void ShowConsole(bool show, const int iRequestScrollMax = -1) = 0;
Description

show/hide the console @param specifies if the window must be (true=show,false=hide) @param specifies iRequestScrollMax <=0 if not used, otherwise it sets SetScrollMax temporary to the given value

IConsole::StaticBackground Method
C++
virtual void StaticBackground(bool bStatic) = 0;
Description

Sets static/scroll background-mode @param bStatic true if static

IConsole::TickProgressBar Method
C++
virtual void TickProgressBar() = 0;
Description

Function related to progress bar

IConsole::UnRegisterAutoComplete Method
C++
virtual void UnRegisterAutoComplete(const char * sVarOrCommand) = 0;
IConsole::UnregisterVariable Method
C++
virtual void UnregisterVariable(const char * sVarName, bool bDelete = false) = 0;
Description

! Remove a variable from the console @param sVarName console variable name @param bDelete if true the variable is deleted @see ICVar

IConsole::Update Method
C++
virtual void Update() = 0;
Description

Update the console