"State of the Orange" by John Timmons
The release number is 1. The story creation year is 2007. The story headline is "An example of changing the properties of an object." The story description is "This is a simple demonstration of how we might change an object by changing their properties rather than 'swapping out' objects with another. This is based on Chapter 16.14. 'Understanding things by their properties' in the Inform 7 documentation."
Release along with the source text, a website, and an interpreter.
The Open Field is a room.
An orange is in the Open Field. The description is "It seems like an ordinary orange." The orange can be healthy or bruised. The orange is healthy. [1] Understand the healthy property as describing the orange. [2]
After dropping the orange:
say "The orange falls with a dull thud.";
now the orange is bruised;
change the description of the orange to "Looks like this orange has been dropped." [3]
Garvey is a man in the Open Field. The description is "Garvey is a rather nondescript fellow. He is holding [a list of things carried by garvey]." [4]
Instead of giving the orange to Garvey:
if the orange is healthy begin;
now Garvey has the orange;
say "Garvey thanks you for the gift.";
otherwise if the orange is bruised;
say "Garvey rejects your offer.";
end if. [5]
Notes
[1]. After creating the orange, setting its location, and providing a description, we declare two possible properties that the orange might possess: healthy or bruised. Then we state that the present property of the orange is healthy.
[2]. Although not necessary in this particular example, this statement tells Inform to understand should the player type "healthy orange" or "bruised orange."
[3]. Here we make two changes after the orange has been dropped: first we change the property to that of bruised and second the orange will now possess a new description to indicate that it has been dropped (and bruised.)
[4]. Whenever we examine Garvey, his possessions will be listed as part of his description.
[5]. This instead rule demonstrates how we can check on the healthy or bruised property of the orange and react accordingly.