String and Escape Sequence Syntax

[This is preliminary documentation and subject to change.] 

To write special characters into a stream script, use the string and escape sequence syntax. The Enhancement Stream language supports string concatenation, allowing you to build strings using combinations of string, numeric, and variable values.

Syntax

"TextString" + Variable + "EscapeSequence"

where TextString is an alphanumeric string of text enclosed in quotes, Variable is any value that is defined in a variable declaration, either numeric or text, and EscapeSequence is an escape sequence, enclosed in quotes. These three syntactic elements can be used in any order and combination.

Notes

The ability to build strings is especially helpful if you want to write a stream script that serves as a template for many different scripts, or if you simply want to build greater flexibility into your event statements, such as triggers.

For example, you might be producing a series of interactive shows about the seven wonders of the ancient world, and each show follows a very similar format, where certain enhancements appear at a set pace and in a predetermined frame of TV Viewer or a Web browser. Since you intend to keep the general structure and presentation of the content similar from one show to the next, one of the major differences among episodes will be the content. From a stream script standpoint, this means a difference in the names of the HTML (Hypertext Markup Language) files that are broadcast.

To this end, then, you could instruct your enhancement production staff that the core name for all HTML files for the first episode on the pyramids at Giza should be Giza, such that all the HTML enhancements have a similar name:

Giza000.htm
Giza005.htm
Giza010.htm
Giza015.htm
Giza020.htm
etc.

Then in the stream script, you could identify this core file name value using a variable, such as wonder:

wonder = Giza

From then on, all your event statements could reference that variable, building the string using a combination of the variable and a text string, combining the two elements with a plus (+) sign:

before 00:00:20:20 trigger (3 "Side" wonder + "005.htm");
before 00:00:50:60 trigger (3 "Side" wonder + "010.htm");
before 00:01:18:40 trigger (3 "Side" wonder + "015.htm");

These trigger statements are identical to—and therefore are interpreted the same as—the following event statements:

before 00:00:20:20 trigger (3 "Side" "Giza005.htm");
before 00:00:50:60 trigger (3 "Side" "Giza010.htm");
before 00:01:18:40 trigger (3 "Side" "Giza015.htm");

By using the variable wonder rather than writing out the specific filename for each event, you can change the content of the stream script by simply redefining the variable. For the second show, then, about the Hanging Gardens of Babylon, you could redefine the variable wonder to match the core name of that show's HTML files, namely, Gardens.

wonder = Gardens

Escape Sequences

In the course of building strings, you can represent certain unprintable characters using escape sequences. Escape sequences are character combinations consisting of a backslash (\) followed by a letter or by a combination of digits. When writing statements in a stream script, you must use escape sequences to execute such text entities as tab characters, backspaces, and new lines. The Enhancement Stream language regards an escape sequence as a single character and will therefore consider one valid when used as a character constant.

For instance, you may want the title of the program, which appears in the channel listing in the Program Guide, to look something like this:

"Secrets of the Incas"
Premium Presentation

To define this title for your show, you would, of course, use the reserved variable Title. There are a couple of issues here, however, that you must address to get the title to appear as it does in the example. For one thing, the title uses quotes, and since the syntax for defining Title encloses your title in quotes already, you must use an escape sequence to represent the quotation marks around the text Secrets of the Incas. Moreover, the phrase Premium Presentation, which perhaps represents the level of enhancements the show will broadcast and, therefore, the cost of subscribing to the show, appears on its own line. So you would need an escape sequence to represent the new line.

The title in the stream script would end up looking like this:

Title="\x22Secrets of the Incas\x22\nPremium Presentation"

Escape sequences are used to provide literal representations of nonprinting characters and characters that would be difficult to edit and display in their raw form.

The Stream Compiler supports the following escape sequences:

Escape Sequence Represents
\b Backspace
\f Formfeed
\n New line
\r Carriage return
\t Horizontal tab
\xhh ASCII character in hexadecimal notation, where hh is the hexadecimal value. For example, the registered trademark sign ® whose ASCII code is 0174, has a hexadecimal value of AE. The hexadecimal escape sequence for the registered trademark symbol would be /xAE .