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 Input and Output 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.

HTML

Creates and outputs a HTML sequence.

Syntax

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.

Example

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

KEY

Reports the code of the last key that the user typed.

Syntax

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 Terrapin Logo, KEY used to report a numeric value. Logo reports the actual key.

See also READCHAR.

Example

KEY Result: ENTER

SETTEXTCOLOR

Sets the text color in the Listener panel.

Syntax

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.

Example

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

SETTEXTFONT

Sets the font for PRINT, TYPE, and other output commands.

Syntax

Description

SETTEXTFONT defines the font that all printing commands use. 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 a combination of the following values:

   
0 regular
1 bold
2 italic
3 bold italic

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.

Example

SETTEXTFONT “TIMES 14 1 PR “HELLO

TEXTFONT

Reports the font used for output.

Syntax

Description

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

Example

TEXTFONT Result: [CONSOLAS 12 0]

Creates and outputs a HTML web link.

Syntax

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 http:// at the beginning. This lets you use web links like www.terrapinlogo.com without the http:// 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.

Example

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