Hyperlink

From Wiki of ZZT
Jump to navigation Jump to search

A hyperlink is a button that the player can press in a text window. Pressing a hyperlink can lead to another label in an object's code or to an external file. In-game, a hyperlink appears as a line of text in a text window beginning with a purple triangle, and can be selected by the player pressing Enter. Hyperlinks are very useful for giving the player the ability to make choices.

The syntax for hyperlinks in ZZT-OOP is as follows:

!label;text
!object:label;text
!-filename;text

Note that for a hyperlink to work, the exclamation point ! must be the first character of the line (with exceptions listed below). Also, hyperlinks only work in text windows, and not with the single-line messages that appear on the bottom of the screen.

In addition to referencing labels within an object's own code, hyperlinks can also send messages to other objects on the board.

External Files

Per the syntax above, hyperlinks can be used to display external files in standard scroll windows. Files can have arbitrary three-letter extensions, but if one is not provided then ZZT defaults to searching for a .HLP file.

External help files are limited 1024 lines each. As with normal ZZT textboxes, lines can only be 43 characters long before text begins to overflow off the right-hand side causing graphical abnormalities. Also, tabs do not work as tabs, so all spacing must be done manually.

Besides presenting text via the in-game text windows, they can also be used to present menu options to the user. For this to work the object and label names in the text file must both use capital letters (eg. !OBJECT:LABEL;text).

Conditional Hyperlinks

Hyperlinks can be used with any ZZT-OOP command that accepts another command as an argument, and will only appear if a command in their place would have been executed. Thus, the following code is valid ZZT-OOP:

#if contact then !fooA;Test A
#take gems 1000 !fooB;Test B
#try n !fooC;Test C

Assuming this object was in contact with the player and blocked to the north, but the player had more than 1000 gems, then the text window would display the following choices:

▶Test A
▶Test C