ZObject

From Wherigo Foundation Wiki
Revision as of 13:34, 22 April 2018 by Ranger Fox (Talk | contribs)

Jump to: navigation, search

An instance of ZObject object represents any of ZItem, ZCharacter, Zone, ZInput, ZTask, ZMedia or ZTimer. All ZObjects in the game are contained in ZCartridge.AllZObjects table.


Properties

Cartridge ZCartridge object represents cartridge.
Container

ZObject item (generally ZCharacter, ZItem or Zone) in which Inventory this ZObject is.

When ZObject is not in a container, Container property returns boolean value false.

Commands *

A table of user defined ZCommands on item. They are indexed by their name (string value).

Usage: ZItem.Commands["UseItem"].Enabled = false;

CommandsArray *

A table of user defined ZCommands on item. They are indexed by numbers (starting 1).

Usage: ZItem.CommandsArray[1].Enabled = false;

CurrentBearing Number Bearing of the object relative to the Player. Player's bearing will always be 0
CurrentDistance Distance Distance of the object relative to the Player. Player's distance will always be 0
Description String Description of item.
Gender String Gender of object. Only for ZCharacter.
Icon ZMedia Icon to display for this cartridge.
Id String Guid identifier of object. Only used by builder.
Inventory Table A table of ZObjects nested into this ZObject.
Media ZMedia Media to display for this Object.
Name String Name of this object to display.
ObjectLocation

ZonePoint

Returns location of object (useful for ZItems and ZCharacters). Returns boolean value false, if the location is not set.

Note: Zone.ObjectLocation returns always false! Use Zone.OriginalPoint (only for builder) property or Zone.Points collection.

ObjIndex Number

Index of ZObject in ZCartridge.AllZObjects table.

Player object is not contained in AllZObjects collection. Player.ObjIndex returns always -21555.

Type String Type of object. Only for ZCharacter.
Visible Boolean Applies for ZItem, ZCharacter, Zone. Determines if ZObject is visible.

* This property applies only for ZItem, ZCharacter and Zone.


Methods

MoveTo(ZObject self, ZObject obj) Moves the object self to Inventory of obj and set Container of self to obj. Could be also nil, which means, that the object is removed from all lists.
InsideOf(ZObject self, ZObject obj) Returns boolean Checks if object obj contains object self.
Contains(ZObject self, ZObject obj) Returns boolean Checks if object obj is in Inventory of object self.
isa(ZObject self, ZObject obj) Returns boolean

Checks if self is a object of class of obj.

Usage: b=itemVar:isa(ZItem), returns true, if itemVar is a ZItem.

made(ZObject self, ZObject obj) Returns boolean

Checks, if ZObject obj is of class self.

Usage: b=ZItem:made(itemVar), returns true, if itemVar is a ZItem.

rawget(ZObject self, luatype index) Returns luatype Get the content of table with given index without raising any event for the engine.
rawset(ZObject self, luatype index, luatype value) Set the content of table with given index to value without raising any event for the engine.


Constructor

ZObject Wherigo.ZObject(ZCartridge cartridge) Returns a new instance of object ZObject. The only parameter is a instance of ZCartridge.
ZObject Wherigo.ZObject({parameters}) Parameter is a table with default entries. It is possible to set the following properties: Cartridge, Container, Description, Icon, Inventory, Media, Name, ObjectLocation, Visible.