ZCartridge

From Wherigo Foundation Wiki
Jump to: navigation, search

An instance of the ZCartridge object represents a cartridge. There is only one instance of ZCartridge, and it represents the current cartridge. The .lua file should return the single Cartridge instance as its final statement.

Properties are used for development with the Wherigo Builder, for in game information and for updating the website.

ZCartridge has all Properties, events and functions, which ZObject has.

Properties

Activity String The activity type this cartridge implements. Available options in Builder include "TourGuide", "Puzzle", "Fiction", and "Geocache". It is displayed to the user in the cartridge selection screen of the Player.
AllZObjects Table Containing a reference to every ZObject (except variables). Includes zones, characters, items, tasks, timers, inputs, media, and the cartridge itself (always ObjIndex = 0). Use tostring(tableentryvalue) to determine what type of ZObject you have. For example, the result for a ZCharacter is "a ZCharacter instance".
Author String Name of the individual responsible for development of the cartridge.
BuilderVersion String Build version of the Builder application the cartridge was developed under.
Company String Name of company responsible for development of the cartridge.
Complete Boolean Read/write. Whether the cartridge has been completed.
CountryId String Presumably indicates the country a cartridge is developed for. Builder initializes to "2" for a cartridge built in the United States. It's possibly linked to Groundspeak's geocaching country codes.
CreateDate String Date time stamp of when the cartridge was first created.
Description String Natural language description of the cartridge.
EmptyInventoryListText String Is displayed, if the inventory list has no entry.
EmptyTasksListText String Is displayed, if the tasks list has no entry.
EmptyYouSeeListText String Is displayed, if the you see list has no entry.
EmptyZonesListText String Is displayed, if the zones list has no entry.
Icon ZMedia Icon to display for this cartridge.
Id String Unique hex identification string for the cartridge. Automatically generated by Builder.
LastPlayedDate String Presumably date time stamp of when the cartridge was last played. Set to minimum value by Builder (as cartridge has not been played while in Builder).
Media ZMedia Media file to associate with the cartridge.
MsgBoxCBFuncs Table Callback function pointers used by Builder to route events to appropriate objects.
Name String Natural language name of the cartridge.
PublishDate String Date time stamp of when the cartridge was published to Wherigo.com. Set to minimum value by Builder.
StartingLocation ZonePoint The location the user should be in to begin the Wherigo cartridge. For locationless or "Play Anywhere" cartridges, this value should be set to Wherigo.INVALID_ZONEPOINT. Groundspeak's Builder does not support locationless cartridges as of the 3/27/2008 build.
StartingLocationDescription String Natural language description of the starting location for the cartridge.
StateId String Purpose unknown; Builder initializes to "1". Possibly linked to Groundspeak's geocaching regional codes.
TargetDevice String Device the cartridge was built for. Valid values include at least "PocketPC" or "Colorado". There could although be more different entries.
TargetDeviceVersion String Purpose unknown; may serve to restrict cartridges to particular revisions of Player software in the future as features are added or modified. Builder initializes this to "0".
UpdateDate String Date time stamp of when the cartridge was last updated by Builder.
UseLogging Boolean Whether the Player should log actions to a log file.
Version String The release version of the cartridge. Builder initially sets this to "1.0".
Visible Boolean Whether the cartridge is visible. Not sure of the effect of this value; Builder sets to true.
ZVariables Table Association of user-defined variables created in Builder, linking variable name to initial values. All variables, which are in this table will be saved, if the game is saved. It is enough to make ZVariables[<variable name>] = true to save the variable with name <variable name>.

Events

OnEnd Fires when cartridge play is ended.
OnRestore Fires when cartridge play resumes from a previous save.
OnSetComplete Fires when cartridge is marked as complete.
OnStart Fires when cartridge begins playing.
OnSync Fires when cartridge is saved.

Methods

GetAllOfType(ZCartridge self, string type) Returns table. Table of all ZObjects of the given type.
RequestSync(ZCartridge self) Saves cartridge state for later resumption.

Constructor

ZCartridge Wherigo.ZCartridge({parameters}) Parameter could be a table with default entries. It is possible to set the following properties: Activity, Author, BuilderVersion, Company, EmptyInventoryListText, EmptyTaskListText, EmptyYouSeeListText, EmptyZonesListText, StartingLocation, StartingLocationDescription, UseLogging, Version. Additionally all parameters, which are valid for ZObject constructor.