Variable Names
All variables used in the CMS have predefined names. The name is based
on the type of the variable (Analog or Bit) and what the variable
represents. The latter can be a control on a real controller, one of the
CMS Controls, or one of the internal variables that the
CMS provides.
General Naming Conventions
The names for analog variables all start with an "A" followed by a number
indicating which analog variable is being referenced, i.e. "A4". Similarly,
bit variables begin with "B", again followed by an number indicating which
bit variable is being referenced. For example, "B14". This applies to
all variables regardless of their source.
Variable Groups
The variables generally fall into one of several groups. In some cases
the name of the variable itself is enough to place it in a particular
group. In other cases, the variable name is formed by a device designator
followed by a "." followed by an axis or button ID.
Real Controllers
The real controllers, the CH USB devices that you have in the map, are
designated "JS1" through "JS16" (depending on how many you actually have,
of course). The "JS1" controller is the one on the left-most Device Tab
(excepting the "Program Settings" tab) when you view your map in the GUI.
"JS2" is the next device to the right, and so on.
To designate a particular control on that controller, the controller ID
is used, followed by a ".", followed by an analog or bit variable. For
example, if the left-most device tab in your map is the FighterStick,
you could reference the X axis on the FighterStick as:
JS1.A1
Button 7 on the same stick would be:
JS1.B7
If the device on the next tab was
a Pro Throttle, you could reference the button under the micro-stick as
"JS2.B1". In the case of axes and hats, it's not immediately apparent
which axis or button your referencing. In these cases the GUI will append
the appropriate designator to the device name in the Dialog Pane and you
can look there to find it. Hat 1 Up on the CombatStick, for example, is
actually Button 7. The GUI display will show "Hat 1 Up [B7]", the B7
is what you want to reference in the script. Likewise, the throttle axis
will show up as "Throttle [A3]".
Recognized axis references for the JSx devices are "A1" through "A6"
corresponding to the X through V axes respectively. Recognized button
references are "B1" through "B40". The upper limit of "B40" is to allow
for some future expansion. Actual controllers don't have buttons above
B16 since they aren't physically present.
There is one exception to the above. Even though they do not show up
as buttons in the test screen, you can reference the POV positions
on a real devices by referencing buttons "B25" through "B32".
The "B25" position corresponds to "POV Up", the numbers then go in
sequence clockwise around the POV with "B32" being the "POV Up/Left"
position. So, for example, you could reference the POV Up position
in your CMS script as "JS1.B25", POV Up/Right, as "JS1.B26", etc. These
references are active regardless of the mode that the POV is programmed
to use. It can be set to act as an actual POV or programmed to send buttons
or characters and the B25..B32 references will still work within the CMS
script.
Note that these are the positions as they show up in the test
screen when the hat is set as a POV. On the ProThrottle, this doesn't
necessarily correspond to the actual physical direction. In that one case,
"POV Up" is reached by physically moving the hat to the right. The other
positions do follow in a clockwise direction from there.
You cannot assign a value to an axis or
button on a real device. That is strictly controlled by the device itself.
These values are effectively read-only. The analog values coming from the
control will have a range of 0 through 255, assuming the controller has been
properly calibrated in the GUI.
CMS Controls
The CMS Controls, the ones you program in the GUI, are referenced similarly
to the JSx devices, but they use "CMS" rather than "JSx" for the prefix. For
example:
CMS.B1
CMS.A13
Since only one set of CMS Controls can exist in the map, there is no
need for a numeric identifier. The CMS includes 64 axes referenced as
"A1" through "A64", and 128 buttons, referenced as "B1" through "B128".
These correspond to the axes and buttons that are available for programming
in the GUI when the CMS Controls tab is selected. CMS variables can be
both read and set. Setting the value of a CMS variable is how you control
the output of the CMS Control.
Like the JSx variables, the CMS analog values can have a range of 0 through
255. You can exceed that range, but anything outside of that range will
result in the control being seen as at its minimum or maximum value by the
Control Manager. When you assign a CMS Control axis in the GUI, the axis
that tracks it will go from its minimum to its maximum as the value set
in the CMS value goes from 0 to 255.
Internal Variables
The CMS provides internal "scratch pad" variables for use by the script.
These variables cannot be programmed by the GUI directly. Only the CMS
Controls have that capability. These variables are just used for
working storage, etc. It's best to use these variables unless the variable
actually needs to go out through the CMS controls to control a Control
Manager Device button or axis or to send a character string of some sort.
There are 256 internal analog values and 1024 internal bit values. Since
there isn't any "device" associated with these, they are referenced without
a prefix. The valid references are "A1" through "A256" and "B1" through
"B1024".
Device Variables
There are also a set of variables termed "Device Variables". These are bit
values used to indicate the current state of some of the functions used in
the scripting language, particularly timers. This will be covered in some
detail later, for now it's enough to note their existence. There are 256 of
these variables, they are referenced as "D1" through "D256" and they do
not require a prefix.
Special Variables
There is one additional internal variable referenced as CURRENTMODE. This
indicates the current mode of the Control Manager, that normally set via
the FighterStick or ProThrottle. The CURRENTMODE variable can be assigned a
value and the rest of the map will change modes just as if it were switched
using one of the above devices. The script cannot affect the LED indicators
on the devices, though, so if you set CURRENTMODE via the script there will
be no particular correlation between the Control Manager mode and the
device LEDs.
Predefined Constants
There are also a three predefined constants which can be used to set or
check the CURRENTMODE variable. These values are MODE1, MODE2, MODE3
and MODE4 and have values of 0, 1, 2, and 3 respectively.