Hey guys, I found Inform 7 yesterday, and it’s a lot of fun. I’ve been fiddling around, trying to learn as I go. I’ve hit a bump with an IF statement.
I want to specify multiple values for the size capacity of a container, so that a tiny box can’t hold a large vase for example. Here’s how I tried to do it:
[code]A thing has a number called Largeness.
A container has a number called Sizecap.
A weapon is a kind of thing.
A gun is a kind of weapon.
A gun-belt is a kind of container. A gun-belt is wearable.
The SixGun is a gun. The largeness of the sixgun is 1.
The Gun Belt is a gun-belt. The sizecap of the gun belt is 1.
Check inserting something (called the to-be-inserted) into a container (called the receptacle):
Let Value1 be largeness of to-be-inserted;
Let Value2 be sizecap of receptacle;
[if Value1 is greater than Value2]say “[The noun] doesn’t seem to fit in [the second noun].”;say “[largeness of to-be-inserted] and [sizecap of receptacle] and [Value1] and [Value2]”;rule fails;[otherwise]Continue the action.[end if].[/code]
I nabbed some of the code from the net, tried to make it to do what I want it to do. You’ll notice I’ve added a bit of code at the end of the IF statement to print out the values. The values are all being assigned correctly, but I suspect I’m wording the beginning of my statement incorrectly.
Perhaps the statement thinks I’m refering to the internal object ID of Value1, rather than the value stored in it? I can’t seem to figure out how to get it to work. It always throws up the failure, never continues the action.
Thanks for any help folks!
P.S A side question, I want to call my gun “Six Gun”, but when I do that and type “put Six Gun in Gun Belt” into the game itself, the game is unable to parse that. I had to shorten it to SixGun. Know how I might get around that issue, and perhaps why it’s happening?