CLUAConsole Class


Overview

Note

The CLUAConsole class handles the ingame Lua console for entering supported commands and functions

There is no structure associated with this class


Quick Reference

Quick Ref

void CLUAConsole::AddGold(unsigned long dwGold)

void CLUAConsole::AddSpell(CString resRef, int characterId)

void CLUAConsole::AdvanceRealTime(unsigned long gameTime)

void CLUAConsole::CreateCreature(CString res)

void CLUAConsole::CreateEngine(int nEngine)

void CLUAConsole::CreateItem(CString res, short usage1, short usage2, short usage3, int characterId)

void CLUAConsole::CreateVEFVidCell(CString resRef)

void CLUAConsole::DisplayAllBAMFiles()

void CLUAConsole::DisplayText(CString text)

void CLUAConsole::EnableCheatKeys(int bEnable)

void CLUAConsole::Eval(CString script, int characterId)

void CLUAConsole::Exec(char* file)

void CLUAConsole::ExploreArea()

void CLUAConsole::GetGlobal(CString globalName, CString areaName)

void CLUAConsole::LogMessages(int bEnable)

void CLUAConsole::LogSet(CString resRef)

virtual void __cdecl CLUAConsole::LuaInit()

virtual void __cdecl CLUAConsole::LuaUninit()

void CLUAConsole::MoveToArea(CString text)

void CLUAConsole::PickDialog(int table)

void CLUAConsole::PlayMovie(CString resRef)

void CLUAConsole::PlaySound(char* res, short volume, unsigned long frequency)

void CLUAConsole::ResetAchievements()

void CLUAConsole::SetCurrentXP(unsigned long dwCurrentXP)

void CLUAConsole::SetGlobal(CString globalName, CString areaName, long value)

void CLUAConsole::SetWaterAlpha(unsigned long dwAlpha)

void CLUAConsole::SetWeather(unsigned char nWeather)

void CLUAConsole::StartStore(char* resref)

void CLUAConsole::StrrefOff()

void CLUAConsole::StrrefOn()

void CLUAConsole::TestAllDialog()

void CLUAConsole::WorkshopUpload(char* name, char* path)

void CLUAConsole::WriteScript(CString ref, int characterId)


Methods

Name

Description

CLUAConsole::AddGold

Adds gold to the party

CLUAConsole::AddSpell

Adds a spell to the specified character

CLUAConsole::AdvanceRealTime

Advance time

CLUAConsole::CreateCreature

Creates the creature specified

CLUAConsole::CreateEngine

Unknown

CLUAConsole::CreateItem

Create an item

CLUAConsole::CreateVEFVidCell

Create VEFVidCell

CLUAConsole::DisplayAllBAMFiles

Display all BAM files

CLUAConsole::DisplayText

Displays the specified text on screen

CLUAConsole::EnableCheatKeys

Enable or disable cheat keys

CLUAConsole::Eval

Evaluate a string containing script actions for a character

CLUAConsole::Exec

Execute console commands contained in the specified file

CLUAConsole::ExploreArea

Reveals the entire map for the current area

CLUAConsole::GetGlobal

Gets a global variable value for an area

CLUAConsole::LogMessages

Enables or disables logging output to console

CLUAConsole::LogSet

Sets logging to a file instead of to console if logging is enabled

CLUAConsole::LuaInit

Initialize lua for the CLUAConsole

CLUAConsole::LuaUninit

Uninitialize lua for the CLUAConsole

CLUAConsole::MoveToArea

Move the selected characters to the area specified

CLUAConsole::PickDialog

Unknown

CLUAConsole::PlayMovie

Plays the specified movie

CLUAConsole::PlaySound

Plays the specified sound

CLUAConsole::ResetAchievements

Reset achievements - applies to Steam installation only

CLUAConsole::SetCurrentXP

Sets the experience points (XP) of the selected character

CLUAConsole::SetGlobal

Set a global variable to the specified value

CLUAConsole::SetWaterAlpha

Sets the alpha blend level for water transparency

CLUAConsole::SetWeather

Sets the current weather

CLUAConsole::StartStore

Starts the specified store

CLUAConsole::StrrefOff

Strings are not displayed with their associated string reference (StrRef)

CLUAConsole::StrrefOn

Strings are displayed with their associated string reference (StrRef)

CLUAConsole::TestAllDialog

Lists all dialog file in the game, and checks for errors

CLUAConsole::WorkshopUpload

Upload a module to the Steam Workshop - applies to Steam installation only

CLUAConsole::WriteScript

Output scripts to directory


CLUAConsole::AddGold

Adds gold to the party

void CLUAConsole::AddGold(unsigned long dwGold);

Parameters

  • unsigned long dwGold - amount of gold to add to party


CLUAConsole::AddSpell

Adds a spell to the specified character

void CLUAConsole::AddSpell(
   CString resRef,
   int characterId);

Parameters

  • CString resRef - string containing the resource reference (ResRef) of the spell to add to character

  • int characterId - id of character to receive the spell

Remarks

