Inform6 from the ground up -- Actions not working

0 votes
68 views
asked May 16 in Authoring by Cactus (8 points)

I am recreating an ancient adventure game in Inform6 so that it can be easily played on modern platforms. My aim is to recreate not just the plot/puzzles but also the parser. Also, the game is not in English so I don't expect the standard library to be that useful anyway.

By copy-pasting relevant-looking bits from the standard Inform6 library, I was able to get parsing working for the very simplistic model that I plan to support: because I only have verb, verb noun and verb noun1 noun2 rules anyway, I thought I'd skip implementing pattern matching for proper grammar rules, and just key everything to the verbs only; e.g.

Verb 'x' 'examine' * -> Examine;
[ExamineSub;
  ! just error out if noun1 is not set
];

This works good enough: I can get the actions from the grammar table and then run them by looking up the corresponding callback function from #actions_table. However, I must be missing something because I can't get the <action> syntax working.

Below is a minimal example showing my problem:

Verb 'l' 'look' * -> Look;

[ LookSub;
    "This is LookSub";
];

[ Main;
  <Look>;
];

I would expect this to print

This is LookSub 

when run; however, instead I am getting the following output:

Action <0 0 0>

What are my actions missing?

1 Answer

+1 vote
answered May 20 by vaporware (56 points)
selected May 21 by Cactus
 
Best answer

Action syntax translates into a call to the R_Process routine. The standard I6 library defines R_Process in parserm.h, but there's also a default implementation built into the compiler, which is where the Action <0 0 0> message is coming from.

A simple implementation of R_Process would go something like this:

Global action;
Global noun;
Global second;
Global actor;

[ R_Process a b c d;
    action = a;
    noun = b;
    second = c;
    actor = d;
    (#actions_table-->action)();
];
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...