More about .SHOWFILE

Right now everything seems to be waiting for everything else. I’m waiting for the printer to finish the manuals, a couple of important emails to be replied to, and various other things that are hanging fire in as many ways, so there isn’t much that amounts to Wintertree news to talk about.

But it’s a great time to describe a few new wrinkles in the command .SHOWFILE (which was added, by the way, after those manuals were already at the printer).

It’s fundamentally a very simple command. You use it like so:

.SHOWFILE something.txt

…and it just includes the contents of that file as if it were normal TableMaster output. Simple enough.

But since I can’t leave well enough alone, there are three new control commands that can be put into that file that’s being included to control how it’s displayed by TableMaster.

Those three are .BEGINSHOW, .HIDESHOW, and .ENDSHOW.

.BEGINSHOW turns showing back on after it’s been suppressed with .HIDESHOW. The file showing process starts with showing on by default. You could put .BEGINSHOW at the beginning of your text file if you wished, though it wouldn’t actually do anything.

To suppress showing the text, use .HIDESHOW. When TableMaster encounters this command, it will continue to read the show file looking for more commands, but it will not print anything until it reaches either a .SHOWFILE command, or close the file when it finds an .ENDSHOW command.

The last command (though actually the first to be added) is .ENDSHOW. It simply means to stop right there, we’re done with this file. TableMaster closes the file and goes on about its normal business. This is particularly handy if you just want to display the first part of a very long file and don’t want to wait for TableMaster to read through a few thousand lines that it’s not going to need.

So if in your NPC description you have both a short summary of a few lines that you want to include in your table output, and a much longer description that you really don’t need to read every time, you can put .ENDSHOW in your text file after the part you want displayed, and TableMaster will just close the file and move on when it gets to .ENDSHOW. If that segment is at the top of the file, you’re golden.

If the part you want to print is a bit further down the text file, you’ll want to have .HIDESHOW as the first line in that file, then .BEGINSHOW before the first line you actually want to print, and of course .ENDSHOW after it.

You can have multiple hidden/unhidden sections in a file. Just use .BEGINSHOW and .HIDESHOW (or .ENDSHOW, for the last one) to designate the sections you want shown. For example, here’s something I was using as a test file:

this is test text
this is more test text
this should not be printed
this should not be printed either
this should be printed
and this should be printed
but this should not be

You can use these commands in a normal .tbl file, too, if you have a need to; they’re all equivalent to .DO NOTHING. That way, you could have, say, a table with comments in it that would be displayed by another table — perhaps one that is also calling it as an .INCLUDE file — by surrounding them with .BEGINSHOW/.HIDESHOW commands.

Of course, most of the time you probably won’t need any of these commands, or at most maybe .ENDSHOW, to use .SHOWFILE quite effectively. But if you need them, they’re there.

Hmmm … it seems that TBL is getting contagious: now we have its commands creeping into other files!