Just to add to Capmikee’s observations, even if you had created an action applying to one thing, your grammar line (“Understand “study [text]” as studying”) doesn’t match. The bracketed token has to be the same kind as the action is looking for – in this case a thing, not text.
Below is an alternate example of how you could go about this. I wasn’t sure if you wanted the player to study a particular book or a language, so I coded up something that does both. However, there are really only two primary differences between my method and Capmikee’s.
First, I made languages a kind of value (KOV) rather than a kind of thing. When things are referred to in commands, they need to be in scope. (The combined use of “visible” and “any thing” is one way of doing this.) KOVs don’t have this restriction; they can be referred to (in commands which recognize them) at any time. Also, you can (usually) assign properties to KOVs – like learned / unlearned – so you don’t lose anything.
The second difference involves the table. I agree with Cap that you don’t really need tables (I probably wouldn’t have approached it that way), but some authors like the way tables organize info and it’s certainly a viable choice. The thing to note is that there are two very distinct ways of using tables in I7. One is the way you’re using them now: looking up entries and cross - referencing them. The other is to use a table to actually define (create) objects or values (see ch. 15.16 of the docs). The downside to this method is that tables used this way can’t really be messed with (sorted, changed, in some cases even accessed) in - game. The upside is that you usually don’t need to; Inform automatically assigns the other columns as properties of the thing being defined.
In the example below, I’ve created a book “kind” and defined the individual books in a table with headings (language, unlearned description, learned description). I don’t have to say “A book has a language” because Inform is able to infer from the table that books have that property. More importantly, if I ever need to find the value of that property later, I just have to say “language of the dusty book,” rather than “choose the row corresponding to blah blah blah…”
Sorry if this explanation seem convoluted or complex. The code is actually pretty simple. [code]Section - Languages
A language is a kind of value.
The languages are Latin, Greek, English and Martian.
A language can be learned or unlearned. [<- unlearned is already the default]
English is learned.
Section - Books
A book is a kind of thing. Some books are defined by the Table of Fancy Books.
The description of a book is usually “[The item described] [if the language of the item described is unlearned][unlearned description].[otherwise][learned description].”
Table of Fancy Books
book language unlearned description learned description
a dusty book latin “is difficult to comprehend” “is readable but boring”
Time Magazine English “is filled with pictures” “is filled with ads”
an old scroll Greek “has letters like on a frat house” “tells the tale of Odysseus”
Section - Studying Action
Studying is an action applying to one thing.
Understand “study [something]” or "learn [something]"as studying.
Check studying:
if the noun is not a book,
say “Nothing comes to mind.” instead.
Check studying:
if the language of the noun is learned,
say “Since you already know [language of the noun], you are able to determine that [the noun] [learned description].” instead.
Carry out studying:
now the language of the noun is learned.
Report studying:
say “You study [the noun] and find you are now able to read [language of the noun].”
Section - Learning Action
Learning is an action applying to one language.
Understand “learn [language]” or “study [language]” as learning.
The learning action has an object called the studied book.
Setting action variables for learning:
repeat with B running through books in the location:
if the language of B is the language understood:
now the studied book is B.
Check learning:
if the language understood is learned,
say “You already know [language understood].” instead.
Check learning:
if the studied book is nothing,
say “You don’t see any books here that look like [language understood].” instead.
Carry out learning:
try studying the studied book instead.
Section - Scenario
The Library is a room.
The dusty book, Time Magazine, and the old scroll are in the Library.
A football is in the Library.
test me with “study football / x dusty / learn martian / study english / learn latin / x dusty book / x time / study it / x scroll / study it / read it / learn greek / study scroll / learn it”.[/code]
P.S. Remember to watch your tabs when cutting / pasting the above. I think the only tab-sensitive rule is the “Setting action variables for learning” rule.
Edit: In the description of the book I originally used “the noun” which works in this case, but changed it to “item described” which is safer and syntactically correct.