Assigning scripts (ZScript)

From ZCWiki
Revision as of 02:20, 22 February 2008 by ScaryBinary (talk | contribs) (Minor cleanup. Added See Also section.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

When you've successfully compiled a ZScript, you can make it available for use by other Zelda Classic objects and events. This is a two-step process. First, you must "register" your scripts with ZQuest by assigning them to "slots". You may then assign these scripts to items, freeform combos, or a few specific game events.

Assigning Scripts to Slots

The Assign Compiled Script window.

After a successful compile, the Assign Compiled Script window is displayed. Here you see three tabs, one for each of the script types: FFC, Global, and Item. You'll see that each tab has a list of Slots. Each Slot can hold one script. ZQuest knows how you've declared your scripts, and displays only the ones that are valid for the selected script type.

To assign a script to a slot, pick the slot in the left list, pick the script name in the list on the right, then click the "<<" button.

Once you have assigned your scripts to slots, you can then assign them to items, freeform combos, or a few specific game events.

Assigning Scripts to Objects and Events

ffc Scripts

Scripts associated with freeform combos are run when the freeform combo is drawn on the screen. To set up a freeform combo to use a script, select "Data > Freeform Combos" from the ZQuest menu. You can customize up to 32 FFCs on each screen. Select the FFC you want to assign the script to, and click the Edit button. On the Data tab, at the bottom, is where you assign a script to this FFC. A drop-down list contains a list of all the ffc scripts you assigned to slots (see Assigning Scripts to Slots above). When multiple FFCs are used, their scripts are executed sequentially in ascending order (i.e., the script for FFC 1 is executed first, followed by the script for FFC 2, and so on).

item Scripts

Item scripts allow you to perform various actions when Link first gets an item, and then when he uses that item.

To assign scripts to items, select "Quest > Items" in ZQuest. In the Select Item window, choose the item you want to assign scripts to. You can choose an existing one, or you can make a new item by scrolling to the bottom of the list and picking one of the Items starting with "z". Once you've selected an Item, click the "Edit" button. You'll see the Item Properties window.

In the Item Properties window, the two tabs of interest are the Pickup tab and the Action tab. Go to the Pickup tab. You'll see a "Script" property. Here, you enter the Slot number of the Item script you want to run when Link first gets this item. Similarly, in the Action tab you enter the Slot number of the Item script you want to run when Link uses the item (such as attacking with a sword or using a bomb).

global Scripts

While you can create and use any number of global scripts (see global script usage, for instance) ZQuest gives you the ability to assign two global scripts to specific game events. These two events are:

  1. Quest Active
  2. Quest Resume

Quest Active

Any global script you assign to global Slot 2 becomes the Quest Active script. This script is started only once each time a quest is played, but its execution can span several frames. You can also force it to run during the entire game (until Link dies or you quit) by using a deliberately infinite while loop. This technique allows you to create a script that constantly monitors the game for some event or keeps track of something over the entire course of the game.

Quest Resume

When you assign a global script to the global Slot 3, it becomes the Quest Resume script. This script is started whenever gameplay resumes in a quest, whether by loading a saved game, dying, or selecting "Quit" and then "Continue" from the Zelda Classic menu. Note that the script associated with this event is not executed if you quit by selecting "File > Reset" or "File > Exit" from the Zelda Classic menu.

See Also