User-Defined Triggers

[This is preliminary documentation and subject to change.] 

To trigger an event that is not covered by the reserved triggers of the Enhancement Stream language, you create and broadcast a User-Defined Trigger.

User-defined triggers open up essentially unlimited possibilities for control over your interactive show. Because user triggers can invoke subroutines that you create in Microsoft Visual Basic Scripting Edition (VBScript) or JScript, you can perform any type of action, including client-side decision branches and dynamic generation of HTML (Hypertext Markup Language), based on receipt of a particular trigger message.

User-defined triggers may be numbered from 1000 to 2,147,483,647. They can be used for any purpose desired by the enhancements producer. A user-defined trigger command requires the keyword trigger followed by the integer key and the string.

trigger (lKeyID "Data") ;

Where

lKeyID
specifies the trigger identifier, whose value is defined by the content provider. This must be a integer greater than or equal to 1,000 and less than or equal to 2,147,483,647.
Data
specifies the trigger information. The trigger information data is parsed and used by the event handler that processes the user trigger. The format of the trigger information is defined by the broadcaster.

Remarks

When the broadcast client receives a User-Defined trigger, the Enhancement control fires a UserTrigger event, which can then be handled by scripts embedded in the enhancement page.

Examples

The following examples illustrate how you could use User-Defined triggers to transmit quiz show questions and answers. The user-defined trigger data can then be parsed and used by scripts on the enhancement page.


trigger (3001 "Q:What is the capital of Florida?_A:Tallahassee") ;
trigger (3001 "Q:Tomatoes are which kind of plant?_A:Fruit") ;

The following examples use a different User-Defined trigger syntax to pass the time of day to the enhancement page. This could be used, for example, to change the background image of an enhancement to reflect the current time.


trigger (2049 "Twilight") ;
trigger (2049 "Morning") ;
trigger (2049 "Afternoon") ;