Absolute
by Martin Mc · in Torque Game Builder · 10/26/2005 (4:12 pm) · 5 replies
I've been searching for an answer to this, but can't find one.
Does TorqueScript have a built in modulo operator (or function)? I guess I could very easily write one if it doesn't, but I'm just curious.
At the moment, I do this:
As I said, I was just curious if there was something built in to the language to support this.
Cheers.
Does TorqueScript have a built in modulo operator (or function)? I guess I could very easily write one if it doesn't, but I'm just curious.
At the moment, I do this:
if ( %foo < 0 )
%foo = -%foo;As I said, I was just curious if there was something built in to the language to support this.
Cheers.
About the author
#2
Thanks for spotting my schoolboy error and for answering the question I really meant to ask.
- Cheers
10/26/2005 (4:29 pm)
Ha - I just had a total brain meltdown. I wrote modulo when I of course meant absolute!Thanks for spotting my schoolboy error and for answering the question I really meant to ask.
- Cheers
#3
By the way, try this function:
You will get a listing of all the console functions you can use in script, with a brief description.
Bye,
Jacopo
10/26/2005 (4:35 pm)
You are welcome! ;-)By the way, try this function:
dumpConsoleFunctions();
You will get a listing of all the console functions you can use in script, with a brief description.
Bye,
Jacopo
#4
Thanks again.
10/26/2005 (4:47 pm)
I didn't realise that function existed. Should help me out big time.Thanks again.
#5
You'll find "mAbs", "mSqrt", "mPow", "mLog", "mSin", "mCos", "mTan", "mAsin", "mAcos", "mRadToDeg", "mDegToRad", "mFloor", "mCeil", "mFloatLength", "mSolveQuadratic", "mSolvCubic" and "mSolveQuartic".
If all else fails, you can quickly find what you want from the source (including detailed comments most of the time) by searching for the "ConsoleFunction" and "ConsoleMethod" macros.
Cheers,
- Melv.
10/27/2005 (12:09 pm)
If you look in "mConsoleFunctions.cc", you'll see all the script-exposed math calls in one place. Look for the "ConsoleFunction" macros.You'll find "mAbs", "mSqrt", "mPow", "mLog", "mSin", "mCos", "mTan", "mAsin", "mAcos", "mRadToDeg", "mDegToRad", "mFloor", "mCeil", "mFloatLength", "mSolveQuadratic", "mSolvCubic" and "mSolveQuartic".
If all else fails, you can quickly find what you want from the source (including detailed comments most of the time) by searching for the "ConsoleFunction" and "ConsoleMethod" macros.
Cheers,
- Melv.
Torque 3D Owner Jacopo De Luca
Default Studio Name
If you are searching for a function that returns the absolute value of a variable, try mAbs().
Bye,
Jacopo