Best way to handle 'shared' topics between multiple characters

I have a TADS question (Adv) on the best way to handle something.

Say, I have 10 characters and an object - a time machine for example. I want to suggest the time machine as a TOPIC for conversation for any of the 10 characters, but I don’t need to have 10 different responses. Once the topic has been asked, it should be removed from the suggestion list for conversing with any of the characters.

There doesn’t seem to be any shared topics that I can see. It’s all based on actor and actorstates. It seems very repetitive for a large game to have to duplicate ‘shared’ topics for every character.

What is the best way to handle this? Am I missing some short cuts that makes this possible?

Thanks for the help.

3 Likes

I ran into an analogous situation not too long ago. I did briefly chafe at the lack of common topics, but for me the fallback of defining a functionally complete class, then instantiating it under each actor was not too onerous. In particular, while processing needs no specialization, you probably want some way to tailor the dialogue to the actor, unless maybe they’re clones?

Removing the suggested topic is probably a combination of global variable with conditional curiositySatisfied property. This is purely untested, but here’s the lines I’m thinking down:

#define gToldTimeTravel = me.toldTimeTravel

modify me toldTimeTravel = nil;

class SuggestedTimeAskTopic : AskTopic, SuggestedAskTopic @timeMachine
    customResponse = 'Let me tell you all about time travel...'
    topicResponse() {
        "<<if gToldTimeTravel>>As we said, \v<<end>><<customResponse>>";
        gToldTimeTravel = true;
    }
    curiositySatisfied = gToldTimeTravel
;

// then under each appropriate actor/actorstate
//
+ tomsTimeAskTopic : SuggestedTimeAskTopic;

+ marysTimeAskTopic : SuggestedTimeAskTopic;

+ irishJohnsTimeAskTopic : SuggestedTimeAskTopic
    customResponse = 'Sure an I\'ll be tellin\' ye about time travel...'
;

// and so on.  You might even get away with the really terse
+ SuggestedTimeAskTopic;

Yeah, it still requires a per-char instantiation, but not awful, especially to tweak dialogue ‘voice.’

EDIT: changed text response. Boy do I have near-OCD issues. Also, on further review, I would probably change to a gRevealed implementation rather than create a new “global” property as above.

1 Like

One of many ways this pie could be sliced:

    // the under-the-hood part
class GroupAskTopic : PreinitObject
    actors = [ ]
    matchObj = nil
    topicResponse { }
	execute {
		foreach(local ac in actors) {
			local a = new AskTopic;
			a.setSuperclassList([AskTopic, SuggestedAskTopic]);
			a.matchObj = matchObj;
			a.setMethod(&topicResponse,getMethod(&topicResponse));
			a.location = ac;
			ac.addTopic(a);
		}
	}
;

// have to write your own template in a header

    // the usage part
GroupAskTopic @timeMachine
    topicResponse { "\^<<getActor.theName>> gives such and such a response. "; }
    // could even do a switch statement based on getActor if just one or two need to tweak the wording of the response
    actors = [calvin, hobbes, curly, larry, elvis]
;

GroupAskTopic @anotherCommonItem
...
;

I’ve never used SuggestedTopics so you’d have to take care of when to strike it from the list, perhaps with a gRevealed

Also untested, and the getMethod part might not be right…
And you’d have to sophisticate it somewhat if you’re concerned about what ActorStates are involved…

1 Like