Spell resource reference (ResRef) used in Spellname must be 8 characters or less and must be valid.

A character must be selected for this to work

To obtain the spell codes (ResRef) required for this command, please use Near Infinity to browse .spl files, or visit the specific spell page from the BGII Wiki and look for the spell code in the right hand info bar - exclude the .spl extension when using the spell code.


CLUAConsole::AdvanceRealTime

Advance time

void CLUAConsole::AdvanceRealTime(unsigned long gameTime);

Parameters

  • unsigned long gameTime - amount of time in milliseconds to advance

Remarks

Can be used to trigger banters and love talks etc


CLUAConsole::CreateCreature

Creates the creature specified

void CLUAConsole::CreateCreature(CString res);

Parameters

  • CString res - string containing resource reference (ResRef) of creature to spawn (create)

Remarks

Creature resource reference (ResRef) used in Creature must be 8 characters or less and must be valid.

This spawns a creature to the center of the screen (or nearest valid point). If you’re spawning a creature you know will be hostile, you may want to pause the game before entering this command for the safety of your party.


CLUAConsole::CreateEngine

Unknown - seems to start a new single 0 or multi 1 player game

void CLUAConsole::CreateEngine(int nEngine);

Parameters

  • int nEngine - engine id number to create

Remarks


CLUAConsole::CreateItem

Create an item

void CLUAConsole::CreateItem(
   CString res,
   short usage1,
   short usage2,
   short usage3,
   int characterId);

Parameters

  • CString res - string containing resource reference (ResRef) of the item to create

  • short usage1 - amount / charges

  • short usage2 - amount / charges

  • short usage3 - amount / charges

  • int characterId - id of character to receive the item

Remarks

Item resource reference (ResRef) used in Item must be 8 characters or less and must be valid.

This spawns an item, based on its item file name, or a stack of the same item, in the inventory of the current party leader.


CLUAConsole::CreateVEFVidCell

Create VEFVidCell

void CLUAConsole::CreateVEFVidCell(CString resRef);

Parameters

  • CString resRef - string containing resource reference of VEFVidCell to create

Remarks


CLUAConsole::DisplayAllBAMFiles

Display all BAM files

void CLUAConsole::DisplayAllBAMFiles();

Remarks


CLUAConsole::DisplayText

Displays the specified text on screen

void CLUAConsole::DisplayText(CString text);

Parameters

  • CString text - string containing text to display


CLUAConsole::EnableCheatKeys

Enable or disable cheat keys

void CLUAConsole::EnableCheatKeys(int bEnable);

Parameters

  • int bEnable - boolean true or false to enable/disable cheat keys

Remarks

The following cheat key combination are available once cheat keys has been enabled:

Key

Notes

CTRL+1

Change armor level animation

CTRL+2

Fade screen to black

CTRL+3

Fade screen to normal

CTRL+4

Highlight background-interactive objects

CTRL+5

Displays animation information

CTRL+6

Change avatar animation previous

CTRL+7

Change avatar animation next

CTRL+8

Highlights the text boxes

CTRL+9

Highlight the sprites

CTRL+0

Unknown

CTRL+A

Change Selected Animation Sequence

CTRL+C

Jump to next chapter

CTRL+D

Display some numbers (framerate related?)

CTRL+E

Alters visual range

CTRL+F

Turn the character

CTRL+G

Display loaded area ref

CTRL+I

Play Selected Animation effect

CTRL+J

Teleport to cursor position

CTRL+K

Creature under cursor kick out party

CTRL+L

Play Selected Animation effect

CTRL+M

(Followed by ENTER) Debug Dump

CTRL+N

Freeze screen for 5 seconds

CTRL+O

(Followed by ENTER) Write Debug To Log

CTRL+P

Center screen on selected character

CTRL+Q

Creature under cursor joins party

CTRL+R

Heals character under cursor

CTRL+S

Change Selected Animation Sequence

CTRL+T

Advances game time by 1 hour

CTRL+U

Highlight doors and ground objects

CTRL+X

Extended position information

CTRL+Y

Kills creature under cursor

In addition CTRL+8 during character creation will set all attributes to 18 (STR 18/00)

CTRL+SHIFT+Z while hovering over a character will grant every spell file in the game - may crash due to invalid spells


CLUAConsole::Eval

Evaluate a string containing script actions for a character

void CLUAConsole::Eval(
   CString script,
   int characterId);

Parameters

  • CString script - string containing script actions to evaluate

  • int characterId - id of character that script applies to

Remarks

The whole string can be enclosed into single quotes (’) so that double quotes can still be used within the script action.

See BG(2)EE Script Actions for a list of script actions.


CLUAConsole::Exec

Execute console commands contained in the specified file

void CLUAConsole::Exec(char* file);

Parameters

  • char* file - pointer to string containing filename to execute

Remarks


CLUAConsole::ExploreArea

Reveals the entire map for the current area

void CLUAConsole::ExploreArea();

Remarks

This doesn’t remove the fog of war; if a creature is out of your field of vision it will still remain hidden


