Text Capture

From IFWiki
Jump to: navigation, search

Text Capture by Eric Eve is an Inform 7 library extension. It allows the capture of text that would otherwise be output to the screen, so that the text can be further manipulated, displayed at some other point, or simply discarded.

Requirements and Restrictions

Required By

Notable Features

This extension defines four new phrases:

start capturing text
stop capturing text
say captured text
if text capturing is active

Text that would otherwise be output to the screen is instead captured if it is generated between the first of these phrases and the second. The captured text can subsequently be displayed (or copied to an indexed text variable) using the third of these phrases.

A situation where this might typically useful is where we want not only to suppress the standard report from an action (with 'silently') but any failure reports as well.

Sample Code

    To take (obj - a thing) implicitly:
     start capturing text;
     silently try taking the obj;
     stop capturing text;
     say "(first [if the obj is carried]taking[otherwise]trying to take[end if] [the obj])[command clarification break]";
     if the obj is not carried, say captured text. 

Versions

Links