Game Development Community

Create Math ConsoleFunction, should be easy?

by Christopher Evans · in Torque Game Builder · 12/10/2011 (12:55 pm) · 2 replies

I created this C++ console function.

ConsoleFunction( mFmod, F32, 3, 3, "( float numerator, float denominator ) Use the mFmod function to Returns the floating-point remainder of numerator/denominator.n"
									"@param Floating point value with the division numerator.n"
									"@param Floating point value with the division denominator. n"
									"@return The remainder of dividing the arguments.n"
									"@sa mFmod")
{
	F32 value = dAtof( argv[1] );
	F32 mod = dAtof( argv[2] ); 
   return( mFmod(value, mod) );
}

At the bottom of mConsoleFunctions.cc and placed it right before

ConsoleFunctionGroupEnd( GeneralMath );

I have rebuilt the executable. Yet when I try to compile my script I get a parse error when I call the function
%angle = mFmod( %deg, 360.0f );

Any ideas, what the problem is?


#1
12/10/2011 (2:36 pm)
Try:

%angle = mFmod( %deg, 360.0 );
#2
12/10/2011 (5:02 pm)
I love it when the bugs are simple.

Thanks