Glulx game serial number

I tried getting the serial number with this:

To say story serial number: (- for (i=0 : i<6 : i++) print (char) ROM_GAMESERIAL->i; -).

But that causes I6 to go nuts.

Help?

–dc

Nuts how?

"Cloak of Darkness QC" by David Cornelson

Include Quixe Channels Core by David Cornelson.
Include Quixe Channels Scoring by David Cornelson.
Include Quixe Channels Banner by David Cornelson.

The story headline is "A basic IF demonstration".
The story creation year is 2015.
The maximum score is 2.

[
  Whatever room we define first becomes the starting room of the game, in the absence of other instructions:
]

Foyer of the Opera House is a room.  "You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west."

Instead of going north in the Foyer, say "You've only just arrived, and besides, the weather outside seems to be getting worse."

[
  We can add more rooms by specifying their relation to the first room. Unless we say otherwise, the connection will automatically be bidirectional, so "The Cloakroom is west of the Foyer" will also mean "The Foyer is east of the Cloakroom":
]

The Cloakroom is west of the Foyer. "The walls of this small room were clearly once lined with hooks, though now only one remains. The exit is a door to the east."

In the Cloakroom is a supporter called the small brass hook.
The hook is scenery. Understand "peg" as the hook.

[
  Inform will automatically understand any words in the object definition ("small", "brass", and "hook", in this case), but we can add extra synonyms with this sort of Understand command.
]

The description of the hook is "It's just a small brass hook, [if something is on the hook]with [a list of things on the hook] hanging on it[otherwise]screwed to the wall[end if]."

[
  This description is general enough that, if we were to add other hangable items to the game, they would automatically be described correctly as well.
]

The Bar is south of the Foyer. The printed name of the bar is "Foyer Bar".
The Bar is dark.  "The bar, much rougher than you'd have guessed after the opulence of the foyer to the north, is completely empty. There seems to be some sort of message scrawled in the sawdust on the floor."

The scrawled message is scenery in the Bar. Understand "floor" or "sawdust" as the message.

Neatness is a kind of value. The neatnesses are neat, scuffed, and trampled.
The message has a neatness. The message is neat.

[
  We could if we wished use a number to indicate how many times the player has stepped on the message, but Inform also makes it easy to add descriptive properties of this sort, so that the code remains readable even when the reader does not know what "the number of the message" might mean.
]

Instead of examining the message:
	increment the score;
	select the score message channel;
	say "The message, neatly marked in the sawdust, reads...";
	select the main channel;
	end the story.

[
  This second rule takes precedence over the first one whenever the message is trampled. Inform automatically applies whichever rule is most specific:
]

Instead of examining the trampled message:
	say "The message has been carelessly trampled, making it difficult to read.
	You can just distinguish the words...";
	end the story saying "You have lost".

[
  This command advances the state of the message from neat to scuffed and from scuffed to trampled. We can define any kinds of value we like and advance or decrease them in this way:
]

Instead of doing something other than going in the bar when in darkness:
	if the message is neat:
		now the message is scuffed;
	otherwise if the message is scuffed:
		now the message is trampled;
	say "In the dark? You could easily disturb something."

Instead of going nowhere from the bar when in darkness:
	now the message is trampled;
	say "Blundering around in the dark isn't a good idea!"

[
  This defines an object which is worn at the start of play. Because we have said the player is wearing the item, Inform infers that it is clothing and can be taken off and put on again at will.
]

The player wears a velvet cloak. The cloak can be hung or unhung.
Understand "dark" or "black" or "satin" as the cloak.
The description of the cloak is "A handsome cloak, of velvet trimmed with satin, and slightly splattered with raindrops. Its blackness is so deep that it almost seems to suck light from the room."

Carry out taking the cloak:
	now the bar is dark.

Carry out putting the unhung cloak on something in the cloakroom:
	now the cloak is hung;
	increment the score;
	select the main channel.

Carry out putting the cloak on something in the cloakroom:
	now the bar is lit.

Carry out dropping the cloak in the cloakroom:
	now the bar is lit.

Instead of dropping or putting the cloak on when the player is not in the cloakroom:
	say "This isn't the best place to leave a smart cloak lying around."

When play begins:
	select the prologue channel;
	say "[paragraph break]Hurrying through the rainswept November night, you're glad to see the bright lights of the Opera House. It's surprising that there aren't more people about but, hey, what do you expect in a cheap demo game...?";
	select the main channel.

Understand "hang [something preferably held] on [something]" as putting it on.

Test me with "s / n / w / inventory / hang cloak on hook / e / s / read message".
Version 1/041915 of Quixe Channels Banner by David Cornelson begins here.

