Altering 'version'

I’m trying to reformat the output of the version command (specifically the list of extensions), but I can’t quite do it in I7 because one automatically-generated part of the rule that I can’t access - the bit that prints the identification number and lib identification number - is in i6, and is glued to the part that lists the extensions automatically. In other words, if I cut out the automated extension list to use my own, I have to cut the printing of the identification numbers, too.

Stephen Granade’s ‘Extended Banner’ extension doesn’t give access to either of the ID numbers. How can I pluck them out? (I did try a little i6 hackery but I couldn’t get it to work, what with my lack of real knowledge of i6.)

Cheers

  • Wade

It sounds like you want to replace the “announce the story file version rule” with your own code that does almost the same thing, but with different extension-printing behavior.

Pretty much, but if I do replace it - I have no way of retrieving the two identification numbers myself to print them. At least with I7 alone. Those 2 only appear if you type ‘version’, and are not part of the regular banner.

  • Wade

The LibSerial value can be accessed by defining an I7 text variable and give it the right I6 name:

The library serial number is a text that varies. The library serial number variable translates into I6 as "LibSerial". Now, you can just ‘say the library serial number’.

There may well be a better way than the following to get at the identification number, but one way to do it is by isolating the I6 code responsible for that part of the announce the story file version rule into its own I6 routine and give that an I7 rule name:

[code]The print ID number rule translates into I6 as “UUID_R”.

Include
(-
[ UUID_R ix;
for (ix=6: ix <= UUID_ARRAY->0: ix++) print (char) UUID_ARRAY->ix;
print “^”;
ix = 0;
];
-).
[/code]This way, you can’t simply ‘say the ID number’, but you can at least ‘follow the print ID number rule’.

If you use a phrase rather than a rule you can!

To say the ID number: (- UUID_R(); -).

No need for that final ix = 0 btw.

Ugh! I forgot the parentheses after the routine name, when I tried that. Well, well …

This is what I use.

[spoiler][code]To say raw: (- RAW(); -).

Include (-

[ RAW ix;
for (ix=6: ix <= UUID_ARRAY->0: ix++) print (char) UUID_ARRAY->ix;
];

-).

Include (-

[ IFID;
PrintText((+ IFID Header +));
print ": ";
RAW();
print “^”;
];

-).

The IFID Header is a text that varies. The IFID Header is “Identification number”.

To say the/-- ifid: (- IFID(); -).

To say the/-- banner text: (- Banner(); IFID(); -).

Include (-

[ ANNOUNCE_STORY_FILE_VERSION_R ix;
if (actor ~= player) rfalse;
Banner();
IFID();
if (standard_interpreter > 0) {
print "Standard interpreter “,
standard_interpreter/256, “.”, standard_interpreter%256,
" (”, HDR_TERPNUMBER->0;
#Iftrue (#version_number == 6);
print (char) ‘.’, HDR_TERPVERSION->0;
#Ifnot;
print (char) HDR_TERPVERSION->0;
#Endif;
print ") / ";
} else {
print "Interpreter ", HDR_TERPNUMBER->0, " Version ";
#Iftrue (#version_number == 6);
print HDR_TERPVERSION->0;
#Ifnot;
print (char) HDR_TERPVERSION->0;
#Endif;
print " / ";
}
print "Library serial number ", (string) LibSerial, “^”;
#Ifdef LanguageVersion;
print (string) LanguageVersion, “^”;
#Endif; ! LanguageVersion
#ifdef ShowExtensionVersions;
ShowFullExtensionVersions();
#endif;
say__p = 1;
];

-) instead of “Announce Story File Version Rule” in “ZMachine.i6t”.

Include (-

[ ANNOUNCE_STORY_FILE_VERSION_R ix;
if (actor ~= player) rfalse;
Banner();
IFID();
@gestalt 1 0 ix;
print "Interpreter version ", ix / $10000, “.”, (ix & $FF00) / $100,
“.”, ix & $FF, " / ";
@gestalt 0 0 ix;
print "VM ", ix / $10000, “.”, (ix & $FF00) / $100, “.”, ix & $FF, " / ";
print "Library serial number ", (string) LibSerial, “^”;
#Ifdef LanguageVersion;
print (string) LanguageVersion, “^”;
#Endif; ! LanguageVersion
ShowFullExtensionVersions();
say__p = 1;
];

-) instead of “Announce Story File Version Rule” in “Glulx.i6t”.[/code][/spoiler]

This allows for easy customisation of the header test that prefixes the IFID and an easy way to say the raw IFID value.

Also, these are the I6 rules that print the version, so you should be able to modify them as much as you like.

Hope this helps.

Thanks all. Yeah, climbingstars, you’ve done what I tried to do, replacing the whole bit of code, but I didn’t know how to do it without having the game fail to compile. I took what you did and then removed the ‘ShowFullExtension’ part of it to get what I was after.

  • Wade