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.

If a file extension is not provided for the filename, then the extension defaults to .HLP.

In addition to referencing labels within an object's own code, hyperlinks can also send messages to other objects on the board. Be aware however that for hyperlinks in external files that the object/label names must be in all caps (eg. !OBJECT:LABEL;text) in order for objects on the board to receive the message.

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