When I create a story file and export it to Z-Code, all the object’s descriptions seem to vanish from the story file. The game is still playable, but using tools like infodump or rezrovs “omap” function (which is basically the SHOWME command) just prints empty strings for my rooms.
I am currently experimenting with writing an AI able to “play” IF using the rezrov-Interpreter and tried to implement some kind of minimum working example with a few rooms and some movable objects. Instead of parsing a room’s description, it’ll just ask the interpreter for all objects in the room and try to manipulate the objects with given action sets.
rezrov and infodump both deduce the objects “short name” from the property table header described here.
Why does inform not set these names accordingly? Any way to make it do so?
[code]$infodump -t example.z8
**** Object tree ****
You are correct that I7 does not use the “hardware name” (property table name) field. Rather, it relies on the short_name property defined in I6 code. This may then be customized by the printing-the-name activity in I7 code.
This being the case, it doesn’t fill in the property table name simply because that would be a waste of space. (This is particularly important in Z-code, where the property table lives in RAM, which is precious.) (In contrast, the values of short_name property live in ROM.)
If the hardware name were defined, it wouldn’t always match the name that the player sees, anyhow.
If you want to do this experimentally, you can parse the gameinfo.dbg file (generated during compilation). This gives you values for all the properties and object addresses. You can then dig in to extract short_name strings – although it isn’t fun, and some of them will be functions rather than strings.
But that doesn’t help when you’re trying to play an existing compiled game, where you don’t have access to gameinfo.dbg.
Moving beyond your minimum example, not every object that’s in scope for a command will be present in the player’s location. So, your approach may miss critical actions that are necessary to advance the game.
I think that the best approach is to interact with the game via an interpreter and to act on its output. In the limit, an analysis of the story file is equivalent to writing your own interpreter and running it.
Ahhh that makes so much sense! Thanks for clearing that up. So I guess there is no way to force I7 to generate these names? Or could I do this by writing I6 code instead?
Of course there are certain limitations to this approach. One could easily create situations, in which the AI would not be able to progress further (Think about dialog menus for conversation etc.).
This is the best approach, but it comes with the huge drawback (at least for me) of having to interpret natural language (and supply a fair amount of common knowledge about the objects of the world). So for the first step, I decided to use the interpreters internal functions to access objects.
Okay, I just did it by using the intermediate compilation result (auto.inf from the Build folder), adding the names to the objects accordingly (some dirty search and replace) and running that through the inform compiler again to generate the z8-file. A quick test with infodump then showed the names
That’s not ideal, but I finally have a story file to modify and test against. Thanks for your input zarf, it has been very helpful and is much appreciated.