ff_u_con_clear
Add console commands: clear and cls
Clears the screen.
Variables
ENABLE__FF_U_CON_CLEAR: (string) (opt-out) Set to “N” on module disable unit.
Source code
// @code
#include "ff_i_core"
const string ENABLE__FF_U_CON_CLEAR = "ENABLE__FF_U_CON_CLEAR";
// -----------------------------------------------------------------------------
void main()
{
if (!GetModuleFlag(ENABLE__FF_U_CON_CLEAR, TRUE))
return;
string sEvent = GetCurrentEvent();
if (sEvent == ON_REGISTER)
{
RegisterConsoleCommand("clear", __FILE__);
RegisterConsoleCommand("cls", __FILE__);
RegisterConsoleCommand(GetASCIIChar(12), __FILE__); // ctrl-l
SubscribeToEvent(ON_CONSOLE_COMMAND_HELP, __FILE__);
}
else if (sEvent == ON_CONSOLE_COMMAND_HELP)
NWNX_Util_RawPrint(GetStringRightPad("clear", CONSOLE_HELP_PAD) + "- Clear the screen");
else if (sEvent == GetConsoleEventName("cls"))
ConsoleClearScreen();
else if (sEvent == GetConsoleEventName("clear"))
ConsoleClearScreen();
else if (sEvent == ON_CONSOLE_COMMAND + "__" + GetASCIIChar(12))
ConsoleClearScreen();
}