- Fehler
- Setup Dialog
- Sceneries Dialog
- Visual Dialog
- performance
- Performance Dialog
- debug dialog
- traffic dialog
- operations dialog
- message.txt dialog

FSImp also supports a text scripting language. Scripts have the ability to add new features to X-Plane and perform some helpful automation. Script files should be placed in the FSImp\scripts folder or its subfolders. They must have a .txt file extension. This folder has a number of example scripts. You may be in the position to write scripts yourself if you have some programming experience. You can also place scripts written by others directly into the FSImp\scripts folder or preferably into a new subfolder.

The script file globals.txt is interpreted first and contains useful definitions which are automatically available to other script files.

During loading, the text of scripts are written to the file FSImp\message.txt. Error detection is minimal. Error messages appear directly after the line which caused the error. Scripts which have errors do NOT run. You may edit scripts file, using a text editor, while X-Plane is running and Restart scripts to reload them. This allows you to correct syntax and logical errors during the development of new scrips.

The plugins FSImp menu can be used to control scripts and to communicate with running scripts.

  • Enable - loads all script files from the FSImp\scripts folder
  • Disable - discards all scripts
  • Restart - discards all scripts, reloads all script files from the FSImp\scripts folder
  • Menu - opens/closes the FSImp scripts menu as a dialog box
  • name - starts the function name which is implemented in a script
    The scripts state Disable/Enable/Menu is remembered for the next time you start X-Plane.

    What can scripts do ?

  • Access FSImp parameters
  • Access X-Plane data using DataRefs
  • Simulate X-Plane key presses
  • Simulate X-Plane joystick buttons
  • Speak
  • Play WAV format sound files
  • Write messages to the file FSImp\message.txt
  • Access the flight management system (FMS)
  • Search the X-Plane database for info on APT NDB VOR ILS ...
  • Scripts CANNOT access files or operating system components

    X-Plane DataRefs
    Plugins can access X-Plane's own data using DataRefs. These are grouped into folder-like categories and have descriptive names. The plugin allows scripts to use this feature to access X-Plane's own data. Naturally, an amount of care is necessary when accessing X-Plane data. The script interpreter automatically converts between data types (integer floating-point text arrays etc) when using DataRefs. Please be aware that DataRefs change with X-Plane versions. Existing ones may disappear or change their meaning while new ones may appear.
    The latest version of the DataRefs documentation is to be found on the X-Plane plugins SDK web site (follow Documentation + DataRefs).

    X-Plane keys and buttons
    Note that it is generally safer for future compatibility to use one of these commands than to manipulate the underlying sim data using DataRefs.

    Informal language description

  • XPlaneDataRefs are case sensitive
  • Other names are case insensitive so that TRUE true TRue are all the same
  • Reserved words are shown in bold
  • No spaces are allowed in reserved words: endwhile NOT end while
  • TABS and spaces are allowed in scripts
  • Indentation is not necessary but helps readability
  • Expressions cannot extend onto the next line.
  • Expressions are evaluated from left to right: 2+3*4 is 2+3=5, *4= 20
  • The type of a variable is defined by its first occurrance in the script
  • The types of XPlaneDataRefs and FSImpData are defined automatically
  • Types are automatically converted in expressions

    comment//textIgnored//this is a comment
    namealpha numeric _speed_100
    valuedecimalan integer number, base 1015
    hexadecimalan integer number, base 160x1af2
    floatingpointa floating point number with a decimal point or period1.234
    FSImpDataFSImp data"plugins/FSImp/airFPS"
    See xpl-param in FSImp.txt
    XPlaneDataRefXPlane data"sim/flightmodel/position/local_vx"
    See X-Plane 8.50 DataRefs
    "text"text in double quotes"this is a string"
    define#define name valuedefines name to be value#define MAX 20
    varstarts a block of variables
    name= valuedefines a variable called name with a valuex= 1.5
    sound namedefines a new sound object called namesound roar
    endvarends a block of variables
    enumstarts a enumerated list of names, counter set to 0
    name[=value]counter set to value if present, defines name to be counter, increments counter
    endenumends a enumerated list of names
    functionfunc menu "text"This function is added to the scripts menu as "text" and is executed when the user selects itfunc menu "tell time"
    func initThis function is executed automatically
    returnjumps out of the current function
    exitends interpretation of this script
    unaryOp+unary plus
    -unary minus
    !logical inverse
    ~bitwise inverse
    strlenstring len
    randrandom number in range 0..n-1 (integer)
    sinsine, parameter in radians
    coscosine, parameter in radians
    tantangent, parameter in radians
    asinarc sine, result in radians
    acosarc cosine, result in radians
    atanarc tangent, result in radians
    sqrtsquare root
    expexponent: e to the power
    termunaryOp valueabs delta
    %modulo (no floating point)
    &bitwise and
    |bitwise or
    ^bitwise exclusive or
    <<shift left
    >>shift right
    term binaryOp expressionevaluated from left to right without operator priority
    format0w.phxpad 0, width, places, hex, explode
    5.3floating pt width 5, 3 places after the point
    8width 8
    8hwidth 8, hex
    08hpad 0, width 8, hex
    08hxpad 0, width 8, hex, explode
    textTermstextTerm ...a sequence of 1 or more TexTerm
    built-in functionswait secondsthe interpretation of this script pauses
    timerstart namestarts a timer so that reading it returns 0
    timerpreset name secondsstarts a timer so that reading it returns seconds
    speak textTermswaits for last speak to finish, starts to speak textTerms
    msgFile textTermswrites textTerms to FSImp\message.txt
    playsound valuewaits for last sound to finish, starts to play the sound filename value
    XPLMSpeakString textTermsstarts to speak textTerms immediately
    XPLMCommandKeyStroke keysee globals.txt for enum xplm_key_...
    XPLMCommandButtonPress buttonsee globals.txt for enum xplm_joy_...
    XPLMSetUsersAircraft textTermsloads the user aircraft given a path name, relative to X-System, including the .acf extension
    XPLMPlaceUserAtAirport textTermsplace at airport given ICAO 4-letter code
    XPLMGetNthAircraftModel index name pathfor aircraft index (0 for user), get filename without .acf, and path relative to X-System but without the filename
    sound object functions.load valueloads the sound filename valueroar.load "lion roar.wav"
    .playstarts the sound playing
    .loopstarts the sound playing repeadlyroar.loop
    .stopstops the soundroar.stop
    .waitwaits until the sound has stopped playingroar.wait
    .volume valuesets the volume: 1.0 means originalroar.volume 0.7
    .frequency valuesets the frequency: 1.0 means originalroar.frequency 0.85
    .pan valuesets the balance: -1.0 is left, 0 is centred +1.0 is rightroar.pan -0.33
    .changevolume valuechanges the volume by valueroar.changevolume -0.05
    .changefrequency valuechanges the frequency by valueroar.changefrequency delta
    .changepan valuechanges the balance by valueroar.changepan +0.2
    assignmentvariable= expression
    variable+= expression
    variable-= expression
    variable*= expression
    variable%= expression
    variable&= expression
    variable|= expression
    variable^= expression
    variable<<= expression
    variable>>= expression
    condOp==equal to
    =equal to
    !=not equal to
    <>not equal to
    >greater than
    >=greater than or equal to
    <less than
    <=less than or equal to
    ^exclusive or
    term condOp termx<=MAX
    conditionTerm logicOp conditionevaluated from left to right without operator priorityx<=MAX | fishing & alpha==pi
    iterationwhile conditionremain in loop as long as condition is true
    breakjumps out of current while loop
    conditionalif conditionif condition is true, execute following statements
    elseif condition

    FSImp plugin for X-Plane