[
  Reminder of what's available from the standard library...

  The story title, the story author, the story headline, the story genre
  and the story description are text variables. [*****]
  The release number and the story creation year are number variables. [**]

  The release number is usually 1.
  The story headline is usually "An Interactive Fiction".
  The story genre is usually "Fiction".

  The story title variable translates into I6 as "Story".
  
  ..and what is normally printed...
  
  Cloak of Darkness QC
  A basic IF demonstration by David Cornelson
  Release 1 / Serial number 150419 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD
]

Section 1 - Definitions

Include (- Constant FYC_BANNER = ('B' * $1000000) + ('A' * $10000) + ('N' * $100) + 'R'; -);

[To say story serial number: (- print "041915"; -).]

To say story serial number: (- for (i=0 : i<6 : i++) print (char) ROM_GAMESERIAL->i; -).
To say I7 version number: (- print (PrintI6Text) NI_BUILD_COUNT; -).
To say I6 version number: (- print inversion; -);
To say I7 library number: (- print (PrintI6Text) LibRelease; -);

Section 2a - Not For Release

To Select the Banner Channel:
	(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_BANNER); else print "** Banner channel ON **^";  -);

Section 2b - For Release Only

To Select the Banner Channel:
	(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_BANNER); -);

Section 3a - Print the Banner

[
  Still need to fix the I6 library number and however "SD" is determined...
]
Rule for printing the banner text when not outputting channels:
	say "[bold type][story title][roman type], [story headline] by [story author][line break]";
	say "Copyright [unicode 169] [story creation year] by [story author][line break]";
	say "Release [release number] / Serial number [story serial number] / Inform 7 Build [I7 version number] (I6 lib/v6.33 lib [I7 library number] SD)[line break]";

Section 3b - Print the Banner

Every turn when outputting channels (this is the add banner channel rule):
	select the banner channel;
	say "{ storyTitle: [quotation mark][story title][quotation mark], storyHeadline: [quotation mark][story headline][quotation mark], storyAuthor: [quotation mark][story author][quotation mark], storyCreationYear: [quotation mark][story creation year][quotation mark], releaseNumber: [quotation mark][release number][quotation mark], serialNumber: [quotation mark][story serial number][quotation mark], inform7Build: [quotation mark][I7 version number][quotation mark], inform6Library: [quotation mark][I7 library number][quotation mark] }";
	select the main channel.

	
Quixe Channels Banner ends here.
C:\Program Files (x86)\Inform 7 6L\Compilers\ni \
    -internal "C:\Program Files (x86)\Inform 7 6L\Internal" -project "d:\dropbox\Documents\Inform\Projects\Cloak of Darkness QC.inform" -format=ulx
Inform 7 build 6L38 has started.
I've now read your source text, which is 641 words long.
I've also read Standard Rules by Graham Nelson, which is 42616 words long.
I've also read English Language by Graham Nelson, which is 2288 words long.
I've also read Quixe Channels Core by David Cornelson, which is 1079 words long.
I've also read Quixe Channels Scoring by David Cornelson, which is 56 words long.
I've also read Quixe Channels Banner by David Cornelson, which is 213 words long.

  The 641-word source text has successfully been translated into an
    intermediate description which can be run through Inform 6 to complete
    compilation. There were 3 rooms and 4 things.
Inform 7 has finished.

C:\Program Files (x86)\Inform 7 6L\Compilers\inform6 \
    -wSDG +include_path=..\Source,.\ auto.inf output.ulx
