Link (ZScript)

From ZCWiki
Jump to: navigation, search

This page describes the ZScript object Link along with its properties and methods. For information on the character Link, see Link.

The Link object allows quest designers to control and inspect various aspects of the Link character in Zelda Classic.

Syntax

The Link object (or a pointer to it, more specifically) is automatically made available to ZScript scripts; you do not need to declare a Link variable or instantiate it in any way.

The syntax for accessing the methods and properties associated with Link is as follows:

Link->method-or-property;

where method-or-property is one of the methods or properties listed below. As with any expression, you can use Link methods or properties as the evaluation criteria in control loops, if statements, and so forth.


A few examples:


Link->Drunk;
Link->Warp(5, 25);
if(Link->Drunk) 
{
 //Code
}

Methods and Properties

Methods

Warp

The Warp method warps link to the given screen in the given DMap, at the position of the blue 'warp return' square.

Introduced in Version
2.50 (beta)
Prototype and Arguments
void Warp(int dmap, int screen)
  • int dmap: The number of the DMap to which Link should warp.
  • int screen: The screen in the specified DMap to which Link should warp.

It should be noted that the screen to warp to can be inputted as a hexidecimal coordinate - as ZQuest identifies its screens - or, it can be inputted as a decimal number. If inputted as a decimal number, screens are counted from 0 to 15 across the top row, 16 to 31 across the second row etc. This is the same for Link->PitWarp.


PitWarp

The PitWarp method warps link to the given screen in the given dmap, at his current coordinates on the screen.

Introduced in Version
2.50 (beta)
Prototype and Arguments
void PitWarp(int dmap, int screen)
  • int dmap: The number of the DMap to which Link should warp.
  • int screen: The screen in the specified DMap to which Link should warp.

Properties

int Action

Link's current action. Use the LA_ constants in std.zh to set or compare this value.

bool CollDetection

If true, Link's collision detection with npcs and eweapons is currently turned off. This variable works on a different system to clocks, so it will not necessarily return true if Link has a clock.

int Dir

The direction Link is facing. Use the DIR_ constants in std.zh to set or compare this variable. Note: even though Link can move diagonally if the quest allows it, his sprite doesn't ever use any of the diagonal directions, which are intended for enemies only.

The effects of writing to this variable are denoted as undefined, however writing to Link->Dir will actually function as required. Joe123 00:02, 7 June 2008 (PDT)

int Drunk

The time in frames that Link will be drunk, meaning that the controls will be randomly interfered with, causing Link to move erratically. This value is decremented once per frame. As the value approaches 0, the intensity decreases.

int HP

Link's current hitpoints, in 16ths of a heart, such that one heart is 16, two hearts is 32, and so on.

int HeldItem

The item that Link is currently holding up; reading or setting this field is undefined if Link's action is not current a hold action. Use the IT_ constants in std.zh to specify the item, or -1 to show no item. Setting HeldItem to values other than -1 or a valid item ID is undefined.

bool InputA

True if the player is pressing the A key. Writing to this variable simulates the press or release of the A key.

bool InputAxisDown

True if the player is pressing down on the right analog. Writing to this variable simulates the press or release of down on the right analog.

bool InputAxisLeft

True if the player is pressing left on the right analog. Writing to this variable simulates the press or release of left on the right analog.

bool InputAxisRight

True if the player is pressing right on the right analog. Writing to this variable simulates the press or release of right on the right analog.

bool InputAxisUp

True if the player is pressing up on the right analog. Writing to this variable simulates the press or release of up on the right analog.

bool InputB

True if the player is pressing the B key. Writing to this variable simulates the press or release of the B key.

bool InputDown

True if the player is pressing the down arrow. Writing to this variable simulates the press or release of the down arrow.

bool InputEx1

True if the player is pressing the Ex1 key. Writing to this variable simulates the press or release of the Ex1 key.

bool InputEx2

True if the player is pressing the Ex1 key. Writing to this variable simulates the press or release of the Ex2 key.

bool InputEx3

True if the player is pressing the Ex1 key. Writing to this variable simulates the press or release of the Ex3 key.

bool InputEx4

True if the player is pressing the Ex1 key. Writing to this variable simulates the press or release of the Ex4 key.

bool InputL

True if the player is pressing the L key. Writing to this variable simulates the press or release of the L key.

bool InputLeft

True if the player is pressing the left arrow. Writing to this variable simulates the press or release of the left arrow.

int InputMouseB

Whether the left or right mouse buttons are pressed, as two flags OR'd (|) together; use the MB_constants or the Input*Click functions in std.zh to check the button state. InputMouseB is read only; Attempting to write to this variable does nothing. Note: std.zh has InputMouse* functions for those not comfortable with binary.

int InputMouseX

The mouse's in-game X position. This value is read-only, and undefined if the mouse pointer is outside the Zelda Classic window.

int InputMouseY

The mouse's in-game Y position. This value is read-only, and undefined if the mouse pointer is outside the Zelda Classic window.

int InputMouseZ

The current state of the mouse's scroll wheel: negative for scrolling down and positive for scrolling up.

bool InputR

True if the player is pressing the R key. Writing to this variable simulates the press or release of the R key.

bool InputRight

True if the player is pressing the right arrow. Writing to this variable simulates the press or release of the right arrow.

bool InputStart

True if the player is pressing the start button. Writing to this variable simulates the press or release of the start button.

bool InputUp

True if the player is pressing the up arrow. Writing to this variable simulates the press or release of the up arrow.

int ItemJinx

The time, in frames, until Link regains use of his items. -1 signfies a permanent loss of his items.

bool Item[]

True if Link's inventory contains the item whose ID is the index of the array access. Use the IT_ constants in std.zh as an index into this array.

bool Invisible

Set this to true to remove Link's sprite from the screen.

int Jump

Link's upward velocity. It uses the same units as an FFC's Vx and Vy variables. However, the quest's Gravity constant acts as downward acceleration on Link at all times if the 'Sideview Gravity' screen flag is checked, or if Link->Z > 0.

int MP

Link's current amount of magic, in 32nds of a magic block.

int MaxHP

Link's maximum hitpoints, in 16ths of a heart.

int MaxMP

Link's maximum amount of magic, in 32nds of a magic block.

int SwordJinx

The time, in frames, until Link regains use of his sword. -1 signfies a permanent loss of the sword.

int X

Link's X position on the screen, in pixels.

int Y

Link's Y position on the screen, in pixels.

int Z

Link's Z position on the screen, in pixels.