Can the story code know what the project's IFID is?

Is there a way for the Inform code to know what the IFID of the project containing it is?

The player can get it by typing VERSION, and it’s accessible from the Library Card that can be generated, and of course it’s used for indexing on IFDB, and could be looked up there. Inform tracks it in the file [projectname].inform/uuid.txt.

But I can’t find anything in the documentation that suggests a way for the code to dig that number back out of the project. Writing with Inform talked about it in section 25.5, which just explains what it is, tells authors it’s why they shouldn’t copy whole project folders willy-nilly, and talks about the VERSION command. WI 23.12 and 23.15 link it to file ownership in relation to reading and writing files from other Inform projects. WI 26.6 just says again that the VERSION command will tell the user what it is. WI 25.14 mentions an [IFID] text replacement, but that’s for website templates, and doesn’t seem to work in Inform code. The Inform Recipe Book 11.5 just repeats the same information in relation to the VERSION command.

Is there a way for the code, rather than the user, to get the current IFID (other than defining it as a constant and then referring to that constant in the code)?

Do you just want to display it on demand? If so…

To say IFID:
    (- PrintIFID(); -).

Include
(-
[ PrintIFID   ix;
    for (ix=8: ix <= (UUID_ARRAY->0)-2: ix++) print (char) UUID_ARRAY->ix;
];
-).
1 Like

The I6 code contains the line

Array UUID_ARRAY string "UUID://0D35EAE4-EF8B-44B3-81CF-8CC2366B6F88//";

This is a byte array (with initial length byte, as the “Array string” format specifies for I6). This is what the VERSION command prints.

1 Like

That works! Many thanks.