If you want to pass a variable
from one controller script to another, then you use the syntax for getting or setting a Controller Variable.
But if you want the controller script to read a value of a property in the
opr file linked to it, then you use GetControllerSetting.
Create a FPS multiplayer template, for example, and take a look at the character.gsl script, inside of the character object folder.
I?ll paste some parts of its code here:
The character.gsl has
in the top:
// constants (modifiable from controller settings, see Initialize function)
float WALK_SPEED = 2.0;
float RUN_SPEED = 4.0;
Vector CAMERA_TARGET( 0.0, 1.0, 0.0);
Vector CAMERA_OFFSET( 0.0, 1.0, 3.0);
Vector FIRST_PERSON_EYE_POSITION( 0, 1.7, 0);
const float MOUSE_LOOK_MULTIPLY = 90 / PI;
Then,
inside of Initialize(), it has:
void Initialize( Object@ object)
{
//(code for other stuff)
WALK_SPEED = object.GetControllerSettingFloat( "WalkSpeed", WALK_SPEED);
RUN_SPEED = object.GetControllerSettingFloat( "RunSpeed", RUN_SPEED);
//(code for other stuff)
}
And, of course, they have this
in the opr file linked to the controller (I?m stripping out the code for other stuff):
ControllerType Scripted
ControllerSetting ScriptFile character.gsl
ControllerSetting WalkSpeed 4.0
ControllerSetting RunSpeed 6.0
Hope you?ve understood. Did you?