Console System

The Console system is the basis for logging, SimObject, and TorqueScript itself.

More...

Classes:

class

This is the backend for the ConsoleMethod()/ConsoleFunction() macros.

class

An arbitrary fragment of auto-doc text for the script reference.

class

Extended information about a console function.

class

Represents an entry in the log.

class

Utility class to save and restore the current console stack frame.

Groups:

group

Exports console information to XML representation.

group

The scripting engine makes heavy use of callbacks to represent function exposed to the scripting language.

User Defined

DefineConsoleType(TypeBool , bool )
DefineConsoleType(TypeBoolVector , Vector< bool > )
DefineConsoleType(TypeS8 , S8 )
DefineConsoleType(TypeS32 , S32 )
DefineConsoleType(TypeS32Vector , Vector< S32 > )
DefineConsoleType(TypeF32 , F32 )
DefineConsoleType(TypeF32Vector , Vector< F32 > )
DefineUnmappedConsoleType(TypeString , const char * )
const char *
DefineConsoleType(TypeRealString , String )
DefineConsoleType(TypeCommand , String )
DefineConsoleType(TypeFilename , const char * )
DefineConsoleType(TypeStringFilename , String )
DefineConsoleType(TypeRotationF , RotationF )

A universally unique identifier.

A persistent ID that is associated with an object.

DefineConsoleType(TypeImageFilename , String )

TypeImageFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type that can display a texture preview.

DefineConsoleType(TypePrefabFilename , String )

TypePrefabFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeShapeFilename , String )

TypeShapeFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeMaterialName , String )

TypeMaterialName is equivalent to TypeRealString in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeTerrainMaterialIndex , S32 )

TypeTerrainMaterialIndex is equivalent to TypeS32 in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeTerrainMaterialName , const char * )

TypeTerrainMaterialName is equivalent to TypeString in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeCubemapName , String )

TypeCubemapName is equivalent to TypeRealString in its usage, but the Inspector will provide a drop-down list of CubemapData objects.

DefineConsoleType(TypeParticleParameterString , const char * )
DefineConsoleType(TypeFlag , S32 )
DefineConsoleType(TypeColorI , ColorI )
DefineConsoleType(TypeSimObjectName , SimObject * )
DefineConsoleType(TypeShader , GFXShader * )
DefineConsoleType(TypeSimObjectPtr , SimObject * )
DefineConsoleType(TypeSimPersistId , SimPersistID * )

A persistent reference to an object.

DefineConsoleType(TypeName , const char * )

Special field type for SimObject::objectName.

DefineConsoleType(TypeRectUV , RectF )

TypeRectUV is equivalent to TypeRectF in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

define
Offset(x, cls) offsetof(cls, x)

Global Console Definition Macros

note:

If TORQUE_DEBUG is defined, then we gather documentation information, and do some extra sanity checks.

see:

ConsoleConstructor console_autodoc

define
DECLARE_CALLBACK(returnType, name, args)    virtual returnType name ## _callback args

Define a C++ method that calls back to script on an object.

define
define
define
define
define
conmethod_return_bool() return (bool
define
ConsoleFunctionGroupBegin(groupName, usage)       static  cfg_ConsoleFunctionGroup_##groupName##_GroupBegin(,#groupName,usage)
define
ConsoleToolFunction(name, returnType, minArgs, maxArgs, usage1)    returnType ctf_##name( *, ,  *argv); \
    cc_##name##_obj(,#name,ctf_##name,usage1,minArgs,maxArgs, true); \
   returnType ctf_##name( *,  argc,  *argv)
define
ConsoleFunctionGroupEnd(groupName)       static  cfg_##groupName##_GroupEnd(,#groupName,)
define
ConsoleNamespace(className, usage)     cc_##className##_Namespace(#className, usage)
define
ConsoleMethodGroupBegin(className, groupName, usage)    static  cc_##className##_##groupName##_GroupBegin(#className,#groupName,usage)
define
ConsoleMethodGroupEnd(className, groupName)    static  cc_##className##_##groupName##_GroupEnd(#className,#groupName,)
define
ConsoleDoc(text)       namespace {                                           \
          _sDocFragment( text );           \
      }

Add a fragment of auto-doc text to the console API reference.

Enumerations

enum
StringTableConstants {  StringTagPrefixByte = 0x01
}

Typedefs

const char *
StringTableEntry 

Variables

bool

Indicates that warnings about undefined script variables should be displayed.

Functions

bool
collapseEscape(char * buf)
bool
expandEscape(char * dest, const char * src)

Detailed Description

The Console system is the basis for logging, SimObject, and TorqueScript itself.

User Defined

DefineEnumType(LogLevel )

typedef ConsoleLogEntry::Level LogLevel 

User Defined

DefineConsoleType(TypeBool , bool )

DefineConsoleType(TypeBoolVector , Vector< bool > )

DefineConsoleType(TypeS8 , S8 )

DefineConsoleType(TypeS32 , S32 )

DefineConsoleType(TypeS32Vector , Vector< S32 > )

DefineConsoleType(TypeF32 , F32 )

DefineConsoleType(TypeF32Vector , Vector< F32 > )

DefineUnmappedConsoleType(TypeString , const char * )

DefineConsoleType(TypeRealString , String )

DefineConsoleType(TypeCommand , String )

DefineConsoleType(TypeFilename , const char * )

DefineConsoleType(TypeStringFilename , String )

DefineConsoleType(TypeRotationF , RotationF )

DefineConsoleType(TypeUUID , Torque::UUID )

A universally unique identifier.

DefineUnmappedConsoleType(TypePID , SimPersistID * )

A persistent ID that is associated with an object.

This type cannot be used to reference PIDs of other objects.

DefineConsoleType(TypeImageFilename , String )

TypeImageFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type that can display a texture preview.

DefineConsoleType(TypePrefabFilename , String )

TypePrefabFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeShapeFilename , String )

