Printing the character from an ascii number

If I have a number in a variable, can Inform print the ascii character of that number?

I searched my docs high and low for this but the word ‘ascii’ only appears once in all the Inform 7 built in Docs.

I’m trying to stick my hand into the data of Mark Tilford’s Automap and draw the map myself using an I7 routine, dispensing with his I6 routine. The reason for this is that I can send my own automap to any window I like, whereas the native automap is drawn directly into the status window.


  • Wade

That’s because Inform doesn’t use ASCII, it uses ZSCII. A search for the text “zscii” revealed this:

If you really want ASCII and not ZSCII, you might need a conversion table. But if my guess is correct that the values 0-127 are the same in both, you’re probably fine.

To say character number (N - a number): (- print (char) {N}; -)

The nitpick is that ASCII only defines values 0-127. Everything beyond that is non-ASCII.

Z-code uses ZSCII; Glulx uses Unicode. Both agree on values 32-127. (Don’t print control characters, except for newline.)

This is safer all around:

To decide what Unicode character is Unicode char number (N - a number): (- {N} -).

When printing Unicode characters, you get the same result on both platforms.

Thanks, Zarf! I like the way I7 does typecasting, but I forget to use it sometimes.

Thanks for the info guys.

  • Wade