Demo: LVAR write access for any aircraft control

To read the value of an LVar that has been defined elsewhere:

int id = check_named_variable( "MyVariable" );

if ( id != -1 ))
  double value = get_named_variable_value( id );

To write the value of an LVar that has been defined elsewhere:

double value = 1234

int id = check_named_variable( "MyVariable" );
if ( id != -1 ))
 set_named_variable_value( id, value );

To define a new LVar:

int id = check_named_variable( "MyVariable" );

if ( id == -1 ))
  int id = register_named_variable( "MyVariable" );

the > sign in used in XML expressions to indicate the expression will write to the LVar, otherwise it’s a read.

1 Like