Terrapin Resources

Listener Panel Commands

There are a few commands that are specific to the Listener panel.

Please note that commands that read from or write to the Listener panel are described in the I/O section, because they are also used to read from and write to files.

Common commands that output to the Listener panel are PRINT, TYPE, and SHOW.

Common commands that read from the Listener panel are READ, READLIST, and READQUOTE.


CLEARTEXT

Also: CT

Clears the Listener panel; no inputs.

Syntax

CLEARTEXT

Description

CLEARTEXT clears all text and places the cursor in the upper left corner of the Listener panel. CLEARTEXT is the same as the command TYPE CHAR 12.

Examples

REPEAT 5 [PR [GOOD EVENING]] CLEARTEXT


HTML

Creates and outputs a HTML sequence; two inputs.

Syntax

HTML tagname text

Description

HTML wraps the text into the HTML tag that is its first input; then, it wraps the resulting text into two HTML escape characters (see TYPE), and outputs the result. The result can be used as input to all commands that print, like PRINT, ALERT, or READPROMPT.

HTML is a shortcut for (WORD CHAR 8 "< :tagname "> :text "|</| :tagname "> CHAR 8).

Note: Logo itself is a web page; therefore, it interacts with all HTML that you print; if you are careless, you may distort the entire Logo page.

See also WEBLINK.

Examples

PRINT HTML “B “|Visit us!| Visit us!


KEY

Reports the code of the last key that the user typed; no inputs.

Syntax

KEY

Description

KEY reports the key code of the last key that the user typed. If you call KEY multiple times, the reported value is the empty word. Thus, you can call KEY only once for each key that the user typed.

KEY reports special key codes as a word, like TAB, F1, or ENTER.

Note: In early versions of Terrapin Logo, KEY used to report a numeric value. Logo reports the actual key.

See also READCHAR.

Examples

KEY Result: ENTER


SETTEXTCOLOR

Also: SETTC

Sets the text color for Listener output; expects between one input and two inputs, but parentheses are needed if not called with two inputs.

Syntax

SETTEXTCOLOR foreground background
(SETTEXTCOLOR foreground)

Description

SETTEXTCOLOR sets the foreground and background colors, which subsequent print commands will use. SETTEXTCOLOR takes a color name: one of 138 standard Web color names (see COLORS) or a list of up to four values, one each for Red, Green, and Blue, plus an optional alpha value. The color values may vary from 0 to 255, and the alpha value is between 0 and 1.

Use TEXTCOLOR to retrieve the current text colors.

Examples

(SETTEXTCOLOR “RED) PR [THIS IS IN RED] (SETTEXTCOLOR “BLACK)


SETTEXTFONT

Sets the Listener font; expects between zero inputs and three inputs, but parentheses are needed if not called with three inputs.

Syntax

SETTEXTFONT name size attributes
(SETTEXTFONT name size)
(SETTEXTFONT name)
(SETTEXTFONT)
(SETTEXTFONT [name size attributes])
(SETTEXTFONT [name size])
(SETTEXTFONT [name])
(SETTEXTFONT [])

Description

SETTEXTFONT defines the font that the Listener uses. The first input is the font name. This font should be present in the system. If the font is not present, the operating system selects a similar font for you. The second input is the font size, given in points, while the third is one of the following values:

Value Effect Value Effect
0 regular 4 underlined
1 bold 5 bold underlined
2 italics 6 italics underlined
3 bold italics 7 bold italics underlined

SETTEXTFONT can also be called with fewer than three inputs; in that case, the size is set to 10 points, and the attributes are set to 0. Calling SETTEXTFONT with no inputs causes the font to be reset to the default font. Also, calling SETTEXTFONT with a list of zero to three elements is possible to match the output of TEXTFONT with the input to SETTEXTFONT. See also TEXTFONT and FONTS.

Examples

SETTEXTFONT “TIMES 14 1 PR “HELLO


TEXTCOLOR

Reports the text foreground and background colors; no inputs.

Syntax

TEXTCOLOR

Description

TEXTCOLORS reports the foreground and background colors that the Listener uses when printing text as a two-element list, each element being a four-element list of RGBA color values. See also SETTEXTCOLOR.

Examples

TEXTCOLOR Result: [[0 0 0 1] [255 255 255 1]]


TEXTFONT

Reports the font used for output; no inputs.

Syntax

TEXTFONT

Description

TEXTFONT reports the font that output commands use as a three-element list. See also SETTEXTFONT.

Examples

TEXTFONT Result: [CONSOLAS 12 0]


Creates and outputs a HTML web link; expects between one input and two inputs, but parentheses are needed if not called with one input.

Syntax

WEBLINK link
(WEBLINK link text)

Description

WEBLINK creates a clickable HTML link of its first input. If the second input is present, it uses the text of the second input as a clickable text; otherwise, it uses the link itself as clickable text. The resulting text is the output of WEBLINK; it can be used as input to all commands that print, like PRINT, ALERT, or READPROMPT.

WEBLINK is a shortcut for (WORD CHAR 8 "|<a href="| :link "| target="_blank">| :text "|</a>| CHAR 8).

If the first input does not start with letters and a colon (like e.g. ftp: or http:), Logo inserts the text “https://” at the beginning. This lets you use web links like www.terrapinlogo.com without the “https://” prefix; Logo adds it for you.

Note: Logo itself is a web page; therefore, it interacts with all HTML that you print; if you are careless, you may distort the entire Logo page.

See also HTML.

Examples

PRINT (WEBLINK “www.example.com “|Visit us!|) Visit us!