Skip to main content

Scripts

Scripts are the foundation of the stories you construct. Each script generates a narrative (or part of a narrative) by combining fixed text with Articulate Text Language (ATL) elements.

By default, each project contains one script called Main, but you can add as many scripts as you wish. Using references (also known as calls) to scripts within your Main script makes it easy to manage the complexity of hierarchically organized texts.

Index

Creating and editing scripts

Scripts are created and edited in Compose View, which includes a script editor and a script panel.

KC_scripts1.png

Using the script editor, you can produce scripts without having to know much ATL. For example, we show how to write the script example in the image above in our first Getting started tutorial, which takes you through each stage in simple-to-follow steps.

The image above shows the project's Main script in the editor's Marked Up View, which uses color markup to simplify and highlight the key ATL elements in your script. The color markup works as follows:

ATL Element

Color Markup

Variable

Underlined in green

Function

Underlined in orange

Conditional

Underlined in purple

Script Call

Underlined in green

You can view the script's underlying ATL by clicking the ATL View button in the upper right of the toolbar.

atlView_selectAtlView.png

Here is how the script's content appears in ATL View:

KC_scripts2.png

ATL View does not use color markup to highlight ATL elements. Instead, it displays the actual ATL. Experienced users often prefer this view because it's easier to see syntax errors (some are rendered invisible by color markup) and they can make quick edits without invoking tools such as the Function Builder or Conditional Builder.

Tip

ATL View has other unique features. See Using ATL View to learn more.

Inserting script calls

There are several ways to insert a script call inside another script. First, you can type the script name inside an ATL block — e.g. [[LondonSummary]] calls the LondonSummary script.

Another way is to click the Insert Script button in the toolbar and select a script from the menu. The menu mirrors the script order and folder structure in the scripts panel.

CV_insertScriptCall.png

Alternatively, drag and drop from the script panel:

CV_dragDropScript.gif

Tip

See Using the script panel for further guidance.

Script names

Script names are case-sensitive.

A valid script name meets the following conditions:

  • Its length does not exceed 40 characters.

  • It begins with an alphabetic character.

  • It contain no spaces and no punctuation marks except the underscore character.

  • It's different from the name of any existing script, folder, or variable.

  • It's not a reserved word.

A warning message appears when you enter a script name that violates one of the above conditions. This message clearly states which condition has been violated. For example:

KC_scripts3.png

If you click away from the input field without correcting the problem, the script's original or default name — for example, NewScript for a newly created script — is used instead.

Important

You can give a script the same name as an ATL function, but we advise against this.

If your script has the same name as an ATL function (e.g. product) and you accidentally call the function without parameters (e.g. [[product()]]), Studio treats this as a call to the script.

Parameterized scripts

You can also write parameterized scripts. These are scripts written to take input parameter values that vary the script's output. For further guidance, please see ATL Guide > User-defined functions.

Furthermore, you can write parameterized scripts that return only a value (a number, string, list, etc.) rather than a value plus text. For further guidance, please see the section on #value scripts.