.ASKing for a Headache

Those of you who remember the original TableMaster have, no doubt, noticed the absence of the .ASK command in TableMaster II, and its relatives .SCREEN and .CLEARSCREEN. Wonder no more — it’s back, and it’ll be in the next release. (watch the download page) I left it until now because getting it right is actually surprisingly complicated.

A bit of explanation: The original TableMaster was an MS-DOS program. Even TM/Win was really a DOS program wrapped in a Windows shell. That’s why it wouldn’t run on anything later than Win98: it needed a real MS-DOS down there, and all later versions were true operating systems, not just graphical user interfaces on top of MS-DOS. So the TM/Win GUI would run, at least on anything that could deal with 16-bit programs, but not the table engine (GENWIN) itself.

That made .SCREEN, .ASK, etc., very easy: I just sent output to the screen instead of to whatever the output was set to (generally a file) and used a simple read to get the user’s response. Windows makes this hard, because it’s not all that easy to make an event-driven program screech to a stop and wait for a totally different event — in this case, the user entering some data. So, in order to get TableMaster out the door at all, I had to push .ASK so far onto the back burner that it fell right off the stove.

The current version — the one that will be in the next TableMaster release — isn’t final. For instance, .SCREEN can only put out single lines, not complex output like you can do with .PRINT. Generally, that should be enough — 99% of what one uses it for is menus of some sort, like picking the time of day for an encounter. Simple lines of text in the output will be fine for that. But y’all know me by now, “good enough” isn’t good enough, and I have an unearthly compulsion to add just one more feature (usually followed by spending a day debugging the resulting one more bug).

It’s not out yet because I still have to decide how I want to handle text versus numeric input. One possibility is to allow the user to assign the result to either a numeric or text variable, and if numeric, check to see if it’s a valid number; if not, it will either display an error message or set the result to 0. Another is to have two different versions, .ASK and .ASKNUM, that would assign to text or numeric variables respectively. Yet another is to have only text variables, then have another command .NUMBERIZE — used as .NUMBERIZE {textvar} TO {numvar} — to convert text to numbers; this would require a second step in the table, but might be much easier to follow.

Unfortunately, Windows being Windows, the actual .ASK has to go into a dialog box. At least that I’ve found yet, there’s no easy way to have it on the same form as the .SCREEN text. If I have time, though, I’ll add a setting for a “retro” screen, with green text on black, to remind us all of the MS-DOS days.

So, aside from a few commands that I didn’t bother with because nobody ever actually used them (.NEXT and the whole mess with grids, that never even worked anyway), TableMaster II now has everything that the original TableMaster had, and then some. Then a lot, really, as y’all know from reading this blog for the past 16 months.

I know I said this 20 years ago … but I think I’ve run out of things that need to be added. I’m still thinking about a text lookup list feature, but I haven’t yet convinced myself that it’s necessary, or even useful. I’ll probably throw in a few more commands like the aforementioned .NUMBERIZE (even if it turns out not to be necessary). I’m sure one or two little bits will turn up. A lot of things need to be tweaked, improved, given better error handling, extended a bit, etc. But in terms of major additions, I think it’s done.

Of course, that will last until someone says “Why don’t you have….”