Lightwing can retrieve dynamic information from the internet via RSS (Really Simple Syndication) channel feeds and display that information with Text or Ticker commands. This example demonstrates an RSS channel provided by the New York Times and displays it on a page with a combination of text and a scrolling ticker that steps through all of the items on the RSS channel feed.
Some RSS feeds also supply thumbnail images that can accompany text items in the feed. Such images can be displayed with box or object commands by specifying the RSS channel name to their rss options, instead of image options. Thumbnail images are too small to be used for background images. The size option is avoided here because that would distort the aspect ratio of the images.
The rss command establishes an internet connection, creates an RSS channel named NYTimes and defines a periodic update time interval for this channel with the update option. The required url option defines the web address of the RSS channel feed. The thumbnail option enables the fetching of images, if available and the scale option is used to double image sizes while preserving their aspect ratios. This command can be repeated for any number of RSS channels and they remain in effect for the entire
script. Since this command is global in nature, it should appear before the first page. These RSS channels can then be used by subsequent text and/or ticker commands in the script.
To display information from the RSS channel, the text and ticker commands use the rss option to specify the name of the RSS channel and RSS text variable names for the type options. RSS text variables have names that begin with the term Rss, such as RssChannelTitle.
Notice that the length option is used on the text and ticker commands to limit the maximum length of text that will be presented. This is important because RSS channel items may otherwise exceed the space available on the page.
RSS channels typically have multiple items that are displayed in a circular, round-robin manner. Lightwing automatically tracks the last displayed item for each channel and steps the RssItem variables to display the next item from the circular queue for that channel. This RSS stepping occurs whenever a page expires that uses an RSS channel or when a ticker loops that uses an RSS channel. Also refer to the online Scripting Guide for more details about these commands.
// Scripting Tutorial - RSS Channels version: 1.0 rss: NYTimes thumbnails: on scale: 2 update: 1:00:00 limit: 100 url: http://www.nytimes.com/services/xml/rss/nyt/US.xml page: TickerAP time: 1, 15:00 image: PlanetMercuryBackground.pvr text: OpenSansBold_40 position: 5, 25 type: "Title:" text: OpenSansRegular_40 position: 20, 25 rss: NYTimes length: 70 type: RssChannelTitle text: OpenSansBold_40 position: 5, 30 type: "Description:" text: OpenSansRegular_40 position: 20, 30 rss: NYTimes length: 70 type: RssChannelDescription text: OpenSansBold_40 position: 5, 35 type: "Link:" text: OpenSansRegular_40 position: 20, 35 rss: NYTimes length: 70 type: RssChannelLink text: OpenSansBold_40 position: 5, 40 type: "Copyright:" text: OpenSansRegular_40 position: 20, 40 rss: NYTimes length: 70 type: RssChannelCopyright text: OpenSansBold_40 position: 5, 45 type: "Items:" text: OpenSansRegular_40 position: 20, 45 rss: NYTimes length: 70 type: RssChannelItems text: OpenSansRegular_50 position: 50, 60 rss: NYTimes length: 70 type: RssItemTitle align: TopCenter text: OpenSansRegular_30 position: 50, 85 rss: NYTimes length: 100 type: RssItemLink align: TopCenter ticker: OpenSansRegular_50 position: 0, 72 rss: NYTimes length: 1000 type: RssItemDescription rate: 12 loop: on box: Thumbnail position: 87, 22 rss: NYTimes align: CenterCenter jump: TickerAP