Here’s the relevant code from my game intro:
This works as expected in the local HTML TADS interpreter, and the articles in the manual seem to indicate that I’m doing it correctly. But it doesn’t work in either Firefox or Chrome. In HTML TADS, pressing the spacebar clears the screen and the game starts – but in the browser, the spacebar is not being read, so the game intro hangs.
I’m hosting the game on my own (remote) server. It has been working up to now, in my trial runs. But now that I’ve added this bit to the intro – game, she not happy.
Has anyone else run into this? Do I need to add a line in order to sense some particular keystroke?
This is a bug in 3.1.3. This was actually fixed, but since MJR never released 3.1.4, the only way to get the fix is to copy over the updated files from the “next” branch of frobtads. It’s a bit tricky to consolidate all the files in the manner the Workbench expects them, so I’ve put together all the files in a zip:
tads3lib-3.1.4-snapshot.zip (1.6 MB)
I’m not sure how safe it is to copy all the files over and overwrite the existing ones, so make a backup of your current Workbench install folder, because these files contain the 3.1.4 prerelease versions of both adv3 and system headers.
The documented changes are the following. However, there very well could be other changes that have not been documented:
The parser no longer announces the selected object for an indefinite noun phrase if the noun phrase only matches one in-scope object to start with.
If a Room object didn’t provide a definition for either ‘name’ or ‘roomName’, printing the room description (by traveling into the room, LOOK, etc) triggered a stack overflow error. The error occurred because the definitions of these properties inherited from the library reference each other circularly, resulting in infinite recursion if a Room instance didn’t override one or the other. The library essentially requires each Room to override at least one of the two properties, but the stack overflow wasn’t helpful when both were omitted, so the library now checks for this case and simply returns an empty string for each when neither is overridden.
The NumberedDial class now checks that number settings provided in player commands are in range for an integer, and treats out-of-range values the same as any other invalid input. In the past, the class tried to convert anything that looked like a sequence of digits to integer, so players could trigger a numeric overflow run-time error by entering a really large number in a SET DIAL TO VALUE command.
The PAUSE command didn’t work properly in Web games. The command was incorrectly waiting for input from the local keyboard (via inputKey()) rather than from the network (via inputManager.getKey()). This is now fixed.
I’ve downloaded the files in your zip folder – thanks for that. Looking through the contents, I find some differences in the contents of a couple of folders between what I already have and what your download contains, so I’m a bit unsure whether to just tuck individual files from your download into the suitable places, or whether to replace entire folders with your folders.
Bear in mind, I’m using adv3Lite, so in your documentation, most everything is irrelevant to me. The only thing I care about is the webUI.
Here’s the puzzle, though. When I search my entire project for either inputKey or inputManager.getKey, neither of those character strings appears anywhere at all. In the inputManager object there is indeed a getKey method, and it doesn’t appear to be called from anywhere at all. And since inputKey is not anywhere in the project files, I’m not quite sure how what you’re describing could be the source of the problem.
Or rather, it could be, but I’d think I would have to actually compile the compiler in order to fix the problem, and of course I’m not capable of doing that.
I suspect that what you’re saying is that the bug is in a header file – and it appears the headers are not searched when searching the entire project in Workbench, because they’re included using #include statements.
inputKey is defined in tadsio.h, but it’s not doing anything there. It’s just being declared.
In sum, I’m very unsure what I need to replace. Can you help me understand this?
I’d say make a backup copy of the workbench installation folder and then copy the contents of the zip into it. When windows asks, tell it to override all files. See if everything still works after that.
Workbench compiles successfully using the new files. However, the browser version of the game has the same problem as before. This might be because Workbench is accessing portions of the library elsewhere than C:\Program Files (x86\TADS 3, but I’m not entirely sure how that would happen. In the Workbench Options window, I see that both Extensions and Library Paths point to folders in Users/Jim/Documents/TADS 3, but neither of those folders appears (as far as I can see) to duplicate the material in Program Files (x86).
Possibly I’m still misunderstanding something, but I’m doing the best I can.
I had a look at adv3LiteWeb.tl, but I don’t see that it references anything relevant. Neither the input file nor the menuweb file (both of which are referenced here) seems to have inputKey() in it. I’ll keep searching, though.
Sorry, I confused the
PAUSE command with
inputManager.getKey(); work? It will not print anything, but does it work when it comes to just pausing and waiting for a key press?
Yes! That seems to work. I changed that line, compiled for the web, uploaded the game to my server, and ran it in Firefox. Hitting the spacebar now clears the screen and the game begins.
FYI, the reason I’m doing this is because the game takes a light-hearted, whimsical approach to the topic of abduction and rape. At a certain point I realized that I really do need to put a trigger warning at the very top of the file, so that people who are disturbed by this topic can decide whether to even read the intro. After reading the trigger warning, they can press the spacebar and start the game.
It seems like an important courtesy, even though a few of the younger, more obnoxious male gamers may find the trigger warning itself objectionable. There’s no help for that.