Object Kinds - Solutions without Brady Garvin's extension?

I am currently working on a clothing and body system, and it seems the best means for me to abstract the code so it can be more generally usable (primarily not having to know what body parts have been designed beforehand) would be to make use of a reference to what kinds of body parts exist and repeating through them. However, looking through the forums the closest answer I’ve found would be to use Brady Garvin’s Object Kinds which doesn’t seem to work with Inform 10.1.2 (and I definitely don’t understand the code enough to either fix it or try picking out just what I might need).

As for specifics I currently have code which updates whether a piece of clothing covers the body part of a person when it is put on or taken off. Here is the adding coverage code, the removing coverage is just inverted:

To add coverage and overlay for (the clothing - a clothing) and (the wearer - a person):
	if any hair is covered by the clothing:
		let the hair be a random hair part of the wearer;
		repeat with underwear running through clothing that covers the hair:
			now the clothing overlays the underwear;
		now the clothing covers the hair;
	if any eyes is covered by the clothing:
		let the eyes be a random eyes part of the wearer;
		repeat with underwear running through clothing that covers the hair:
			now the clothing overlays the underwear;
		now the clothing covers the eyes;

This is achieved by having a body part of each type of stage that coverage is never removed from to then compare against these specific cases (I only have two for testing but in a full implementation one would have to repeat this code for each and every body part (which is why I would like to make it generalized)).

While this code doesn’t work, it illustrates what I would be attempting to do using Object Kinds or some other solution:

To add coverage and overlay for (the clothing - a clothing) and (the wearer - a person):
	repeat with bodypart running through body parts covered by the clothing:
		let body kind be the kind of the bodypart;
		let part to cover be a random body kind part of the person;
		repeat with underwear running through clothing that covers the part to cover:
			now the clothing overlays the underwear;
		now the clothing covers the part to cover.

So, while one would still need to create off-stage body parts to set what clothing covers what body part kinds, the code that updates coverage no longer needs repeated for each different kind of body part and can instead repeat through all of the covered kinds of body parts and update the coverage for the person putting on the clothing.

If anyone knows of an updated version of Object Kinds I could try and use, knows what specific code from it that still works that would be needed to achieve this affect or any other possible solution, I’d greatly appreciate it.

If you’d like to be a special pre-alpha tester of an undocumented version…
Object Kinds.i7x (3.4 KB)

1 Like

Definitely, I’ll see if this works for this problem (and possibly mess around with it a bit more). Would you want me to send any feedback anywhere in particular if I run into issues?

This new version of the extension worked perfectly for what I was hoping to achieve. For anyone interested here’s the version of the code I was able to get working using the extension (which defines “object kind”):

To add coverage and overlay for (the clothing - a clothing) and (the wearer - a person):
	repeat with bodypart running through body parts covered by the clothing:
		repeat with person part running through body parts part of the wearer:
			if the object kind of the bodypart is the object kind of the person part:
				repeat with underwear running through clothing that covers the person part:
					unless the underwear is the clothing:
						now the clothing overlays the underwear;
				now the clothing covers the person part.
1 Like

There is a convenience phrase by which you could say:

if the bodypart is the same kind as the person part
2 Likes