What is "mCap"?
by Demolishun · in Torque Game Engine · 09/24/2004 (8:25 pm) · 2 replies
Hello,
I am playing with the icon tutorial:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4124
In the code it uses a call to "mCap" in script. Does anyone know what this is? Torque 1.2 gives me an error saying function cannot be found. I assume this is not standard Torque.
Here are the calls from IconCtrl.cs:
// keep icon inside gui object
%x = mCap(getWord(%this.position, 0), 1, (getWord(%parent.extent, 0)-getWord(%this.extent, 0)));
%y = mCap(getWord(%this.position, 1), 25, (getWord(%parent.extent, 1)-getWord(%this.extent, 1)));
These both fail for function not being found. As is the code will work, but I for the life of me cannot think about what math function this would be.
Thanks,
Frank
I am playing with the icon tutorial:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4124
In the code it uses a call to "mCap" in script. Does anyone know what this is? Torque 1.2 gives me an error saying function cannot be found. I assume this is not standard Torque.
Here are the calls from IconCtrl.cs:
// keep icon inside gui object
%x = mCap(getWord(%this.position, 0), 1, (getWord(%parent.extent, 0)-getWord(%this.extent, 0)));
%y = mCap(getWord(%this.position, 1), 25, (getWord(%parent.extent, 1)-getWord(%this.extent, 1)));
These both fail for function not being found. As is the code will work, but I for the life of me cannot think about what math function this would be.
Thanks,
Frank
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
Torque 3D Owner Luke D
Default Studio Name
Again this is a total guess, but it makes sense in the context of the script that is using it. I checked the source and there is no reference to it at all there. It could be replaced easily with a script function with something like:
function mCap(%inputValue, %minimumValue, %maximumValue) { %returnValue = %inputValue; if (%returnValue < %minimumValue) { %returnValue = %minimumValue; } if (%returnValue > %maximumValue) { %returnValue = %maximumValue; } return %returnValue; }Assuming of course the positions and uses of the parameters are what I think they are. Perhaps someone who remembers the function can enlighten us for sure.