Game Development Community

Difference between the different IMPLEMENT_XXXX_CALLBACK ?

by elvince · in Torque 3D Professional · 08/05/2010 (8:54 pm) · 5 replies

Hi All,

Can someone explain me what's the differes between
IMPLEMENT_CONSOLE_CALLBACK
// Again, temporary macros to allow splicing the API while we still have the console interop around.
What does that mean

IMPLEMENT_CALLBACK ??

IMPLEMENT_GLOBAL_CALLBACK
/// Used to define global callbacks not associated with
/// any particular class or namespace.

IMPLEMENT_NEW_CALLBACK ??

This is new in Beta 2 but it seems to be something important to understand to develop the console callback

Thanks,

Ps: In release note, it is mentioned DECLARE_CONSOLE_CALLBACK but it doesn't exist. only DECLARE_CALLBACK exist for all implement_XXXX

#1
08/05/2010 (9:44 pm)
You should mostly only be concerned with DECLARE_CALLBACK and IMPLEMENT_CALLBACK(...). These are meant to replace the whole Con::executef(...) system of callbacks to TorqueScript. This is a true callback system, and is a blessing for anyone looking to extend the engine.

It was developed to aid in the big documentation project we just delivered on. You can find the most common examples sprinkled through all the main classes exposed to TorqueScript.
#2
08/06/2010 (6:36 am)
Thanks Michael.
So I will stick to the Implement_Callback and not use the other.

For my background, I will be glad to have the definitions and when to use the other functions. They might specific to certain case and this will be interesting to know that.

#3
08/06/2010 (9:22 am)

IMPLEMENT_GLOBAL_CALLBACK is for implementing a callback that is not bound to an object.

The other specializations of the macros can generally be ignored. The XXX_CONSOLE_XXX versions are for defining something specific to the console interop whereas the XXX_NEW_XXX versions are for defining something specific to the engine API interop which however is not used in the codebase. So neither versions are really useful for general use ATM.
#4
08/08/2010 (7:47 am)
thanks for the clarifications.
#5
10/08/2010 (11:36 pm)
I see this in the official docs: http://docs.torquepowered.com/torque-3d/official/index.html?content/documentation/Beginners%2520Guide/World%2520Editor/TerrainEditor.html

But nothing about if you don't want to have a method you just want to call a script function. I think it is IMPLEMENT_GLOBAL_CALLBACK. looking at examples of how to use it, but would be nice to have it added to the docs.