ZScript
From ZCWiki
| | 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.
Contents |
[edit] Language Guide
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.
[edit] Basic Hierarchy
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.
[edit] General Constructs
[edit] Declarations
You use declarations to create scripts, functions, and variables in ZScript.
[edit] Operators
Use operators to alter or compare variables and values.
[edit] Assignment Operators
The assignment operator and its variants assign a value to a variable.
- Assignment =
- Additive Assignment +=
- Subtractive Assignment -=
- Divisive Assignment /=
- Multiplicative Assignment *=
[edit] Mathematical Operators
Use mathematical operators to mathematically manipulate variables and numbers.
- Addition +
- Increment ++
- Subtraction -
- Decrement --
- Multiplication *
- Division /
- Modulus %
[edit] Relational Operators
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 <=
[edit] Logical Operators
Use logical operators for boolean (true or false) operations.
- Logical AND &&
- Logical OR ||
[edit] Bitwise Operators
Use bitwise operators to set or clear bits in integer values.
- Bitwise AND &
- Bitwise OR |
- Bitwise NOT ~
- Left shift <<
- Right shift >>
[edit] Control Statements
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.
[edit] 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 request them through the use of a special function.
- 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
[edit] Miscellaneous
[edit] Compiling and Assigning Scripts
ZScript files must be compiled before they can be used by ZQuest and Zelda Classic. See compiling scripts and assigning scripts for details.
