Event handlers have their own scope as regular functions do. I'm almost certain of this, because you can call, in example, the code inside "on button pressed" event like a function, with button.pressed(). But he declared the variable holding the pointer to the Sphere in macroScript scope, resolving the event scope issue.…
Hi, if I get it right, following code should do what you're looking for. macroScript Example category:"Example" ButtonText:"Example"( local m_orientationsphere = undefined on execute do ( m_orientationsphere = Sphere radius:1 pos:[0,0,0] deleteAllChangeHandlers id:#whenHandler when transform m_orientationsphere changes…
I want an object to be created that is checked lateron with a changehandler. The problem is the creation of the object itself when i evaluate the code below it complains about the variable not being an object (undefined variable) when i try to create the object directly below the macroscript line it will create my object…