Pointer Happiness
by Kevin James · in Torque Game Builder · 03/28/2005 (5:45 am) · 1 replies
I was overjoyed to discover how easy and intuitive it was to implement pointers in torquescript. Playing with the Basic Tutorial, I wanted to access the thruster object in the keypress functions. I added this line to AttachThruster:
if (%mountObj==$player)
$player.thruster = %thruster;
Now I can access the player's thruster anywhere I want without doing something stupid like make the thruster global. Very cool.
if (%mountObj==$player)
$player.thruster = %thruster;
Now I can access the player's thruster anywhere I want without doing something stupid like make the thruster global. Very cool.
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
Torque 3D Owner Stephen Zepp
That being said, you are correct--you can do all sorts of nifty things like that--just be careful about how you use them--you won't crash (most of the time), but if you use this technique, you don't have any auto-magical cleanup if the %thruster object is deleted, for example.