Console Debug Messages
by Xavier "eXoDuS" Amado · 08/20/2002 (4:27 pm) · 7 comments
Debug Messages
Well, ever found yourself adding echo()'s in your scripts functions to output values to the console and see what's happening, and then you find yourself going through all the console messages that you might have trying to find your echoed messages which are all black. Or maybe you were a bit wiser and used error() instead so that it looks red, but still can be confused with other real error messages. Well I thought of this and tried to look at a possible solution, what I came up was with adding a new command, debug(), which I will be using to output my debug messages in the console with a different defined color, for example blue. This way it makes it much easier to search for your messages in the console. I really hope this is useful for someone, and I'm going to try to make it as easiest as I can. Ok, here it comes:
What we are going to do is add a new function (with an overload) to log our console messages, but with a new Tag. Torque by default uses 3 tags for console messages, these are Normal, Warning and Error, which in the console display as black, grey and red respectively, which are executed by using the echo(), warn() and error() script commands. So what we will do now is add a new function to log our messages with our new tag, which will be "Debug". First of all let's define our new functions in the console.h header file.
Right after:
void errorf(ConsoleLogEntry::Type type, const char *_format, ...);
Add this new line:
void debugf(ConsoleLogEntry::Type type, const char *_format, ...);
And then after:
void errorf(const char *_format, ...);
Add this other line:
void debugf(const char *_format, ...);
You can place them as you want since they are just definitions, but the way I described above as to where put the lines makes it look cleaner, personal preference though, you can place both together or whatever.
That should do the trick, now let's define these new functions in the respective cc file, console.cc.
As before, you can place these functions in the order you want, but to make it cleaner I placed them in the same order in which I defined them in the header, so look for the line:
void errorf(ConsoleLogEntry::Type type, const char* fmt,...)
And after that function ends place our new function:
void debugf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, type, fmt, argptr);
va_end(argptr);
}
Then after the overloaded function void errorf(const char* fmt,...) add our other overload for the debugf function which looks like this:
void debugf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
You might notice that there's nothing fancy about these functions, they are very similar to the other ones except that these pair of new functions set the line to be a Debug type line, so that we can parse it later.
Now let's look at the GuiConsole.cc file. What we want to modify from here is the renderCell() function, what this function does is read the console log and parse it to identify what type of message it is, Normal, Warning or even Error. What we are going to do is add one new type to parse here.
Search for this line of code:
case ConsoleLogEntry::Error: dglSetBitmapModulation(mProfile->mFontColorNA); break;
And right after it add this new line:
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColors[9]); break;
Notice that we are using mFontColors[9] from the profile, you will have to define this color in the profile, let's do so now. Open defaultProfiles.cs and search for the GuiConsoleProfile profile. There you will notice an entry for font color number 9, mine looks like this for a blue color:
fontColors[9] = "0 0 255"; // Debug Message Color
Please notice that mixes of colors dont work atm, for example "100 0 100" wont work, it will turn out to be black text, I'm not sure why it does this.
Ok, so now you got yourself a new set of functions to print debug messages from inside the engine code, but what if you want to be able to use them in the console or scripts?
Well we will simply add a new ConsoleFunction in consoleFunctions.cc, so if you haven't already, open that file and add the following function right after the ConsoleFunction for the error() command.
ConsoleFunction(debug, void, 2, 0, "debug(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
If you look closer in the consoleFunctions.cc file, you might notice that there's already a debug() function which is only compiled if the preprocessor determines it's a debug build, but not even doing a debug build this function is enabled. Typing in the console debug() says that the function doesn't exist, so I just went ahead and used the name debug() for my function anyway, you might do so or change it.
Well, ever found yourself adding echo()'s in your scripts functions to output values to the console and see what's happening, and then you find yourself going through all the console messages that you might have trying to find your echoed messages which are all black. Or maybe you were a bit wiser and used error() instead so that it looks red, but still can be confused with other real error messages. Well I thought of this and tried to look at a possible solution, what I came up was with adding a new command, debug(), which I will be using to output my debug messages in the console with a different defined color, for example blue. This way it makes it much easier to search for your messages in the console. I really hope this is useful for someone, and I'm going to try to make it as easiest as I can. Ok, here it comes:
What we are going to do is add a new function (with an overload) to log our console messages, but with a new Tag. Torque by default uses 3 tags for console messages, these are Normal, Warning and Error, which in the console display as black, grey and red respectively, which are executed by using the echo(), warn() and error() script commands. So what we will do now is add a new function to log our messages with our new tag, which will be "Debug". First of all let's define our new functions in the console.h header file.
Right after:
void errorf(ConsoleLogEntry::Type type, const char *_format, ...);
Add this new line:
void debugf(ConsoleLogEntry::Type type, const char *_format, ...);
And then after:
void errorf(const char *_format, ...);
Add this other line:
void debugf(const char *_format, ...);
You can place them as you want since they are just definitions, but the way I described above as to where put the lines makes it look cleaner, personal preference though, you can place both together or whatever.
That should do the trick, now let's define these new functions in the respective cc file, console.cc.
As before, you can place these functions in the order you want, but to make it cleaner I placed them in the same order in which I defined them in the header, so look for the line:
void errorf(ConsoleLogEntry::Type type, const char* fmt,...)
And after that function ends place our new function:
void debugf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, type, fmt, argptr);
va_end(argptr);
}
Then after the overloaded function void errorf(const char* fmt,...) add our other overload for the debugf function which looks like this:
void debugf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
You might notice that there's nothing fancy about these functions, they are very similar to the other ones except that these pair of new functions set the line to be a Debug type line, so that we can parse it later.
Now let's look at the GuiConsole.cc file. What we want to modify from here is the renderCell() function, what this function does is read the console log and parse it to identify what type of message it is, Normal, Warning or even Error. What we are going to do is add one new type to parse here.
Search for this line of code:
case ConsoleLogEntry::Error: dglSetBitmapModulation(mProfile->mFontColorNA); break;
And right after it add this new line:
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColors[9]); break;
Notice that we are using mFontColors[9] from the profile, you will have to define this color in the profile, let's do so now. Open defaultProfiles.cs and search for the GuiConsoleProfile profile. There you will notice an entry for font color number 9, mine looks like this for a blue color:
fontColors[9] = "0 0 255"; // Debug Message Color
Please notice that mixes of colors dont work atm, for example "100 0 100" wont work, it will turn out to be black text, I'm not sure why it does this.
Ok, so now you got yourself a new set of functions to print debug messages from inside the engine code, but what if you want to be able to use them in the console or scripts?
Well we will simply add a new ConsoleFunction in consoleFunctions.cc, so if you haven't already, open that file and add the following function right after the ConsoleFunction for the error() command.
ConsoleFunction(debug, void, 2, 0, "debug(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
If you look closer in the consoleFunctions.cc file, you might notice that there's already a debug() function which is only compiled if the preprocessor determines it's a debug build, but not even doing a debug build this function is enabled. Typing in the console debug() says that the function doesn't exist, so I just went ahead and used the name debug() for my function anyway, you might do so or change it.
#2
08/21/2002 (4:47 am)
I can see how this would be very useful. I have a lot of echo statements in right now to try and verify what is happening. Color coded messages would be nice.
#3
08/21/2002 (8:42 am)
Sabre, what do you mean? I mean... that's what this does.... debug() prints messages in blue
#4
08/21/2002 (9:01 am)
I should have said will be nice. Sorry that wasn't very clear. My fault. I was just agreeing that this should come in handy for people that make use of the console screen.
#5
-Edit-
Sorry.. I feel like a mule now.
08/21/2002 (6:58 pm)
Instead of echo(), use error() that will give you a red color code, and its already in the engine. Im not stepping, just helping ones that dont know.-Edit-
Sorry.. I feel like a mule now.
#6
08/22/2002 (7:22 pm)
Sam, yes.. and I explained those in the tutorial.... maybe read it before quotiing?
#7
I am going to assume that you already implemented the original material and simply give you the changes to be made. To get started make the following changes in the instructions above.
In console.h instead of the line
void debugf(ConsoleLogEntry::Type type, const char '_format, ...);
I chose...
void debugMsgf(ConsoleLogEntry::Type type, const char '_format, ...);
Instead of...
void debugf(const char '_format, ...);
I chose...
void debugMsgf(const char '_format, ...);
I'm sure you see the pattern coming here. By using debugMsg instead of debug I left all the potential changes that GG might make to the previous debug version alone.
In console.cc I replaced
void debugf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, type, fmt, argptr);
va_end(argptr);
}
with these two minor changes..
void debugMsgf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::DebugMsg, type, fmt, argptr);
va_end(argptr);
}
Next I replaced this function
void debugf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
with this one...
void debugMsgf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::DebugMsg, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
In guiConsole.cc I changed...
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColors[9]); break;
to this...
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColorDBG); break;
(I'll cover how to add mFontColorDBG to the system after I finish documenting the regular changes to the tutorial above.)
Now, in the guiConsoleProfile in the file defaultProfiles.cs instead of adding or changing the mFontColors[9] entry you should find the line
fontColorNA = "255 0 0";
This should be in the middle of the routine around line 385. Insert a new line immediately after this line with the following code.
fontColorDBG = "128 0 128";
(I will explain how this new field will also be added and used in the code after I finish with the changes.)
The functions in consoleFunctions.cc got a facelife as well. They go from this...
ConsoleFunction(debug, void, 2, 0, "debug(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
to this...
ConsoleFunction(debugMsg, void, 2, 0, "debugMsg(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugMsgf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
There are only three small changes - two to use our debugMsg instead of debug and one to use debugMsgf instead of debugf.
Those are the all changes to the original code that Xavier did. Now to add in the rest. Basically we need to create a new debug message level, and a font and color to support our debug messages. The advantage is that messages will be processed independently and the color will be unique to our debug messages and won't be subject to being overwritten by any other debug changes. However, our new messages must fit into the rest of the system including message Level and system colors as they are used now. So, we first go to console.h and find the following struct...
struct ConsoleLogEntry
{
enum Level
{
Normal = 0,
Warning,
Error,
DebugMsg, //--dcd--092002-- Debug Console Messages
NUM_CLASS
} mLevel;
enum Type
{
General = 0,
Assert,
Script,
GUI,
Network,
NUM_TYPE
} mType;
const char *mString;
};
My addition is setout for you to see. This actually creates a new Level for our messages. Next we head over to guiTypes.h where we look for the class GuiControlProfile : public SimObject About twenty lines down into this routine you should see...
// font members
StringTableEntry mFontType;
S32 mFontSize;
enum {
BaseColor = 0,
ColorHL,
ColorNA,
ColorDBG, //--dcd--092002-- Debug Console Messages
ColorSEL,
ColorUser0,
ColorUser1,
ColorUser2,
ColorUser3,
ColorUser4,
ColorUser5,
};
ColorI mFontColors[11]; //--dcd--092002-- Debug Console Messages
ColorI& mFontColor;
ColorI& mFontColorHL;
ColorI& mFontColorNA;
ColorI& mFontColorDBG; //--dcd--092002-- Debug Console Messages
ColorI& mFontColorSEL;
Here you can see that I have added one new entry to the enum and increased the size of the mFontColors array by one. I then followed this by adding the new variable mFontColorDBG. Now we are ready to add the code to back up our changes. First, we head over to guiTypes.cc where you can locate the following code block around line 76...
GuiControlProfile::GuiControlProfile(void) :
mFontColor(mFontColors[BaseColor]),
mFontColorHL(mFontColors[ColorHL]),
mFontColorNA(mFontColors[ColorNA]),
mFontColorSEL(mFontColors[ColorSEL]), //--dcd-- added comma
mFontColorDBG(mFontColors[ColorDBG]) //--dcd-- Debug Message Console
After adding the comma and the new fontColorDBG line we move down a bit to around line 161 in the routine, void GuiControlProfile::initPersistFields()
addField("fontColorHL", TypeColorI, Offset(mFontColors[ColorHL], GuiControlProfile));
addField("fontColorNA", TypeColorI, Offset(mFontColors[ColorNA], GuiControlProfile));
addField("fontColorDBG", TypeColorI, Offset(mFontColors[ColorDBG], GuiControlProfile)); //--dcd--092002 Debug Messages
addField("fontColorSEL", TypeColorI, Offset(mFontColors[ColorSEL], GuiControlProfile));
Add the new line here so that we will be able to add our changes in from scripts later. With those changes plus completed you should now be able to recompile and create a new debugMsg. Let's test it...
Since we already have our debugMsg color selected in defaultProfiles.cs ( a lovely shade of purple??? ;) we need to generate a debugMsg. Load up \client\scripts\default.bind.cs and scroll down to about line 130. Find the function called mouseFire(%Val) in that routine add the following lines after $mvTriggerCount0++...
$mvTriggerCount0++;
echo("I'm sending an echo message!!!");
debugMsg("I'm sending a new debug message!!!");
debugMsg("I'm sending a new debug message!!!");
debugMsg("I'm sending a new debug message!!!");
This will send a standard echo message to the console followed by 3 of our new debug messages. The purpose is to make it clear that the routines are all working correctly. To test simply go into your favorite mission and grab a weapon and ammo and then press the mouse button. Call up the console using the tilde key and you should see an echo message followed by three light purple debug messages. If it all worked well you can then delete the extra script entires in default.bind.cs and use your new debugMsg in place of echo wherever you wish. You can change the color by going to defaultProfiles.cs and changing the fontColorDBG to what ever color you choose.
09/20/2002 (2:06 pm)
When I tried to implement these changes I discovered that the mFontColors[9] was now being used. Also there seems to be some more work being done on Debug so I was afraid that upcoming changes would only cause conflicts. So I made a bunch of changes and got it all working. My improved version allows you to set the color to anything you want (it doesn't require only red, green or blue) as the options. It also does not conflict with upcoming work on debug nor does it mess with the new use of mFontColors.I am going to assume that you already implemented the original material and simply give you the changes to be made. To get started make the following changes in the instructions above.
In console.h instead of the line
void debugf(ConsoleLogEntry::Type type, const char '_format, ...);
I chose...
void debugMsgf(ConsoleLogEntry::Type type, const char '_format, ...);
Instead of...
void debugf(const char '_format, ...);
I chose...
void debugMsgf(const char '_format, ...);
I'm sure you see the pattern coming here. By using debugMsg instead of debug I left all the potential changes that GG might make to the previous debug version alone.
In console.cc I replaced
void debugf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, type, fmt, argptr);
va_end(argptr);
}
with these two minor changes..
void debugMsgf(ConsoleLogEntry::Type type, const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::DebugMsg, type, fmt, argptr);
va_end(argptr);
}
Next I replaced this function
void debugf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::Debug, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
with this one...
void debugMsgf(const char* fmt,...)
{
va_list argptr;
va_start(argptr, fmt);
_printf(ConsoleLogEntry::DebugMsg, ConsoleLogEntry::General, fmt, argptr);
va_end(argptr);
}
In guiConsole.cc I changed...
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColors[9]); break;
to this...
case ConsoleLogEntry::Debug: dglSetBitmapModulation(mProfile->mFontColorDBG); break;
(I'll cover how to add mFontColorDBG to the system after I finish documenting the regular changes to the tutorial above.)
Now, in the guiConsoleProfile in the file defaultProfiles.cs instead of adding or changing the mFontColors[9] entry you should find the line
fontColorNA = "255 0 0";
This should be in the middle of the routine around line 385. Insert a new line immediately after this line with the following code.
fontColorDBG = "128 0 128";
(I will explain how this new field will also be added and used in the code after I finish with the changes.)
The functions in consoleFunctions.cc got a facelife as well. They go from this...
ConsoleFunction(debug, void, 2, 0, "debug(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
to this...
ConsoleFunction(debugMsg, void, 2, 0, "debugMsg(text [, ... ])")
{
U32 len = 0;
S32 i;
if(gEvalState.traceOn)
len = (gEvalState.stack.size() - 1) * 2;
for(i = 1; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
if(gEvalState.traceOn)
{
for(i = 0; i < (S32)gEvalState.stack.size() - 1; i++)
dStrcat(ret, " ");
}
for(i = 1; i < argc; i++)
dStrcat(ret, argv[i]);
Con::debugMsgf(ConsoleLogEntry::General, "%s", ret);
ret[0] = 0;
}
There are only three small changes - two to use our debugMsg instead of debug and one to use debugMsgf instead of debugf.
Those are the all changes to the original code that Xavier did. Now to add in the rest. Basically we need to create a new debug message level, and a font and color to support our debug messages. The advantage is that messages will be processed independently and the color will be unique to our debug messages and won't be subject to being overwritten by any other debug changes. However, our new messages must fit into the rest of the system including message Level and system colors as they are used now. So, we first go to console.h and find the following struct...
struct ConsoleLogEntry
{
enum Level
{
Normal = 0,
Warning,
Error,
DebugMsg, //--dcd--092002-- Debug Console Messages
NUM_CLASS
} mLevel;
enum Type
{
General = 0,
Assert,
Script,
GUI,
Network,
NUM_TYPE
} mType;
const char *mString;
};
My addition is setout for you to see. This actually creates a new Level for our messages. Next we head over to guiTypes.h where we look for the class GuiControlProfile : public SimObject About twenty lines down into this routine you should see...
// font members
StringTableEntry mFontType;
S32 mFontSize;
enum {
BaseColor = 0,
ColorHL,
ColorNA,
ColorDBG, //--dcd--092002-- Debug Console Messages
ColorSEL,
ColorUser0,
ColorUser1,
ColorUser2,
ColorUser3,
ColorUser4,
ColorUser5,
};
ColorI mFontColors[11]; //--dcd--092002-- Debug Console Messages
ColorI& mFontColor;
ColorI& mFontColorHL;
ColorI& mFontColorNA;
ColorI& mFontColorDBG; //--dcd--092002-- Debug Console Messages
ColorI& mFontColorSEL;
Here you can see that I have added one new entry to the enum and increased the size of the mFontColors array by one. I then followed this by adding the new variable mFontColorDBG. Now we are ready to add the code to back up our changes. First, we head over to guiTypes.cc where you can locate the following code block around line 76...
GuiControlProfile::GuiControlProfile(void) :
mFontColor(mFontColors[BaseColor]),
mFontColorHL(mFontColors[ColorHL]),
mFontColorNA(mFontColors[ColorNA]),
mFontColorSEL(mFontColors[ColorSEL]), //--dcd-- added comma
mFontColorDBG(mFontColors[ColorDBG]) //--dcd-- Debug Message Console
After adding the comma and the new fontColorDBG line we move down a bit to around line 161 in the routine, void GuiControlProfile::initPersistFields()
addField("fontColorHL", TypeColorI, Offset(mFontColors[ColorHL], GuiControlProfile));
addField("fontColorNA", TypeColorI, Offset(mFontColors[ColorNA], GuiControlProfile));
addField("fontColorDBG", TypeColorI, Offset(mFontColors[ColorDBG], GuiControlProfile)); //--dcd--092002 Debug Messages
addField("fontColorSEL", TypeColorI, Offset(mFontColors[ColorSEL], GuiControlProfile));
Add the new line here so that we will be able to add our changes in from scripts later. With those changes plus completed you should now be able to recompile and create a new debugMsg. Let's test it...
Since we already have our debugMsg color selected in defaultProfiles.cs ( a lovely shade of purple??? ;) we need to generate a debugMsg. Load up \client\scripts\default.bind.cs and scroll down to about line 130. Find the function called mouseFire(%Val) in that routine add the following lines after $mvTriggerCount0++...
$mvTriggerCount0++;
echo("I'm sending an echo message!!!");
debugMsg("I'm sending a new debug message!!!");
debugMsg("I'm sending a new debug message!!!");
debugMsg("I'm sending a new debug message!!!");
This will send a standard echo message to the console followed by 3 of our new debug messages. The purpose is to make it clear that the routines are all working correctly. To test simply go into your favorite mission and grab a weapon and ammo and then press the mouse button. Call up the console using the tilde key and you should see an echo message followed by three light purple debug messages. If it all worked well you can then delete the extra script entires in default.bind.cs and use your new debugMsg in place of echo wherever you wish. You can change the color by going to defaultProfiles.cs and changing the fontColorDBG to what ever color you choose.
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name