Inform 6.33N for Win32 (20th August 2014)
auto.inf(12107): Error:  '=' applied to undeclared variable
>     say__p=1;ParaContent(); print "{ storyTitle: ";ParaContent(); pr  ...etc
auto.inf(12107): Error:  Expected expression with side-effects but found <constant>
>     say__p=1;ParaContent(); print "{ storyTitle: ";ParaContent(); pr  ...etc
auto.inf(12107): Error:  '=' applied to undeclared variable
>     say__p=1;ParaContent(); print "{ storyTitle: ";ParaContent(); pr  ...etc
auto.inf(12107): Error:  Expected expression with side-effects but found <constant>
>     say__p=1;ParaContent(); print "{ storyTitle: ";ParaContent(); pr  ...etc
auto.inf(12742): Error:  '=' applied to undeclared variable
>     say__p=1;ParaContent(); print "Release ";ParaContent(); print (s  ...etc
auto.inf(12742): Error:  Expected expression with side-effects but found <constant>
>     say__p=1;ParaContent(); print "Release ";ParaContent(); print (s  ...etc
auto.inf(12742): Error:  '=' applied to undeclared variable
>     say__p=1;ParaContent(); print "Release ";ParaContent(); print (s  ...etc
auto.inf(12742): Error:  Expected expression with side-effects but found <constant>
>     say__p=1;ParaContent(); print "Release ";ParaContent(); print (s  ...etc
In:  1 source code files             67385 syntactic lines
 56143 textual lines               2031061 characters (ISO 8859-1 Latin1)
Allocated:
  8213 symbols (maximum 20000)    13806800 bytes of memory
Out:   Glulx story file 1.150419 (598.5K long):
    21 classes (maximum 200)            47 objects (maximum 640)
   237 global vars (maximum 512)     86618 variable/array space (maximum 180000)
    97 verbs (maximum 255)             336 dictionary entries (maximum 2000)
   180 grammar lines (version 2)       254 grammar tokens (unlimited)
   101 actions (maximum 200)            38 attributes (maximum 56)
    40 common props (maximum 256)       19 individual props (unlimited)
112366 characters used in text       87988 bytes compressed (rate 0.783)
     0 abbreviations (maximum 64)     2925 routines (unlimited)
 70678 instructions of code          39972 sequence points
108800 bytes writable memory used   503808 bytes read-only memory used
612608 bytes used in machine    1073129216 bytes free in machine
Compiled with 8 errors and 1685 suppressed warnings (no output)
Completed in 0 seconds

Compiler finished with code 1
! ----------------------------------------------------------------------------------------------------
! Rules in rulebook: Every turn (B8_every_turn)
! ----------------------------------------------------------------------------------------------------
! Rule 1/1 ! Every turn when outputting channels ( this is the add banner channel rule ):
! ----------------------------------------------------------------------------------------------------
! From "Quixe Channels Banner" by David Cornelson
! No specific request
! Every turn when outputting channels ( this is the add banner channel rule ):
[ R_839 ;
    if ((((((is_fyrevm)))))) { ! Runs only while condition holds
    if (debug_rules) DB_Rule(R_839, 839);
    ! [1: select the banner channel]
    if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_BANNER); else print "** Banner channel ON **^";
    ! [2: say ~{ storyTitle: [quotation mark][story title][quotation mark], storyHeadline: [quotation mark][story headline][quotation mark], storyAuthor: [quotation mark][story author][quotation mark], storyCreationYear: [quotation mark][story creation year][quotation mark], releaseNumber: [quotation mark][release number][quotation mark], serialNumber: [quotation mark][story serial number][quotation mark], inform7Build: [quotation mark][I7 version number][quotation mark], inform6Library: [quotation mark][I7 library number][quotation mark] }~]
    say__p=1;ParaContent(); print "{ storyTitle: ";ParaContent(); print "~";ParaContent(); print (TEXT_TY_Say) TX_L_2;ParaContent(); print "~";ParaContent(); print ", storyHeadline: ";ParaContent(); print "~";ParaContent(); print (TEXT_TY_Say) TX_L_3;ParaContent(); print "~";ParaContent(); print ", storyAuthor: ";ParaContent(); print "~";ParaContent(); print (TEXT_TY_Say) TX_L_4;ParaContent(); print "~";ParaContent(); print ", storyCreationYear: ";ParaContent(); print "~";ParaContent(); print (say__n=2015);ParaContent(); print "~";ParaContent(); print ", releaseNumber: ";ParaContent(); print "~";ParaContent(); print (say__n=1);ParaContent(); print "~";ParaContent(); print ", serialNumber: ";ParaContent(); print "~";ParaContent(); for (i=0 : i<6 : i++) print (char) ROM_GAMESERIAL->i;ParaContent(); print "~";ParaContent(); print ", inform7Build: ";ParaContent(); print "~";ParaContent(); print (PrintI6Text) NI_BUILD_COUNT;ParaContent(); print "~";ParaContent(); print ", inform6Library: ";ParaContent(); print "~";ParaContent(); print (PrintI6Text) LibRelease;ParaContent(); print "~";ParaContent(); print " }"; .L_Say3; .L_SayX3;
    ! [3: select the main channel]
    if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MAIN); else print "** Main Channel ON **";
    } else if (debug_rules > 1) DB_Rule(R_839, 839, 'context');
    rfalse;
];

Yeessss. In that line of code, “i” is a local variable. This will not compile in a function where “i” has not been defined.

You could define your own function for this purpose:

To say story serial number: (- PrintSerialNumber(); -).
Include (-
[ PrintSerialNumber i;
    for (i=0 : i<6 : i++) print (char) ROM_GAMESERIAL->i;
];
-).

The built-in VM_Describe_Release() function already does this plus the release number.