Contents

Previous

Next

Last

Script Definition

Every time you start a new map, the Control Manager creates a script file to go along with it. The script file is just a text file. It has the same name as the map, but the extension is ".CMS" rather than ".MAP". This script is initially empty, containing just the two statements that mark the beginning and the end of the script. The empty script looks like this:

SCRIPT
ENDSCRIPT

The empty script does nothing at all. You have to enter the script statements between the SCRIPT and ENDSCRIPT statements that define what the script is to do. If you don't, then the actions that the map performs are entirely defined in terms of real devices and what you set in the GUI.

The functions that go between SCRIPT and ENDSCRIPT are the subjects of the next several section of this guide. Before getting into those, though, there are a couple of things that will be noted here.

Case Sensitivity

The CMS scripting language is not case-sensitive, "SCRIPT" is exactly the same as "script" or even "ScRiPt". Likewise "JS1.A1" is the same as "js1.a1". Mixing case is fine, too, and can improve readability. For example "exitCase" rather than "EXITCASE" or "exitcase". Anything in the file can be upper or lower case and it makes no difference in the final result.

Comments

Comments are just notes that you place in the script to explain what's going on. They aren't required and have no effect on what the script actually does. They can appear anywhere in the script. A comment is indicated by preceding the text with a "//". They cause any text beginning with the "//" and extending to the end of that line to be treated as if it did not exist. For example:

// This is a comment.

Comments aren't required, but they are a good idea. Things that are fresh in your mind while you're writing the script can be quite a mystery if you come back in a month and try to figure out what you were doing, even minimal commenting can be a great help in remembering why you did what you did.

Semicolons

Most script statements require a semicolon to be placed at the end of the functional part of the line. There are exceptions to this rule in the case of flow-control statements and some of the other functions, those will be noted in the appropriate sections. The semicolon must be ahead of any comments on the line or it will be seen as part of the comment. For instance:

CMS.A1 = JS1.A1; // Copy Joystick 1 X Axis to CMS Axis 1

Remember that everything starting with the "//" comment indicator is essentially non-existent when the script is compiled.