Game Development Community

Interfacing with engine

by Robert S. · in Torque Game Engine · 10/06/2005 (7:36 am) · 2 replies

Hi,
Can you please tell me how I can retrieve, in the C++ code, the value of a member variable of a certain AIPlayer object which was declared in script.
For example:
%player = new AiPlayer()
{
datablock = %varDataBlock;
};
%player.anyVariable = "Test text";
My goal is to retrieve the value of "anyVariable" in the AIPlayer class.
Thank you.

#1
10/06/2005 (8:51 am)
If you want variables that can be modified in both script and c++, define them as persistent fields (see initPersistFields in player.cc's file, specifically about PlayerData, but it is used all over the place).
#2
10/10/2005 (1:23 pm)
Thanks, Stephen!