The section on Actions with Three Objects at the end of the chapter on Defining New Actions in the Adv3Lite Library Manual has some discussion of defining, or at least faking, actions like LiteralTIActions, so that might be a good place to start if you haven’t looked at it already.
In brief, you’d need to define a TIAction but define a VerbRule with a third slot, something like:
* Store the literal value from the aobj (or acc) property of
* the current command object.
literal = cmd.aobj.theName;
/* Then carry out the inherited handling. */
literal = nil
‘read’ singleDobj literalAObj ‘in’ singleIobj
action = ReadIn
verbPhrase = ‘read (what) (in what) (what)’
missingQ = ‘what do you want to read; what do you want to read;
what do you want to read in’
That said, I’m surprised you can’t get this to work with a TopicTAction, something like:
('read') topicIobj 'in' singleDobj
action = ReadIn
verbPhrase = 'read (what) (in what)'
missingQ = 'what do you want to read in; what do you want to read'
dobjReply = singleNoun
priority = 60 // You may need to add this to avoid the "You can't see any page 10 in book" problem
This would seem to me to be a simpler solution; you could then perhaps treat the book as a Consultable and the pages as ConsultTopics (or create a similar kind of setup).
Disclaimer: I’m not at home and I don’t have TADS 3 on this machine, so I can’t test any of this, but hopefully it will gice you some pointers.
EDIT: Now I am back home and have been able to test it. Here’s a quick example that seems to work okay along with the definition of the ReadIn action above:
+ book: Consultable 'book'
++ ConsultTopic @tPage1
"That's just the title page. "
++ ConsultTopic @tPage2
"That's just the dedication. "
"The book doesn't have that many pages. "
tPage1: Topic 'page 1';
tPage2: Topic 'page 2';
Obviously it needs to be embedded in a complete (if minimal) game to work. With this I get the following output:
The Living Room
The living room
You can see a book here.
>read page 1 in book
That’s just the title page.
>read page 2 in book
That’s just the dedication.
>read page 3 in book
The book doesn’t have that many pages.