MAXScript Global Variables

You can define new system global variables with the define_system_global() function. It has the following signature:

void define_system_global(TCHAR* name, Value*(*getter)(), Value*(*setter)(Value*));

Where name points to the string naming the new global and getter and setter are pointers to functions that allow modification of the variable. For example:

Value* get_frame_rate()
{
    return Integer::intern(GetFrameRate());
}

Value* set_frame_rate(Value* val)
{
    SetFrameRate(val->to_int());
    return val;
}

define_system_global("frameRate", get_frame_rate, set_frame_rate);

.