Function: Textfln
Function: Textfln

Function: Textfln

Textfln ( MESSAGE )

Adds a TEXTF cue to the response, which contains text to output, as well as some formatting tags to affect output, with a newline appended to end of the message.

Parameters

Parameter Type Description
MESSAGE VALUE(STRING) The formatted message to output.

Returns

Returns nothing. Cannot be used in expressions.

What It Does

Prints a message to the screen, which includes special formatting, affecting the resultant message, plus a newline added to the end of it.

Specifically, this adds a TEXTF cue to the response with the provided message as the content. Processing a TEXT and TEXTF cue is meant to print something to the screen in all TAME Shells. The input parameter is transformed to a string, no matter what value type it originally is.

This is a convenience function, and is functionally equivalent to:


	addCue("textf", message + "\n");

It is up to the TAME shell to determine how to render the text. Authors should not use the text functions to meticulously lay out text, for example: adding whitespace in order to get text to appear in a specific location on the screen. If a TAME shells has a method for doing this sort of thing, that should be employed rather than relying on the behavior of a specific medium. Authors should also be aware about shells that employ use of different fonts or other textual effects.

All TAME shells accumulate TEXT and TEXTF cue output as through it were printed in one block. Other cues like WAIT and PAUSE do not interrupt this behavior, unless the handling of a cue requires output to the same place that text will also be output to, but for the most part, you can rely on behavior like newlines terminating a paragraph or line.

Formatting Tags

All formatted text use HTML-like bracket tags to wrap text that needs to be displayed in a special manner. How text is rendered is up to the Shell doing the parsing and rendering.

An example of formatted text would be:

	"This message contains [bold]text that is bolded![/]"

...which a supporting shell might render as:

	This message contains text that is bolded!

Tags can be stacked like this to combine effects:

	"This message has [italic]italicized text[/], some [bold]text that is bolded[/], and [bold]some can have [italic]both![/][/]"

...which might render as:

	This message has italicized text, some text that is bolded, and some can have both!

Ending tags are written like [/] and will automatically terminate the most recent tag.

Each custom shell intended to be used by other authors or users should specify how different formatted text will be rendered. Formatting tags that are not understood by a shell should just have its content displayed. Using the previous example, the formatted text in a shell that does not understand both bold and italic would render as:

	This message has italicized text, some text that is bolded, and some can have both!

Tags are recommended to be parsed case-insensitively, but some shells may allow mixed or parameterized tags like [color=red], so it's recommended to handle the main part insensitively, but the parameters as-is ("color" would be case-insensitive, "red" is up to the implementor).

If you need to print a [ character in a formatted message, just double it up in the text:

	"This message has tags in it that look like this: [[bold]text[[/]"

...which renders as:

	This message has tags in it that look like this: [bold]text[/]

Example

NOTE: This page has special handling for the "red" and "green" format tags.

Textfln Example


world
{
	start()
	{
		textfln("Have some [red]red text[/]!");
		textfln("Have some [green]green text[/]!");
		textfln("Have some [unparsed]unformatted text[/]!");
		textfln("Have some [[escaped]escaped tags[[/]!");
		quit;
	}
}

See Also

AddCue() — Adds cues to the Response.

Additional Technical Notes

The base TAME shells strip out all tags, and just print text inside the tags. Authors that use this function should acquaint themselves with their target shell (should they target one), or a family of shell standards that use certain formatted tag sets.

Strings in TAME are Unicode, so most characters should output how the author intends, but that may also depend on locale, encoding, or the Shell used for displaying. The Java and Browser JS implementations contain ways to easily parse formatted text.

×

Modal Header