Stack problem in TADS 3

I’ve just started learning TADS 3 and have entered the “Goldskull” sample game. However, the compiler accepts it as correct, but when I try to run it it gives a stack overflow error. The text in the stack goes:

startroom.name() + 0xA
startroom.roomName() + 0xD
startroom.name() + 0xD
startroom.roomName() + 0xD
(repeat ad nauseam)
startroom.lookAroundWithinName(me, 3) + 0x17
startroom.statusName(me) + 0x32
statusLine.showStatusLeft() + 0x2D
statusLine.showStatusHtml() + 0x2C
statusLine.showStatusLine() + 0x51
gameMain.newGame() + 0x11
mainCommon(&newGame) + 0x4D
main([‘debug\Starter.t3’]) + 0x1B
flexcall(main, [‘debug\Starter.t3’]) + 0x59
_mainCommon([‘debug\Starter.t3’], nil) + 0x53
_main([‘debug\Starter.t3’]) + 0x12

Most of this means nothing to me. Can anyone tell me what I’m doing wrong? (The text is exactly that of the Goldskull game in the tutorial, except that some location descriptions are slightly different.

Since logging this problem I’ve created a similar test game of my own, and the stack problem didn’t recur - so maybe it was a glitch?

I have worked though most of Eric Eve’s TADS 3 manuals for both the Adv3 and Adv3lite libraries. Generally when the games in his texts do not compile and run, it is due to a typo on my part. Even the smallest error can cause problems.

OK, thanks. Given my further post above, that seems likely to be the problem.

Welcome to TADS! Feel free to shout out any questions whenever you need, I’ll try to find time to answer!

1 Like

Usually a stack overflow error like this means, as fos1 says, that there’s an error lurking in your code. The first few lines in the stack trace you’ve posted shows where the error is located. Somehow, startroom.roomName() is calling startroom.name(), which in turn calls startroom.roomName() again, etc. It’s an endless loop.

I hope you’ll take a look at the adv3Lite library. It’s easier to work with than the adv3 library, and doesn’t limit the author in any way that I’ve noticed. I’ve written a couple of games with it (as well as a game, some years ago, in adv3). Plus, it offers support for certain very handy things (notably regions and scenes) drawn from the Inform 7 world. The main thing to be aware of is that the syntax for declaring a room or an object is slightly different. You can’t simply grab adv3 code and expect it to run in an adv3Lite compile.

1 Like