Creating an object with I6

This might be an advanced place to start, but I only learn by practical example, so here goes… how do you create an instance of an object? The example in the manual assumes use of I6 only and that the conditions for the creation event are very specific. I’m trying to figure out more generally how to do this, and I’m still planning on using I7 primarily, but using I6 for what is impossible in I7.

So far I have:

Include (-

The person object translates into I6 as "person". 

The testroom is a room.

The player is in the testroom.

Creating a person is an action applying to nothing.

Understand "Create" as creating a person.

Carry out creating a person:
To create-person:
	(- createPerson(); -);

But this reports the error that K8_person is not a constant. I had no idea the person kind was a “K8_person”, until this compilation error told me so, so it seems like something is hooked up partly right. Anyway, any help would be appreciated, as more than accomplishing this specific goal, this might help me understand how classes and kinds relate and how classes and constants relate. Clearly I don’t understand it yet.

I’m also aware that if the code above did work in some sense, it would be bad anyway, as it would just create a random person in nowhere (in other words, I’m aware it is incomplete, not just wrong). However, I’m just worried about one step at a time here, just trying to get past this latest reported error.

I don’t think “creating an object” means what you think it means. It essentially calls an existing object’s constructor again with new parameters. It doesn’t allocate new memory to create another instance of the class at run-time.

In the I6 manual there is a section “3.11 Creating and deleting objects during play” which describes foo.create() in a way that I thought indicates this (but not at runtime, but after the application is running).

No, it works similarly to the Dynamic Rooms extension. The memory is all allocated at compile-time, then the object is given to you when you call the create method on it.

Jesse McGrew’s Dynamic Objects extensions on the Inform 7 website do allocate more memory for more objects, and make those objects available to Inform 7 code. I’d start by studying his extensions.