TypeShapeFilename is equivalent to TypeStringFilename in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeMaterialName , String )

TypeMaterialName is equivalent to TypeRealString in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeTerrainMaterialIndex , S32 )

TypeTerrainMaterialIndex is equivalent to TypeS32 in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeTerrainMaterialName , const char * )

TypeTerrainMaterialName is equivalent to TypeString in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

DefineConsoleType(TypeCubemapName , String )

TypeCubemapName is equivalent to TypeRealString in its usage, but the Inspector will provide a drop-down list of CubemapData objects.

DefineConsoleType(TypeParticleParameterString , const char * )

DefineConsoleType(TypeFlag , S32 )

DefineConsoleType(TypeColorI , ColorI )

DefineConsoleType(TypeColorF , LinearColorF )

DefineConsoleType(TypeSimObjectName , SimObject * )

DefineConsoleType(TypeShader , GFXShader * )

DefineConsoleType(TypeSimObjectPtr , SimObject * )

DefineConsoleType(TypeSimPersistId , SimPersistID * )

A persistent reference to an object.

This reference indirectly goes through the referenced object's persistent ID.

DefineConsoleType(TypeName , const char * )

Special field type for SimObject::objectName.

DefineConsoleType(TypeRectUV , RectF )

TypeRectUV is equivalent to TypeRectF in its usage, it exists for the benefit of GuiInspector, which will provide a custom InspectorField for this type.

Offset(x, cls) offsetof(cls, x)

Global Console Definition Macros

note:

If TORQUE_DEBUG is defined, then we gather documentation information, and do some extra sanity checks.

see:

ConsoleConstructor console_autodoc

DECLARE_CALLBACK(returnType, name, args)    virtual returnType name ## _callback args

Define a C++ method that calls back to script on an object.

see:

consoleCallback.h

conmethod_return_const() return (
conmethod_return_S32() return (
conmethod_return_F32() return (
conmethod_nullify(val) 
conmethod_return_void() (
conmethod_return_bool() return (bool
ConsoleFunctionGroupBegin(groupName, usage)       static  cfg_ConsoleFunctionGroup_##groupName##_GroupBegin(,#groupName,usage)
ConsoleToolFunction(name, returnType, minArgs, maxArgs, usage1)    returnType ctf_##name( *, ,  *argv); \
    cc_##name##_obj(,#name,ctf_##name,usage1,minArgs,maxArgs, true); \
   returnType ctf_##name( *,  argc,  *argv)
ConsoleFunctionGroupEnd(groupName)       static  cfg_##groupName##_GroupEnd(,#groupName,)
ConsoleNamespace(className, usage)     cc_##className##_Namespace(#className, usage)
ConsoleMethodGroupBegin(className, groupName, usage)    static  cc_##className##_##groupName##_GroupBegin(#className,#groupName,usage)
ConsoleMethodGroupEnd(className, groupName)    static  cc_##className##_##groupName##_GroupEnd(#className,#groupName,)
ConsoleDoc(text)       namespace {                                           \
          _sDocFragment( text );           \
      }

Add a fragment of auto-doc text to the console API reference.

note:

There can only be one ConsoleDoc per source file.

Enumerations

StringTableConstants

Enumerator

StringTagPrefixByte = 0x01

Magic value prefixed to tagged strings.

Typedefs

typedef const char * StringTableEntry 

Variables

bool gWarnUndefinedScriptVariables 

Indicates that warnings about undefined script variables should be displayed.

note:

This is set and controlled by script.

char * typeValueEmpty 

Functions

collapseEscape(char * buf)

dAtob(ConsoleValue & ref)

dAtof(ConsoleValueRef & ref)

dAtoi(ConsoleValueRef & ref)

expandEscape(char * dest, const char * src)

HashPointer(StringTableEntry ptr)