VR-Forces 5.1.1 Lua Function Documentation

ComponentSystem

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

A component system is a capability that is assigned to the entity in the Entity Editor. Systems represent movement and damage capabilities, and represent individual weapons and sensors. In scripts, system objects are obtained from the ownship simulation object ("this") with a call to getSystem(), passing the name of the system (as used in the Entity Editor) as an argument. The script can then access various attributes of the system through getAttribute calls.
Also see this:getSystemNames(), which provides a list of all systems on the entity.
Also see the documentation for the SystemAttribute module.

Function List

getAllAttributeNames () Provides a list of all attributes supported by this system.
getAttribute (attributeName) Gets the value of the given attribute of the given system.
getFullName () Returns the fully qualified name of the system
getName () Returns the name of the system
isEnabled () Returns whether this system is enabled or not
isValid () Returns true if the object and component system are defined
setAttribute (attributeName, value) Sets the value of the given attribute of this system.


Functions

getAllAttributeNames ()
Provides a list of all attributes supported by this system.

Return value:

    A table of strings, representing all of the attribute names supported by this system.
getAttribute (attributeName)
Gets the value of the given attribute of the given system.

Parameters:

  • attributeName: The name of the desired attribute.

Usage:

    missleName, error = missileLauncher:getAttribute("launched-munition-name")

Return values:

  1. An object containing the attribute value. May be a boolean, a number, a string, or some other object. This is an object with a nil value if the attribute was not found in the system.
  2. A boolean indicating whether there was an error because the an attribute of the given name was not found.
getFullName ()
Returns the fully qualified name of the system

Return value:

    The fully qualified name of the system (string). This is the internal name that is used to disable/enable a system
getName ()
Returns the name of the system

Return value:

    The name of the system (string). This is the print name that is visible in the Entity Editor and task menus.
isEnabled ()
Returns whether this system is enabled or not

Return value:

    true if system is enabled
isValid ()
Returns true if the object and component system are defined

Return value:

    True if the object and component system are defined
setAttribute (attributeName, value)
Sets the value of the given attribute of this system.

Parameters:

  • attributeName: The name of the desired attribute.
  • value: The value of the attribute. Can be a number, Boolean, or or string; should be appropriate for the attribute.

Usage:

    error = missileLauncher:setAttribute("launch-munition", true)

Return value:

    A boolean that is true if there was an error.

Copyright© 2024 MAK Technologies, Inc. All rights reserved.