Lists?

Hello, I’m having a bit of trouble understanding lists. I have the following story file that fails compilation:

[code]“test” by “walkingeye”

First Room is a room. “Welcome to the First Room.”

A magic-spell is a kind of backdrop.

active-spells is a list of magic-spells that varies.

frotz is a magic-spell. It is everywhere.

add frotz to active-spells;[/code]

This fails with:

  >--> In the sentence 'add frotz to active-spells' (source text, line 13), I can't find a verb that I know how to deal with.

It’s certainly possible the problem is that I’m using lists when I shouldn’t be, so I’ll explain a bit more of what I’m trying to do. I would like the player to be able to learn spells throughout the story, but only have a limited number of the learned spells available. After the player casts a spell, it becomes unusable and put on the bottom of the queue, and the next spell in the queue becomes usable.

Thanks in advance!

The problem isn’t anything to do with your lists syntax–it’s that you haven’t told Inform when to add frotz to active-spells. (This is often what “can’t find a verb that I know how to deal with” means.) The “add frotz to active-spells” phrase has to be in a rule rather than on its own.

In this case, if you want frotz to be on the list at the beginning of the game, you could do this:

When play begins: add frotz to active-spells.

Or you could just declare the list directly:

active-spells is a list of magic-spells that varies. active-spells is {frotz}.

(I haven’t actually tested these, though, so there might be another problem I can’t see right now.)

Thanks so much, it worked!