User Tools

Site Tools


print

This is an old revision of the document!


<<print>>

The «print» macro lets you print expressions, pure and simple.

Usage

<<print expression>>

The expression's value is calculated and printed into the passage. If an error occurred while calculating, an error message will be printed instead.

Shorthand form

You may find yourself frequently using «print» to simply print a variable, without alteration. «print» has a convenient shorthand form for this single case: you simply omit the word “print”, leaving just the variable within the angle brackets. For instance, «print $beers» can become simply «$beers».

This allows you to write Twine stories in a “template” style:

Your superior officer approaches. "<<$name>>, you've done a fine job. No, a
superlative job. <<$species>> like you have no place on this cruel Earth,
that rewards only greed and selfishness."

Note: you can only perform this shorthand form using variables! You cannot, for instance, write «visited()».

print.1387174440.txt.gz · Last modified: 2017/10/09 20:37 (external edit)