if-resources
(by Peer Schaefer, peer@wolldingwacht.de)
recept.h: Clever containers for Inform
6.21
Alpha-testing one of my games I discovered that it was
possible to put a vacuum-cleaner into a purse. That told me two
things: (1) To be an alpha- oder beta-tester you have to be absolutely
nuts. (2) Containers should be aware of volume, size and weight.
I hacked something out and think it works satisfactory now.
It's now ready for beta-testing and has the following features:
- Objects can provide the following three new properties:
weight, volume, size
- Containers can provide the following three new
properties: capacity_weight, capacity_volume,
capacity_size
- If one dimension (weight, volume or size) of an object is
greater than the respective capacity of the container,
the object can't be stored in that container.
- Volume and weight of objects in a container are
automatically added up (you can override this; see
documentation).
- The weight of childrens (objects inside an object) is
automatically added to the weight of an object that is a
container.
- All six new properties can be a numerical value or a
routine that returns a numerical value. In this way you
can set a dimension/capacity to a constant, but you can
also create sophisticated mathematical routines (by this
you could e.g. create magical bags that weigh less than
their contents).
- Notice: weight and volume need no explanation. Size is
the maximum length in any direction. In example, a
walking-staff has a low volume and weight, but a great
length (= size). Vice-versa a quiver for arrows can hold
anly a small volume and weight, but can store many long
arrows.
Full documentation (with four examples) is included in the
file.
OK, OK, it's no masterwork. It's a relatively simple and small
library contribution. Some of you cool programmers out there
might even consider it to be trivial. But it's complex enough to
confuse a dull programmer like me, and large enough to contain
some bugs.
An here are the downloads:
- recept.h (the Inform621 header
file, ASCII-format)
- recept.hqx (the same, in
BinHexed ASCII)
Bug-reports, suggestions, corrections of my bad english (or
just congratulations) are welcome! Send to Peer Schaefer, peer@wolldingwacht.de.
Return to my home page
(in german)
Peer Schaefer's Interactive Fiction Resource Site / This
page: the recept.h library contribution beta-test / URL: www.wolldingwacht.de/if/recept.html
/ Last update: 6th July 2002