Adding command to source?
#2
Changing the source code is useless unless you compile a binary after the changes are made. Some things can be done with simply CubeScript, which only requires .cfg edits, others must be done via the source code which requires some C++ knowledge and a compiler for your system.

Here is an example of a identical command made from both; of course, more advanced things will require source edits and are not possible with just CubeScript:

CubeScript version:
myMessage = [echo Hello] // Typing /myMessage - in game will cause "Hello" to be printed onto the console.

C++ version:
void myMessage() {conoutf("Hello");}
COMMAND(myMessage, ARG_NONE); // Typing /myMessage - in game will cause "Hello" to be printed onto the console.

Although this is very basic, I hope it helps you get the idea anyways. In CubeScript, aliases are used as commands. In C++ for AC, the "COMMAND()" and "COMMANDN()" functions define new commands that can be used in game. These functions call on other C++ functions that actually get the job done. In this case, the function "COMMAND()" executes the function "myMessage()" which causes the function "conoutf()" to print "Hello" to the screen.
Thanks given by:


Messages In This Thread
Adding command to source? - by stvster - 11 Jul 11, 03:12AM
RE: Adding command to source? - by Bukz - 11 Jul 11, 04:05AM
RE: Adding command to source? - by stvster - 11 Jul 11, 04:27AM