CLUAConsole::GetGlobal

Gets a global variable value for an area

void CLUAConsole::GetGlobal(
   CString globalName,
   CString areaName);

Parameters

  • CString globalName - name of global variable value to return

  • CString areaName - area in which global is

Remarks


CLUAConsole::LogMessages

Enables or disables logging output to console

void CLUAConsole::LogMessages(int bEnable);

Parameters

  • int bEnable - boolean true or false to enable or disable logging output

Remarks

See CLUAConsole::LogSet to output logging to a file instead


CLUAConsole::LogSet

Sets logging to a file instead of to console if logging is enabled

void CLUAConsole::LogSet(CString resRef);

Parameters

  • CString resRef - string containing log filename

Remarks

See CLUAConsole::LogMessages to enable logging


CLUAConsole::LuaInit

Initialize lua for the CLUAConsole

virtual void __cdecl CLUAConsole::LuaInit();

Remarks


CLUAConsole::LuaUninit

Uninitialize lua for the CLUAConsole

virtual void __cdecl CLUAConsole::LuaUninit();

Remarks


CLUAConsole::MoveToArea

Move the selected characters to the area specified

void CLUAConsole::MoveToArea(CString text);

Parameters

  • CString text - string containing area resource reference to move selected players to

Remarks


CLUAConsole::PickDialog

void CLUAConsole::PickDialog(int table);

Parameters

  • int table -

Remarks


CLUAConsole::PlayMovie

Plays the specified movie

void CLUAConsole::PlayMovie(CString resRef);

Parameters

  • CString resRef - resource reference of the WebM movie to play

Remarks


CLUAConsole::PlaySound

Plays the specified sound

void CLUAConsole::PlaySound(
   char* res,
   short volume,
   unsigned long frequency);

Parameters

  • char* res - pointer to string containing resource reference of the wav sound to play

  • short volume - volume of played sound

  • unsigned long frequency - frequency to play the wav file at

Remarks


CLUAConsole::ResetAchievements

Reset achievements

void CLUAConsole::ResetAchievements();

Remarks

Applies to Steam installation only


CLUAConsole::SetCurrentXP

Sets the experience points (XP) of the selected character

void CLUAConsole::SetCurrentXP(unsigned long dwCurrentXP);

Parameters

  • unsigned long dwCurrentXP - experience points value to set

Remarks

This sets the total, rather than adding a value to your current experience points. A level up will be triggered for characters that qualify, based on the experince points table for the character’s class level.


CLUAConsole::SetGlobal

Set a global variable to the specified value

void CLUAConsole::SetGlobal(
   CString globalName,
   CString areaName,
   long value);

Parameters

  • CString globalName - string containing global variable to set value for

  • CString areaName - area that global variable is in

  • long value - the new value to set the global variable to

Remarks


CLUAConsole::SetWaterAlpha

Sets the alpha blend level for water transparency

void CLUAConsole::SetWaterAlpha(unsigned long dwAlpha);

Parameters

  • unsigned long dwAlpha - value to set for alpha blending of water transparency

Remarks


CLUAConsole::SetWeather

Sets the current weather

void CLUAConsole::SetWeather(unsigned char nWeather);

Parameters

  • unsigned char nWeather - value to set weather to

Remarks

Valid values to set can be found in WEATHER.IDS:

0 NOWEATHER
1 RAIN
2 SNOW
3 FOG

CLUAConsole::StartStore

Starts the specified store

void CLUAConsole::StartStore(char* resref);

Parameters

  • char* resref - pointer to string containing resource reference of store to start

Remarks

Crashes


CLUAConsole::StrrefOff

Strings are not displayed with their associated string reference (StrRef) id

void CLUAConsole::StrrefOff();

Remarks

String reference (StrRef) values are located in the TLK table


CLUAConsole::StrrefOn

Strings are displayed with their associated string reference (StrRef) id

void CLUAConsole::StrrefOn();

Remarks

String reference (StrRef) values are located in the TLK table


CLUAConsole::TestAllDialog

Lists all dialog file in the game, and checks for errors

void CLUAConsole::TestAllDialog();

Remarks


CLUAConsole::WorkshopUpload

Upload a module to the Steam Workshop - Not tested or verified

void CLUAConsole::WorkshopUpload(
   char* name,
   char* path);

Parameters

  • char* name - pointer to string containing name of the workshop module

  • char* path - pointer to string containing the full filepath to the module to upload

Remarks

Applies to Steam installation only.


CLUAConsole::WriteScript

Output scripts to directory

void CLUAConsole::WriteScript(
   CString ref,
   int characterId);

Parameters

  • CString ref - string containing folder to output scripts to

  • int characterId - actor id of character that script is evaluated for, or 0 for none.

Remarks

If the mouse is over a creature, the command will evaluate the scripts attached to that creature. Otherwise it will evaluate the area scripts.

Lua Notes

Most of the CLUAConsole methods are available via the EE Game Lua Functions: C (CLUAConsole) Functions