Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inform 7: Moving Multiple Identical Objects

24 views
Skip to first unread message

Daryl McCullough

unread,
Apr 16, 2011, 8:28:04 AM4/16/11
to
In Inform, if you have indistinguishable objects, say rocks,
you can say:

<code>
In the garden are 5 rocks.
</code>

But you don't seem to be able to say:
<code>
Move 5 rocks to the garden.
</code>

(Say, in response to a stone statue shattering.)

The only way I can figure out how to do this is to
create an invisible container, initially put
5 rocks in it, and then move the rocks from the container
to the garden at the appropriate time. This works, but
I feel there must be a better way to do it.

Is there no way to create objects at runtime?

--
Daryl McCullough
Ithaca, NY

Felix Larsson

unread,
Apr 16, 2011, 12:37:15 PM4/16/11
to
On Apr 16, 2:28 pm, stevendaryl3...@yahoo.com (Daryl McCullough)
wrote:

You can create the rocks off-stage
<code>There are five rocks.</code>
and then move them to the garden at the right moment with a repeat
phrase like this one:
<code>
repeat with counter running from 1 to 5:
move a random off-stage rock to the garden
</code>

The word "random" is needed, or Inform will interpret "off-stage rock"
as the name of an invidual thing (I think).

Andrew Plotkin

unread,
Apr 16, 2011, 3:49:59 PM4/16/11
to
Here, Felix Larsson <felix.l...@gmail.com> wrote:
> On Apr 16, 2:28 pm, stevendaryl3...@yahoo.com (Daryl McCullough)
> wrote:
> > The only way I can figure out how to do this is to
> > create an invisible container, initially put
> > 5 rocks in it, and then move the rocks from the container
> > to the garden at the appropriate time. This works, but
> > I feel there must be a better way to do it.
> >
> > Is there no way to create objects at runtime?

You can, but it requires an extension and there's no real advantage if
you know the upper bound of your rock inventory.

> You can create the rocks off-stage
> <code>There are five rocks.</code>
> and then move them to the garden at the right moment with a repeat
> phrase like this one:
> <code>
> repeat with counter running from 1 to 5:
> move a random off-stage rock to the garden
> </code>

Putting them in an off-stage container only makes this solution
tidier. That's what I'd do, really.

Or you could segregate them by kind:

A garden rock is a kind of rock. There are five garden rocks.

...now all the garden rocks are in the garden.

--Z

--
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*

0 new messages