Re: Inform: How to make TINY container?


20 Aug 1995 06:50:03 GMT

>> I have a problem. I want to make a little medicine canister that
>>will hold tiny things, i.e. a dime, a bunch of pills, a peanut.. but
>>NOT things like a portable radio, a shirt, etc. How can I manage
>>this effect?
>
>How about this:
>
> #ATTRIBUTE tiny;

}I was thinking about that, but I have so many attributes and
}properties
}already! OH well... *grin*

The "attribute tiny" approach works all right when there are only a few
objects and one or two possible containers. With larger numbers of
things, it becomes unworkable. A better approach in that case is to
assign two new properties, "size" and "volume" (or something like that,
since "capacity" is already taken, if I remember correctly). Assign
each object a size and each container a volume. Then write a routine to
check the container to see whether there is enough room left in it to
contain whatever object the player is trying to put there, and call it
whenever he/she tries to.

This doesn't answer your objection about not having enough properties
and such left to work with, but, in my experience, if you're running
out of these things, you're probably not coding things as efficiently
as you could be (are you making good use of the "general" attribute,
for instance?). Either that, or you have one hell of a big game going
there.

}P.S.: Is there any limit to the amount of attributes and properties in
}a game?

Yep. Compile with the -s switch to see what they are. Some limits can
be raised, too. Run "inform $list" to see which ones they are and how
to do it (unfortunately, attributes and, I believe, properties, are not
among them).

Jim Newland
76461.2144@compuserve.com