Actions applied to Off-stage Objects

I’ve been fighting with the parser here for a few hours now; decided it was time to seek the advice of another.

I have an action purposed for testing that is designed to act on off-stage objects which themselves are just data containers that describe something the player can interact with via a complicated system. It seems that the parser is having a rough time figuring out what I am talking about.

Here is the distilled code:

[code]An event driven scene is a kind of object.
It has an object called data store. Data store of it is usually nothing.

Battle Test is an event driven scene.
Data store of it is usually Battle Test Data.
Battle Test Data is an object.

Event triggering is an action applying to one visible thing, out of world. Understand “trigger [any event driven scene]” as event triggering.

Carry out event triggering:
say “[Noun] was triggered.”

Testing Place is a room. “This is where testing occurs.”[/code]
The result of typing “trigger battle test” is “That noun did not make sense in this context.” At first I thought the ‘Battle Test Data’ object was confusing the parser, but I get the same result when I comment out any mention of that object.

It just seems the parser is refusing to understand ‘Battle Test’ as being something usable in this action. I’ve looked around for remedies on scope and they are represented in the action (the use of ‘visible’ and ‘any’), but no luck. I’ve also tried making the action apply to ‘one visible value’ and ‘one visible object’ and while they compiled (which I did not expect to happen), they failed to make a difference.

I have found I can make it work if I make event driven scenes a kind of thing, but since they are not purposed for direct player character interaction and include properties I have no use for, it seems more appropriate to use kind of object.

There doesn’t seem to be any reason I can see as to why this should not work as written. Does anybody have any ideas?

The parser can deal with kinds of things, and it deals (somewhat differently) with kinds of values, but objects which are neither seem to confuse it. The solution to your problem is Stop Doing That. :slight_smile:

It might make sense for the parser to handle non-things the same way it handles kinds-of-value – as opaque values which are not involved in scope or the world model. However, it doesn’t. Kinds-of-object are really only useful for code that you write yourself. (For example, if you had a phrase “To trigger event (E - event driven scene): …” that would be fine. But throwing them into the parser, no.)

Then I kind of wonder why the index reports that my “event driven scene” object is something that is possible to “understand” when it is actually impossible to do so.

That is, there is a green check mark for the ‘under’ column for this kind of object in the kinds index. A note at the bottom basically says what I am attempting to do is possible if that tick exists.

But, it is okay, if confusing. I have been using other methods to carry out my tests. Thank you very much for considering my issue.

I’d call that a bug. Or a tree for the forest: the parser can understand the object but the action-handling machinery cannot handle it.

EDIT-ADD: Obviously (see following comments) I was wrong; the parser does not understand the object, because it is privately-named by default.

Actually, I have discovered it to be no bug at all. It is just not enabled by default for objects. The way to fix the issue is to ensure that your kind of object is publically-named.

To amend my old code:

An event driven scene is a kind of object. An event driven scene can be privately-named or publically-named. It is usually publically-named. It has an object called data store. Data store of it is usually nothing.
This will now enable it to be referred to properly by the player via an understand statement. It is a little obscure; I accidentally came across it while fumbling through the documentation and a quick test showed it to be the solution to my problem above.

So, if you ever need to create your own kinds of objects and let the player refer to them, this is the way to go.

Interesting.

Is there a reason the Standard Rules don’t allow objects to be privately-/publically-named, while it does allow them to be plural-/singular-named and proper-/improper-named?

Wow, this is the first time I’ve seen that you actually have to declare something as “publically-named.” Which makes it even more important that I7 allow you to spell “publicly” right! :smiling_imp:

I’m pretty sure it’s just an oversight that resulted from nobody testing running objects through the parser machinery.

Understanding data objects has a great deal of potential, especially in regards to dispensers and dynamic objects. Combine this ability with the power to understand things by their relations, and you can make a generic object into a very specific object.

Take a look at this rather large and thorough example in the spoiler if you’re interested in the technique:

[spoiler][code][The generic book object. It will be used as an indistinguishable object.]
A book is a kind of thing.
The description of it is usually “[Base Description of Book]”.

To say Base Description of Book:
if the item described is about nothing or the bookshelf contains the item described:
say “It looks to be a hard-bound book. You can’t see the cover and the spine is all worn out.[no line break]”;
otherwise:
say “[the description of the data source of the item described]”;

[Rules for printing are required to achieve the effect of the books being specific objects in the world.]
Rule for printing the name of a book (called the book described):
if the book described is about nothing:
say “book”;
otherwise:
say “[data source of the book described]”.

Rule for printing a number of books (called a book listed) not contained in a bookshelf:
let R be list of subject matter that is the subject of books contained in the object that contains the item described;
let quantity text be “pile”;
if listing group size is 2:
now quantity text is “couple”;
otherwise if listing group size is 3:
now quantity text is “few”;
if number of entries in R is greater than 0:
say “a [quantity text] of books, including copies of [R]”;
otherwise:
say “a [quantity text] of books”.

Rule for printing a number of books when taking inventory:
let R be list of subject matter that is the subject of books carried by the player;
repeat with current subject running through R:
now current subject is marked for listing;
let L be the list of books carried by the player;
let started be false;
repeat with current book running through L:
if the data source of the current book is marked for listing:
if started is true:
say "[line break] ";
now started is true;
if the current book is a copy of a book carried by the player:
say "[the number of books that are a copy of the current book carried by the player plus 1 in words] copies of ";
say “[the current book]”;
now the data source of the current book is unmarked for listing;

