Newbie question about length and width.

It seems to me that something can only have one property of a kind. Is this true? Is it intended? Or am I being wrongheaded?

Here’s my code:

    

	A length is a kind of value.
		1.0 inch long ( singular ) specifies a length.
		99999.9 inches long ( plural ) specifies a length.
		
		The void is a room.
		The player is in the void.
		
		A rectangle is a kind of thing.
			A rectangle has a length called lenny. [called length doesn't work hence lenny]
			A rectangle has a length called it's width.
		[	A rectangle has a length called it's wid.]
		
		The card is a rectangle in the void.
			The lenny of the card is 1.3 inches long.
			The width of the card is 1.2 inches long.

It gives:

Problem. You wrote ‘The width of the card is 1.2 inches long’ : but this seems to say that a thing is a value, like saying ‘the chair is 10’.

If I change this to

	A width is a kind of value.
		1.0 inch wide ( singular ) specifies a width.
		99999.9 inches wide ( plural ) specifies a width.

	A length is a kind of value.
		1.0 inch long ( singular ) specifies a length.
		99999.9 inches long ( plural ) specifies a length.
		
		The void is a room.
		The player is in the void.
		
		A rectangle is a kind of thing.
			A rectangle has a length.
			A rectangle has a width.
		[	A rectangle has a length called it's length.]
		[	A rectangle has a length called it's width.]
		
		The card is a rectangle in the void.
			The length of the card is 1.3 inches long.
			The width of the card is 1.2 inches wide.

It works, and I get: void
You can see a card here.

showme card
card - rectangle
location: in the void
singular-named, improper-named; unlit, inedible, portable
printed name: “card”
printed plural name: “rectangles”
indefinite article: none
description: none
initial appearance: none
length: 1.3 inches long
width: 1.2 inches wide

Now I really don’t care about inches. I’d happliy use the metric system extension, but I get the same problem about things only being able to have one length. And really width IS a length. I would like to be able to compare lengths to widths etc, and multiply them etc.

Any ideas?

Thanks.

Lose the “it’s”. This word should not have an apostrophe in any case – “its” would be correct English spelling. But in any case, if you create a length property called “it’s width” then you could say “The it’s width of the card is 1.2 inches long.” This would also compile, but it would be ugly.

Jim is correct on both counts – you wrote “A rectangle has a length called it’s width” when you need “A rectangle has a length called width” or “A rectangle has a length called the width.” As it is, Inform thinks you’re creating a property called the “it’s width” of a rectangle and doesn’t know what you’re doing when you try to set the just plain width.

By the way I think your code will be slightly more readable and manageable if you change “length” to “dimension” and “lenny” to “length” the way you’d like to have it – that makes the names more natural.

You should also know that indentation can get very important when you’re writing rules that have multiple lines of code. All the statements in your example are one-liners so it doesn’t matter how you indent them but when you write complex if-then-otherwise statements you’ll have to be careful with your indentation.

Thanks, now I have:


	A length is a kind of value.
		1.0 inch long ( singular ) specifies a length.
		99999.9 inches long ( plural ) specifies a length.
		
		The void is a room.
		The player is in the void.
		
		A rectangle is a kind of thing.
			A rectangle has a length.
			A rectangle has a length called width.
		
		The card is a rectangle in the void.
			The card is 1.3 inches long.
			The width of the card is 1.2 inches long.

which gives:

void
You can see a card here.

showme card
card - rectangle
location: in the void
singular-named, improper-named; unlit, inedible, portable
printed name: “card”
printed plural name: “rectangles”
indefinite article: none
description: none
initial appearance: none
width: 1.2 inches long
length: 1.3 inches long