Hey guys.
I decided to play around with making binary modules, and figured a useful first thing to make would be a print function where you need to specify an RGB value for the color of the message.
I have found through looking through the SourceSDK and other people's code that the function I need is ConColorMsg. However, I encountered a problem.
Using the following code...
[CODE]
#define WIN32_LEAN_AND_MEAN
#define GAME_DLL
#include <GMLuaModule.h>
#include <cbase.h>
#include <dbg.h>
// Module definition
GMOD_MODULE( Init, Shutdown );
// Globals
ILuaInterface* g_Lua = NULL;
// Initialization
int Init( lua_State *L )
{
g_Lua = Lua();
ConColorMsg(Color(22,22,22,22), "CLuaInterface started at 0x%p\n", g_Lua);
g_Lua = Lua();
g_Lua->SetGlobal("PrintC", PrintC);
return 0;
}
// Shutdown
int Shutdown( lua_State *L )
{
g_Lua->Msg("CLuaInterface shut down at 0x%p\n", g_Lua);
return 0;
}
[/CODE]
...I get the following errors.
[CODE]
error C2079: 'ConsoleColor' uses undefined class 'Color' 28 1
error C2514: 'Color' : class has no constructors 40 1
[/CODE]
The errors are pretty obvious; the class Color does not exist. However, in all of the examples I have seen that use ConColorMsg, Color has been used in the same way as I use it.
I think this is because I am not including the header(s) that I need for this to work, but I might be wrong.
Anyone know how to fix this problem?
I also apologize if this seems like a newbie error, but I won't pretend like I know what I am doing when it comes to making these modules.
Also, please do not tell me to go out and get gm_console or gmcl_extras. The point in this project is that I want to play around with making modules and see how they work, not use someone else's module to expand on my palette of lua functions.
[editline]8th September 2012[/editline]
I just saw [URL="http://facepunch.com/showthread.php?t=1208368"]this thread[/URL]
Does that mean I am wasting my time with this? :/
Sorry but that function already exists in gm13.
if you want it for gmod 12 i think you need to include Color.h
Also, did you even include the color header?
[QUOTE=Wizard of Ass;37592473]Sorry but that function already exists in gm13.[/QUOTE]
Hmm, fair enough. However, I still want to get the ConColorMsg function to work in the code I provided. I plan to use it for a few other things (like, for instance, announcing me as the creator on initialization)
From what I remember of you when the binary module section was still in existence, you seemed like a very knowledgeable individual when it comes to this sort of thing. Would you have any idea what I am doing wrong?
Edit: You guys replied faster than I could type this. Ill try including color.h