un-templating?

Hi guys,

Maybe a silly question, but…
After years of hesitating i finally decided to learn the TADS. Reading through the Getting started guide is a fun ride so far, unfortunately i have encountered a problem. Eric Eve introduces definition templates as soon as possible here, which is probably good idea, but he somewhat disregards the ‘long notation’ in the guide, to the extent of omitting it entirely.
I, for several reasons, decided to use the ‘long notation’ instead of templates and now i’m facing a stopper with the ‘GiveShowTopic’ example Eric presents on page 95.

The code is this:

+ GiveShowTopic @ring "As you hand the ring over to {the burner/him}, his eyes light up in delight and his jaws drop in amazement. <q>You found it!</q> he declares, <q>God bless you, you really found it! Now I can go and call on my sweetheart after all! Thank you, my dear, that's absolutely wonderful!</q>" ;

Which i transcribed to this:

+ GiveShowTopic{ matchObj = ring topicResponse = "As you hand the ring over to {the burner/him}, his eyes light up in delight and his jaws drop in amazement. <q>You found it!</q> he declares, <q>God bless you, you really found it! Now i can go and call on my sweetheart after all! Thank you, my dear, that's absolutely wonderful!</q>" }
But now i can’t find a right property which is represented by the ‘+’ sign. Were it an object, it would be ‘location’ but that doesn’t work, and i couldn’t find anything similar in the library manual description.

So what is the right property name? How to implement this example without using templates?

The plus sign is not part of the template, it’s part of the TADS language.

You use + to attach objects to other objects, including Topics to Actors and ActorStates, whether the objects are defined by templates or not (though there are some alternative ways of locating things; you might want to read Learning T3—or Learning T3Lite depending on which library you’re using—once you’ve gotten your feet wet with Getting Started).

Jerry

Thanks for your answer.

Well, it’s a ‘syntactic shortcut’ of a sort, so i counted it as a template. My bad.

But still, you can use the ‘+’ sign in the item definition, or you can substitute it with a ‘location’ property or with a @location syntax.
I’m curious if something similar exists for a TopicEntry class?

See “Contained objects” at Object Definitions (System Manual).

A quick search in adv3 finds this:

+ property location;

So I think location is always used as the “plus property”.

You can, of course, only use the location property if the item in which you want to locate the TopicEntry has a name; an Actor or ActorState normally does, but ConvNodes and TopicEntries (which may have AltTopics located in them) generally don’t. The @location syntax is simply part of the Thing template, which doesn’t apply to TopicEntries.

Not using the + syntax with TopicEntries is likely to make your code pretty cumbersome if you’re writing NPCs of any complexity.

Uh, well you’re right, simple ‘location = burner’ as a GiveShowTopic property works perfetly well. Although i could have sworn that i tried it before and it segfaulted during runtime…

Most likely. I use it for tutorial purposes: to see the names of properties i’m actually using, and to have a little more thought about the code.

Thanks for the answers, guys.

I have noticed occasional build failures after redefining a Topic object.

(I use the windows Workbench; if you’re getting a segmentation fault, I assume you’re compiling from a command line and maybe the Workbench is failing more gracefully?)

A clean build and a full rebuild for debugging clears it up.

Jerry

I use the workbench too. The thing built well (all semicolons typed correctly :slight_smile: ) but when i encountered the burner and gave him the ring, the program crashed with some message i don’t remember.
But maybe i didn’t try this exact syntax before and my memory fails me, it’s possible too.