Login
Remember
IF Answers
Ask a Question

# 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?

- inform6
- programming

## 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)();
    ];

## Related questions

- How can I set the player smell in Inform 6?
- Is there a maximum rules limit in Inform 6?
- I'm a programmer, and I want to write a text adventure. What languages / systems would be familiar to me?
- How to set up a condition involving the presence of a character.
- In a Gamebook, how do I fix that the text processor is not working properly on my version of Quest (I think)?

...