Game Development Community

dev|Pro Game Development Curriculum

Console Output (printf) Helpers

by James Ford · 04/03/2008 (10:30 am) · 2 comments

Download Code File

Tired of writing stuff like this?
Con::errorf( "ERROR: myUnit::onAdd(), could not find required object %s", terrainName )

Replace it with:

CMERROR( "could not find required object %s", terrainName );

The tag ERROR, the object classname, and the scriptMethod name will automatically be preappended.
( "CM" refers to ConsoleMethod ).

CMECHO, CMWARN, CMERROR are intended to be used from within ConsoleMethods.

CFECHO, CFWARN, CFERROR are for use in ConsoleFunctions.

CECHO, CWARN, CERROR are for use in regular C functions.
[note: These last 3 probably only work on windows PCs because they make use of the __FUNCTION__ macro]

I probably went overboard making all six of these, but feel free to just use a few.

#1
04/03/2008 (2:41 pm)
this is very interesting!
if someone tries this on linux & mac, please post the results !
#2
04/07/2008 (8:11 am)
hey Orion.
Compiled fine on mine TGE150-modded engine (opensuse 10.2), so seems like all is fine here.