Syntax and the FreeForm Script Editor

Top  Previous  Next

Using FreeForm Script Editors to create FreeFlyer script provides the ability to bypass the limitations of the object editors and command editors. Every object, command, or function that can be accessed via an editor window can also be accessed through FreeFlyer script.


To create custom script, drag and drop a "FreeForm" script element into the Mission Sequence. A Mission Sequence can contain multiple FreeForm elements. Double-click a FreeForm row to edit it; it will open in a new tab next to the Mission Sequence tab. For a complete view of your Mission Sequence, including all FreeForms and command rows, click the drop-down arrow on the Mission Sequence tab and select "View Script Overview".




FreeFlyer Script Syntax


All FreeFlyer Script lines must end in a semicolon (;)


Creating Objects

Objects can be created in FreeFlyer script using the simple <Object Type> <Object Name> format, or "constructor," as shown below. More examples are shown in the Object Constructors section of the Working with Objects Guide.

These objects can be created with the Global and/or Constant keywords preceding their declaration. The Global keyword makes the object available in all scopes while the Constant keyword necessitates the object being initialized to a starting value and further prevents the object's definition from ever changing.


Variable y;

Constant Variable a = 5;

Global String filename = 'TestResults.txt';


Array x[3];

Array z = {1, 2, 3};


Spacecraft Spacecraft1;


Object Properties and Methods

Properties are data carried by the object, and can be referenced or reported directly.

Object properties can be accessed using the <Object Name>.<Property Name> syntax.





Methods are actions performed by the object, and can take arguments inside of parenthesis following the method name.

Object methods can be accessed using the <Object Name>.<Method Name>(Argument) syntax.

Variable1 = Spacecraft1.Contact(GroundStation1);

Variable1 = Spacecraft1.ShadowTimes(EventTimeArray, EventTypeArray);


Static Methods

Some object types have static methods, which are accessed simply by typing the object type followed by a period.


TimeSpan1 = TimeSpan.FromDays(2);


Child Objects

Many object types also have child objects that are either premade for convenience and property/method bundling or may be declared separately and later attached to specific parent types in the form of subsystems. For example, a Spacecraft named "mySpacecraft" can have tanks, thrusters, propagation models, etc.


mySpacecraft.Tanks[0].TankVolume = 0.5;



Place two forward slashes (//) in front of any text that you wish to be a comment.

To comment or uncomment multiple lines at once, select the lines and right-click, then choose "Comment Selection" or "Uncomment Selection"


Step mySpacecraft; // Stepping the Spacecraft


Multi-Line Comments

Place a single forward slash followed by an asterisk (/*) in front of any text that you wish to turn into a multi-line comment.

To end the multi-line comment, place an asterisk followed by a single forward slash (*/).

The starting and ending tokens for a multi-line comment can be placed anywhere on any line of script so long as the starting token precedes the ending token.


/* Informational Text


This information spans multiple lines.*/


Description Comments

Place three forward slashes (///) after the semicolon of an object's declaration to give that object a description.

This description will be carried forward in the Mission Plan and will show up in the hover-over text for that object anywhere that you use it.


Description Comment Sample

Description Comment Sample



Flow Control

Certain Script Elements control the flow of the Mission Sequence

Examples include: While, If, For, etc.

While (<expression>) ;
If (<expression>);



A command tells FreeFlyer to perform a top-level action usually involving multiple objects.


Step mySpacecraft;
View mySpacecraft, myGroundStation;



FreeForm Script Editor Conveniences

The FreeForm Script Editor has a number of convenience features implemented to simplify the process by which script is developed for FreeFlyer.


Smart Indentation

FreeFlyer Script will automatically smart indent to help you organize your script


For i = 0 to 10;

     i = i + 5;



Bracket Highlighting

FreeFlyer Script will automatically highlight the corresponding start or end bracket for a selected bracket.





FreeForm Script Editor Right-Click Menu

In the FreeForm Script Editor, right-click using the mouse to view the following menu options. Most of these options can be accessed using a shortcut, see the FreeFlyer Script Overview Shortcuts section in the Appendix for all of the available shortcuts.


FreeForm Script Editor Right-Click Menu 

FreeForm Script Editor Right-Click Menu 


Cut, copy, and paste FreeFlyer script

Increase or decrease line indentation

Block or comment selected script

Find or replace FreeFlyer script

oTo search for text in a collapsed section of script, check the "Search hidden text" box


FreeFlyer Script Find Options

FreeFlyer Script Find Options


Go to a line specified by line number

Go to a line in the Script Overview

Go to the definition of an object in script or the Object Browser

Find all references to the selected token in the Mission Plan

Go to the help file page most relevant to the selected token

Run script up to the location of the cursor

oUseful for debugging FreeFlyer script



Autocomplete Logic

Autocomplete logic groups all FreeFlyer script syntax into seven categories and provides an aid in developing FreeFlyer Script. As you type a drop down menu appears, displaying objects, commands, or properties that are available. The bold letters in the below numbered list indicate the letter that appears in the auto-complete logic popup window when you encounter an item of that type.



Examples: Plot, Report, Step


Applies to object properties that require arguments and static methods

Examples: AlongTrackSeparation, ContactTimes, DayofYear

Syntax Example: mySpacecraft1.AlongTrackSeparation(mySpacecraft2);


Examples: CrossProduct, DotProduct


Applies to connecting FreeFlyer Script syntax

Examples: from, generating, not, as


Applies to the name of any object that you have created

Examples: GroundStation1, Spacecraft1, WatchWindow1


Applies to object properties that have no arguments

Examples: Spacecraft1.A, Spacecraft1.RAAN, Spacecraft1.Cd


Applies to the object type

Examples: GroundStation, Spacecraft, WatchWindow


 Example 1: Commands in Autocomplete Logic


 Example 2: Objects in Autocomplete Logic


 Example 3: Properties in Autocomplete Logic



See Also

FreeFlyer Script Shortcuts