> > |
%META:TOPICINFO{author="ElminI" date="1099702066" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="MakingZippyObjects"}%
This document gives a breif overview of the preferred method of managing character inventories using the Zippy scripting system.
There are four alerts related to inventory management and picking up/dropping objects:
- attempted_pickup
- attempted_drop
- attempted_putaway
- attempted_takeout
These are described more fully in ZippyAlerts.
There will be four action classes corresponding to the four alerts above:
- Pickup
- Drop
- PutAway
- TakeOut
Each action has a single effect, valid on the range [0, 100], whose name can be obtained by appending "Effect" to any of the names above.
Characters have the following four methods for use in applying the results of the four actions above:
- attach()
- detach() Note: called by the item, not the holding character
- put_away()
- take_out()
Check out ZippyCharacters for the details about these interfaces.
For a character to pick up/drop/put away/take out an item, the following things have to happen:
- The character must set LATCH_ALTLEFT/LATCH_ALTRIGHT (for pickup/drop) or LATCH_PACKLEFT/LATCH_PACKRIGHT (for inventory). This can happen from a script using the
Character:set_latch() function (see ZippyCharacters) or when the player presses one of those buttons. See ZippyLatches for details.
- The character must handle the appropriate attempted_* alert.
- The character must initiate the appropriate action on the item.
- The character must define an appropriate polling method to return a result of 100 for the appropriate effect (if it is able to perform the action).
- The item must pass this result along (if it should be acted on in this way).
- The character (or item, with
Character:detach()) should apply the results with one of the four functions above.
Attempting to do these operations any other way will mess things up. You have been warned.
-- ElminI - 06 Nov 2004 |