Game Development Community

Adding members to ShapeBase for console?

by Danner Jones · in Torque Game Engine · 03/04/2004 (4:34 pm) · 2 replies

Is it possible to expose member fields to the console for a ShapeBase, rather than go through functions? Something similar to using addField in initPersistFields for a ShapeBaseData object?

As I see it right now, if I have a property on the Player object that I want to expose to script, I have to expose it through set/get type methods (named whatever I want of course). It would seem more intuitive if I could use a member field-like syntax.

For example:
Instead of using:
%player.setShapeName(%this.name);
I could use:
%player.shapeName = %this.name;

(Not sure if that's even possible for that method - but it's just an example).

I have around 10 fields that I'd like to expose to script - basically making many of the PlayerData fields "dynamic" by adding them to the Player object. It seems "better" to have them as properties but I can't find any way to do that with the "stock" engine. I don't have the experience to add new methods to Con:: to expose an addField function and "hook" it in myself.

-Nerseus

#1
03/05/2004 (10:09 am)
All SimObjects have an initPersistFields method. Use that?
#2
03/05/2004 (3:29 pm)
D'oh! I didn't see it on Player already, only on PlayerData. Didn't check to see if it could be used on Player - thanks!