containers you can stand on

Hi there Tads forum, I’m new here.

This question is going to expose how little I understand Tads coding. I’m learning.

I’d like to create a container that you can put things in, and also stand on. A good example would be a sea trunk. You can open it, put things in it, push it from room to room, but also sit or stand on it.

I’ve made the container. I can open it, close it, push it around… but I’m getting stick on the stand on part. I tried classing it as a “Chair” which seemed to work, but then the game forced me to climb into it instead of standing on it. (???) Something about nested complex containers?

Anyway if someone can help me out here I’d really appreciate it. Stuck. Not my last question either I’m sure, but I’m really impressed with Tads so far and hope to keep working on this.

My T3 (adv3 library) is a little rusty, but if you want to look at some source code, try this page on my website: You’ll find a download of the source code to “Mrs. Pepper’s Nasty Secret.” Near the beginning of the game is a container (a trash can) whose lid you can stand on. I don’t remember by now the details of how it was coded, but hopefully that will give you some ideas.

Found it, thanks. I’ll take a more thorough later. On first glance… that’s a lot of code for one object!

Oh I get it.

Let me think out loud:

The system isn’t distinguishing between putting objects on the container, or IN the container, so when I try to stand on a container it assumes I want to go inside.
Hence the “sub-platform” approach.

Here I thought this was simple. Okay. I can work with that.

You are right. The way in which containment is modeled in TADS is rooted much deeper in the library than is apparent on first sight. The Thing class has a contents property which is a list of other objects that are contained in any Thing derived object. So when you want to place a letter in a mailbox, you insert letter object into contents list of the mailbox object. When you are writing code this is greatly simplified by using + symbol syntax to put objects into other objects located in another objects, but in reality it is putted together by contents properties and children links back to their parent with location property (once the programs runs in computer memory). TADS uses this approach not only to model game objects hierarchy such as letter in mailbox, but also lot of other more abstract hierarchies, such as menu entries in menus, conversation topics in conversation nodes in an actor and so on, basically everything you group in TADS program using plus marks and that’s almost everything you write in TADS.

In this sense the containment model is really universal in ADV3 library design. But there is also one consequence - one object have only one list of contained objects so it could model only one kind of (physical) containment in a game. It can’t distinguish whatever one of contained objects is on and other is in, its one and only one list of contained objects. So when an author wants an object in the game which have more than one type of physical containment at once, such as box that player can put things both in and also stand on, program must fake this containment by using two or more different objects each representing single type of physical containment. And complexContainer class is kind of proxy dispatching player interaction to the proper subcontainer/subplatform etc.

Got it!

The initial example was really helpful, but not quite what I needed for my own object; I built the ComplexContainer as a platform and added the subContainer to it, to hold things. This all seems to be working like it should, though I’m sure it could stand some polishing and tweaking.

Thanks for the help.