|The information below describes features introduced in Zelda Classic version 2.50.|
ZScript is a programming language that can be used to create scripts for use with Zelda Classic. ZScript (and ZASM, the other supported scripting language) enables quest designers to interact with and control certain aspects of the Zelda Classic game engine during run-time (when the player is playing a quest). For example, through the use of scripting, quest designers have created custom items, weapons and enemies, devised new puzzles, and so forth.
ZScript and ZASM were introduced in beta versions of Zelda Classic 2.5.
- 1 Language Guide
- 1.1 Basic Hierarchy
- 1.2 General Constructs
- 2 Compiling and Assigning Scripts
This page presents an overview of the ZScript scripting language, with links to the more important features. If you are completely new to scripting, you may wish to view ZScript Concepts first. You may also browse all the ZScript articles.
The basic hierarchy for ZScript - that is, the "layout" of the various ZScript items that would make up a typical script - is shown below. The script is the top-level construct in a ZScript script, though compiler directives and global variable declarations typically precede the first script declaration. You may create multiple scripts. Each script may include 1 or more functions, and each script must include the run() function. Functions typically include some variable declarations of their own, as well as the statements that actually do something when the function is called.
You use declarations to create scripts, functions, and variables in ZScript.
Use operators to alter or compare variables and values.
The assignment operator and its variants assign a value to a variable.
- Assignment =
- Additive Assignment +=
- Subtractive Assignment -=
- Divisive Assignment /=
- Multiplicative Assignment *=
- In addition to the operator assignments listed above, the following also work as one might expect and are accepted by the compiler: %=, &&=, &=, ||=, |=, ^^=, ^=
Use mathematical operators to mathematically manipulate variables and numbers.
Use relational operators to compare variables and numbers.
- Is equal to ==
- Is not equal to !=
- Is greater than >
- Is greater than or equal to >=
- Is less than <
- Is less than or equal to <=
Use logical operators for boolean (true or false) operations.
Use bitwise operators to set or clear bits in integer values.
Control statements are used to instruct Zelda Classic to execute only certain portions of a script, or to execute a portion of a script a certain number of times.
Built-in Objects, Methods, and Properties
Of the following objects, Link, Screen, and Game are automatically made available for your use. The remaining objects and their methods and properties are only made available to you when you create a pointer to one of those objects.
- Link object, methods, and properties
- Screen object, methods, and properties
- Game object, methods and properties
- Freeform Combo (FFC) methods and properties
- Non-playing Character (NPC) methods and properties
- Item methods and properties
- Weapon (lweapon and eweapon) methods and properties
- Built-in Functions