Test Chamber is a room.
Include (-
#ifndef TARGET_GLULX;
Message fatalerror "This program is Glulx-only.";
#endif;
Global next_id = 0;
[ GetNextId id;
if (next_id >= 26*26) {
print "*** GetNextId: out of channel identifiers ***^";
next_id = 0;
}
id = ('Z' * $1000000) + ('Z' * $10000) + (('A' + next_id / 26) * $100) + ('A' + next_id % 26);
next_id++;
return id;
];
-).
To decide which number is the next id:
(- GetNextId() -).
When play begins:
repeat with i running from 0 to 100:
say "[the next id] ";
Include (-
[ Extract id n byte;
if (n < 0) n = 0;
if (n > 3) n = 3;
for ( : n >= 0: n-- ) {
byte = id % 256;
id = id / 256;
}
return byte;
];
-).
To decide which Unicode character is char (N - number) in (id - number):
(- Extract({id}, {N}) -).
To decide which text is the string of (id - number):
decide on "[char 3 in id][char 2 in id][char 1 in id][char 0 in id]".
When play begins:
let foo be the next id;
say "[the string of foo]";