[Used to tell if the player holds more than one copy of a book.]
Duplication relates a book (called X) to a book (called Y) when X is not Y and the data source of X is the data source of Y. The verb to be a copy of implies the duplication relation.

[This is our data container for the specifics of a book.]
A subject matter is a kind of object.
A subject matter can be privately-named or publically-named. It is usually publically-named.
A subject matter can be marked for listing or unmarked for listing. It is usually marked for listing.
It has a text called description. Description is usually “It is a pretty uninteresting book about a topic you care little about.”
It has a text called author. Author is usually “John Q. Public”.
It has a text called first chapter. First chapter is usually “Forward”.

[Here we give the ability to assign a subject to a book, turning the indistiguishible book into a specific book.]
Written substance relates one subject matter (called the data source) to various books.
The verb to be the subject of implies the written substance relation.
The verb to be about implies the reversed written substance relation.
Understand “[something related by reversed written substance]” as a book.
Understand “book inside/in [something related by reversed containment]” as a book.

The Course of Time is a subject matter. “An in-depth analysis of supposed alterations to the time line, some triggered by the gods and other by the will of man. The accounts in this book are largely discredited as evidence of temporal incursions are hard to come by.”
The author of it is “Mirnar Ninyo”.
The first chapter is “The Incident at South Harbor”.

Beginner’s Alchemy is a subject matter. “An easy to follow and illustrated guide to medicinal flora and fauna. Includes a number of helpful recipes that are an absolute necessity to merchants, adventurers, and caravan guards alike.”
The author of it is “Daner Trarneis Lainamair”.
The first chapter is “Introduction to Technique”.

The Bowels of Nehrimdine is a subject matter. “A story that claims to be fact about a cave system underneath the tower of Nehrimdine. Many references about the location of the tower seem inaccurate, however facts tend to be obscured by time, turning to legend. Perhaps showing the book to some knowledgeable people will reveal more.”
The author of it is “an unknown entity”.
The first chapter is “Baladium’s Drive”.

[An action to be applied to our books, accessing the special data afforded it by the subject matter assigned to it.]
Studying is an action applying to one thing. Understand “study [something]” as studying.
Instead of studying something that is not a book:
try examining the noun.

Report studying a book (called the book described):
if the data source of the book described is nothing:
say “You’ll have to pick up the book to get more information out of it.”;
otherwise:
say “[the book described] is by [the author of the data source of the book described]. Opening it up, you find the first chapter is called ‘[the first chapter of the data source of the book described]’.”;
rule succeeds.

Testing Place is a room. “This is where testing occurs.”

A bookshelf is a container in the Testing Place. It is fixed in place. It contains 10 books.
[A couple of generic objects that were used to troubleshoot inventory listings.]
A rock is in the Testing Place.
A stick is in the Testing Place.

[Here we make a generic book a specific book by giving it a random subject when taken.]
After taking a book (called the book described) about nothing:
let new subject be a random subject matter;
now the book described is about the new subject;
now the book described is proper-named;
say “The book is revealed to be ‘[new subject]’.”.

Test me with “look / take book / inventory / take 3 books / inventory / drop book / look / drop all books / look / take all books / study Bowels / study Beginner’s Alchemy”.[/code][/spoiler]
It even allows you to refer to the generic book object by it’s title, as if it had been statically created, which is pretty slick. Only problem is that if you place more than one book into the room, they become indistinguishable, but that can eventually be worked out with a bit of beating it to death.

I just didn’t feel like spending any more time on it. :stuck_out_tongue:

Edit: My project required me to solve the issue of dropped books being indistinguishable. I did a quick copy/paste and updated the code here and there.

Is there any reason a subject matter couldn’t be a kind of value?

Or a thing? Things work perfectly well for this sort of, er, thing. The point is not that your technique is bad, it’s that you’re using a base class which isn’t well supported for user-level user. The “thing” kind is.

Things cost more space than objects, but the margin is like 32 bytes per thing, so not a huge deal until you have dozens of them.

True enough, you can use any kind of value, and a thing is just a kind of object. In an earlier and less elegant version, I was using tables spread across the whole of my source text to specify the data. That really wasn’t a lot of fun.

Indeed, the object kind is not purposed for user-level interaction, which is specifically why I decided to used it! The data is meant to be interacted with only through a proxy object; in my example, the ‘book’ kind. Using a kind of object in this manner also acts as a means to compartmentalize functionality and implies to anyone reading the source text that these objects are meant for a special purpose. Using a kind of thing instead could blur the lines and can make it harder to read and maintain the code later on.

The way I had my example setup, the data source provides the specific data and the generalized thing it describes will define the ways the player can interact with the data, sort of analogous to a Model-View-Controller programming pattern.

If it works for you, that’s great, but to me it sounds like a colossal paradigm mix-up.

Well, you’ve already encountered the maintenance problems associated with objects, so you’ll have to decide which you want. :slight_smile:

I’m too late to this thread to be useful, but:

I actually bumped into the same problem ages ago and reported it as (eventually) a documentation bug: inform7.com/mantis/view.php?id=357

I’m glad the note in the docs was subsequently found to be useful! :smiley: