scriptObjects.cpp
Engine/source/console/scriptObjects.cpp
Public Functions
ConsoleDocClass(ScriptGroup , "@brief Essentially <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> SimGroup, but with onAdd and onRemove script <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">callbacks.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//First container, <a href="/coding/class/classsimgroup/">SimGroup</a> containing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ScriptGroup\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classsimgroup/">SimGroup</a>(Scenes)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Subcontainer, <a href="/coding/class/classscriptgroup/">ScriptGroup</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">variables\n</a>" "//related <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> cut scene and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> starting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">WayPoint\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classscriptgroup/">ScriptGroup</a>(WelcomeScene)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " class=\"Scene\";\n" " pathName = \"Pathx\";\n" " description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> illustrate some the Torque Game Engine\'s features.\";\n" " pathTime = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " title = \"Welcome <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Orc Town\";\n\n" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classwaypoint/">WayPoint</a>(start)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " position = \"163.873 -103.82 208.354\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " scale = \"1 1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dataBlock = \"WayPointMarker\";\n" " team = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
ConsoleDocClass(ScriptObject , "@brief A script-level OOP object which allows binding of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> class, superClass and arguments along with declaration of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">methods.\n\n</a>" "ScriptObjects are extrodinarily powerful objects that allow defining of any type of data required. They can optionally <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">have\n</a>" "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> class and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> superclass defined <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> added <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> of multiple ScriptObjects through <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> simple class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">definition.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classscriptobject/">ScriptObject</a>(Game)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " class=\"DeathMatchGame\";\n" " superClass = GameCore;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " genre = \"Action FPS\"; // Note the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a>, non-Torque <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">variable\n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimObject\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
ConsoleDocClass(ScriptTickObject , "@brief A <a href="/coding/class/classscriptobject/">ScriptObject</a> that responds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> tick and frame <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">events.\n\n</a>" "<a href="/coding/class/classscripttickobject/">ScriptTickObject</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classscriptobject/">ScriptObject</a> that adds callbacks <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> tick and frame events. Use " "setProcessTicks() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> enable or disable the onInterpolateTick() and onProcessTick() callbacks. " "The callOnAdvanceTime property determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the onAdvanceTime() callback is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">called.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ScriptObject\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
DefineEngineMethod(ScriptTickObject , isProcessingTicks , bool , () , "@brief Is this object wanting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive tick <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">notifications.\n\n</a>" "If this object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive tick notifications then its onInterpolateTick() and " "onProcessTick() callbacks are <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">called.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> object wants tick <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">notifications\n\n</a>" )
DefineEngineMethod(ScriptTickObject , setProcessTicks , void , (bool tick) , "@brief Sets this object as either tick processing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n\n</a>" "@param tick This object's onInterpolateTick() and onProcessTick() callbacks are called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n\n</a>" )
IMPLEMENT_CALLBACK(ScriptGroup , onAdd , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptgroup/">ScriptGroup</a> is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptGroup , onRemove , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is removed from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptObject , onAdd , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptObject , onRemove , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is removed from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onAdvanceTime , void , (F32 timeDelta) , (timeDelta) , "This is called every frame regardless <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process ticks, but only " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the callOnAdvanceTime property is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n</a>" " @param timeDelta The time delta <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">callOnAdvanceTime\n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onInterpolateTick , void , (F32 delta) , (delta) , "This is called every frame, but only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ticks.\n</a>" " @param delta The time delta <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame.\n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onProcessTick , void , () , () , "Called once every 32ms <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ticks.\n</a>" )
Detailed Description
Public Functions
ConsoleDocClass(ScriptGroup , "@brief Essentially <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> SimGroup, but with onAdd and onRemove script <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">callbacks.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//First container, <a href="/coding/class/classsimgroup/">SimGroup</a> containing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ScriptGroup\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classsimgroup/">SimGroup</a>(Scenes)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Subcontainer, <a href="/coding/class/classscriptgroup/">ScriptGroup</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">variables\n</a>" "//related <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> cut scene and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> starting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">WayPoint\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classscriptgroup/">ScriptGroup</a>(WelcomeScene)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " class=\"Scene\";\n" " pathName = \"Pathx\";\n" " description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> illustrate some the Torque Game Engine\'s features.\";\n" " pathTime = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " title = \"Welcome <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Orc Town\";\n\n" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classwaypoint/">WayPoint</a>(start)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " position = \"163.873 -103.82 208.354\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " scale = \"1 1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dataBlock = \"WayPointMarker\";\n" " team = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
ConsoleDocClass(ScriptObject , "@brief A script-level OOP object which allows binding of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> class, superClass and arguments along with declaration of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">methods.\n\n</a>" "ScriptObjects are extrodinarily powerful objects that allow defining of any type of data required. They can optionally <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">have\n</a>" "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> class and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> superclass defined <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> added <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> of multiple ScriptObjects through <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> simple class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">definition.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classscriptobject/">ScriptObject</a>(Game)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " class=\"DeathMatchGame\";\n" " superClass = GameCore;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " genre = \"Action FPS\"; // Note the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a>, non-Torque <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">variable\n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimObject\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
ConsoleDocClass(ScriptTickObject , "@brief A <a href="/coding/class/classscriptobject/">ScriptObject</a> that responds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> tick and frame <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">events.\n\n</a>" "<a href="/coding/class/classscripttickobject/">ScriptTickObject</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classscriptobject/">ScriptObject</a> that adds callbacks <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> tick and frame events. Use " "setProcessTicks() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> enable or disable the onInterpolateTick() and onProcessTick() callbacks. " "The callOnAdvanceTime property determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the onAdvanceTime() callback is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">called.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ScriptObject\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Console\n</a>" "@ingroup Scripting" )
DefineEngineMethod(ScriptTickObject , isProcessingTicks , bool , () , "@brief Is this object wanting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive tick <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">notifications.\n\n</a>" "If this object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive tick notifications then its onInterpolateTick() and " "onProcessTick() callbacks are <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">called.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> object wants tick <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">notifications\n\n</a>" )
DefineEngineMethod(ScriptTickObject , setProcessTicks , void , (bool tick) , "@brief Sets this object as either tick processing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n\n</a>" "@param tick This object's onInterpolateTick() and onProcessTick() callbacks are called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n\n</a>" )
IMPLEMENT_CALLBACK(ScriptGroup , onAdd , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptgroup/">ScriptGroup</a> is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptGroup , onRemove , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is removed from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptObject , onAdd , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptObject , onRemove , void , (SimObjectId ID) , (ID) , "Called when this <a href="/coding/class/classscriptobject/">ScriptObject</a> is removed from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "@param ID Unique object ID assigned when created (%this in script).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onAdvanceTime , void , (F32 timeDelta) , (timeDelta) , "This is called every frame regardless <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process ticks, but only " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the callOnAdvanceTime property is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n</a>" " @param timeDelta The time delta <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">callOnAdvanceTime\n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onInterpolateTick , void , (F32 delta) , (delta) , "This is called every frame, but only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ticks.\n</a>" " @param delta The time delta <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame.\n</a>" )
IMPLEMENT_CALLBACK(ScriptTickObject , onProcessTick , void , () , () , "Called once every 32ms <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> process <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ticks.\n</a>" )
IMPLEMENT_CONOBJECT(ScriptGroup )
IMPLEMENT_CONOBJECT(ScriptObject )
IMPLEMENT_CONOBJECT(ScriptTickObject )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "platform/platform.h" 25#include "console/simBase.h" 26#include "console/consoleTypes.h" 27#include "console/scriptObjects.h" 28#include "console/engineAPI.h" 29 30//----------------------------------------------------------------------------- 31// ScriptObject 32//----------------------------------------------------------------------------- 33 34IMPLEMENT_CONOBJECT(ScriptObject); 35 36ConsoleDocClass( ScriptObject, 37 "@brief A script-level OOP object which allows binding of a class, superClass and arguments along with declaration of methods.\n\n" 38 39 "ScriptObjects are extrodinarily powerful objects that allow defining of any type of data required. They can optionally have\n" 40 "a class and a superclass defined for added control of multiple ScriptObjects through a simple class definition.\n\n" 41 42 "@tsexample\n" 43 "new ScriptObject(Game)\n" 44 "{\n" 45 " class = \"DeathMatchGame\";\n" 46 " superClass = GameCore;\n" 47 " genre = \"Action FPS\"; // Note the new, non-Torque variable\n" 48 "};\n" 49 "@endtsexample\n" 50 "@see SimObject\n" 51 "@ingroup Console\n" 52 "@ingroup Scripting" 53); 54 55IMPLEMENT_CALLBACK( ScriptObject, onAdd, void, ( SimObjectId ID ), ( ID ), 56 "Called when this ScriptObject is added to the system.\n" 57 "@param ID Unique object ID assigned when created (%this in script).\n" 58); 59 60IMPLEMENT_CALLBACK( ScriptObject, onRemove, void, ( SimObjectId ID ), ( ID ), 61 "Called when this ScriptObject is removed from the system.\n" 62 "@param ID Unique object ID assigned when created (%this in script).\n" 63); 64 65ScriptObject::ScriptObject() 66{ 67} 68 69bool ScriptObject::onAdd() 70{ 71 if (!Parent::onAdd()) 72 return false; 73 74 // Call onAdd in script! 75 onAdd_callback(getId()); 76 return true; 77} 78 79void ScriptObject::onRemove() 80{ 81 // We call this on this objects namespace so we unlink them after. - jdd 82 // 83 // Call onRemove in script! 84 onRemove_callback(getId()); 85 86 Parent::onRemove(); 87} 88 89//----------------------------------------------------------------------------- 90// ScriptTickObject 91//----------------------------------------------------------------------------- 92 93IMPLEMENT_CONOBJECT(ScriptTickObject); 94 95ConsoleDocClass( ScriptTickObject, 96 "@brief A ScriptObject that responds to tick and frame events.\n\n" 97 98 "ScriptTickObject is a ScriptObject that adds callbacks for tick and frame events. Use " 99 "setProcessTicks() to enable or disable the onInterpolateTick() and onProcessTick() callbacks. " 100 "The callOnAdvanceTime property determines if the onAdvanceTime() callback is called.\n\n" 101 102 "@see ScriptObject\n" 103 "@ingroup Console\n" 104 "@ingroup Scripting" 105); 106 107IMPLEMENT_CALLBACK( ScriptTickObject, onInterpolateTick, void, ( F32 delta ), ( delta ), 108 "This is called every frame, but only if the object is set to process ticks.\n" 109 "@param delta The time delta for this frame.\n" 110); 111 112IMPLEMENT_CALLBACK( ScriptTickObject, onProcessTick, void, (), (), 113 "Called once every 32ms if this object is set to process ticks.\n" 114); 115 116IMPLEMENT_CALLBACK( ScriptTickObject, onAdvanceTime, void, ( F32 timeDelta ), ( timeDelta ), 117 "This is called every frame regardless if the object is set to process ticks, but only " 118 "if the callOnAdvanceTime property is set to true.\n" 119 "@param timeDelta The time delta for this frame.\n" 120 "@see callOnAdvanceTime\n" 121); 122 123ScriptTickObject::ScriptTickObject() 124{ 125 mCallOnAdvanceTime = false; 126} 127 128void ScriptTickObject::initPersistFields() 129{ 130 addField("callOnAdvanceTime", TypeBool, Offset(mCallOnAdvanceTime, ScriptTickObject), "Call the onAdvaceTime() callback."); 131 132 Parent::initPersistFields(); 133} 134 135bool ScriptTickObject::onAdd() 136{ 137 if (!Parent::onAdd()) 138 return false; 139 140 return true; 141} 142 143void ScriptTickObject::onRemove() 144{ 145 Parent::onRemove(); 146} 147 148void ScriptTickObject::interpolateTick( F32 delta ) 149{ 150 onInterpolateTick_callback(delta); 151} 152 153void ScriptTickObject::processTick() 154{ 155 onProcessTick_callback(); 156} 157 158void ScriptTickObject::advanceTime( F32 timeDelta ) 159{ 160 if(mCallOnAdvanceTime) 161 { 162 onAdvanceTime_callback(timeDelta); 163 } 164} 165 166DefineEngineMethod( ScriptTickObject, setProcessTicks, void, ( bool tick ),, 167 "@brief Sets this object as either tick processing or not.\n\n" 168 169 "@param tick This object's onInterpolateTick() and onProcessTick() callbacks are called if set to true.\n\n") 170{ 171 object->setProcessTicks(tick); 172} 173 174DefineEngineMethod( ScriptTickObject, isProcessingTicks, bool, ( ),, 175 "@brief Is this object wanting to receive tick notifications.\n\n" 176 177 "If this object is set to receive tick notifications then its onInterpolateTick() and " 178 "onProcessTick() callbacks are called.\n" 179 "@return True if object wants tick notifications\n\n" ) 180{ 181 return object->isProcessingTicks(); 182} 183 184//----------------------------------------------------------------------------- 185// ScriptGroup 186//----------------------------------------------------------------------------- 187 188IMPLEMENT_CONOBJECT(ScriptGroup); 189 190ConsoleDocClass( ScriptGroup, 191 "@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n" 192 193 "@tsexample\n" 194 "// First container, SimGroup containing a ScriptGroup\n" 195 "new SimGroup(Scenes)\n" 196 "{\n" 197 " // Subcontainer, ScriptGroup containing variables\n" 198 " // related to a cut scene and a starting WayPoint\n" 199 " new ScriptGroup(WelcomeScene)\n" 200 " {\n" 201 " class = \"Scene\";\n" 202 " pathName = \"Pathx\";\n" 203 " description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n" 204 " pathTime = \"0\";\n" 205 " title = \"Welcome to Orc Town\";\n\n" 206 " new WayPoint(start)\n" 207 " {\n" 208 " position = \"163.873 -103.82 208.354\";\n" 209 " rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n" 210 " scale = \"1 1 1\";\n" 211 " dataBlock = \"WayPointMarker\";\n" 212 " team = \"0\";\n" 213 " };\n" 214 " };\n" 215 "};\n" 216 "@endtsexample\n\n" 217 218 "@see SimGroup\n" 219 220 "@ingroup Console\n" 221 "@ingroup Scripting" 222); 223 224ScriptGroup::ScriptGroup() 225{ 226} 227 228IMPLEMENT_CALLBACK( ScriptGroup, onAdd, void, ( SimObjectId ID ), ( ID ), 229 "Called when this ScriptGroup is added to the system.\n" 230 "@param ID Unique object ID assigned when created (%this in script).\n" 231); 232 233IMPLEMENT_CALLBACK( ScriptGroup, onRemove, void, ( SimObjectId ID ), ( ID ), 234 "Called when this ScriptObject is removed from the system.\n" 235 "@param ID Unique object ID assigned when created (%this in script).\n" 236); 237 238bool ScriptGroup::onAdd() 239{ 240 if (!Parent::onAdd()) 241 return false; 242 243 // Call onAdd in script! 244 onAdd_callback(getId()); 245 return true; 246} 247 248void ScriptGroup::onRemove() 249{ 250 // Call onRemove in script! 251 onRemove_callback(getId()); 252 253 Parent::onRemove(); 254} 255