Not in the description and not Hidden?

Here is a very stupid question:

How to have an NPC carry an object without it appearing in its description without being Hidden?

More specifically, I have John, a seller of stolen expensive watches. If you ‘x John’ I don’t want the description to mention that he is carrying expensive watches. But I want you to be able to ‘buy watch’. So I defined a BuyAction but when I try to define a dobjFor(Buy) for the watch like:


  • watch: Hidden ‘watch’ ‘watch’

    canbeBought = true




I get a message that ‘You see no watch here’. How do I override that so that the player can buy the watch?

Ok, I’m guessing the solution is instead of making the watches In John, just place them offstage until I need to move them to my character…

Sorry if it’s that obvious.

Depending on what you want to do with other actions with respect to the watch, as well as with buying other objects, I think there are two approaches to solve this problem.

One is not using the Hidden class but tweaking the isListed() or isListedInContents() method instead. I believe that can achieve not showing the watch when EXAMINE JOHN describes John.

The other is the preCond part of dobjFor(Buy). It seems there is a objVisible precondition for Buy action, though I’m not sure where it came from. If you can make Buy action apply to invisible but in-scope objects, it should work.

I’m not familiar at all with adv3 library though. So take my words with a large grain of salt, and I hope someone with more experiences can help you.

Just out of curiosity, how do you expect the player to know that ‘buy watch’ is a meaningful command, if the player can’t see a watch? Seems to me this is a read-the-author’s-mind puzzle.

You might try tinkering with the isListedInContents() method. Details are in the Library Reference manual, in the description of the Thing class.

I think that it would make more sense to implement “buy” as a synonym for AskFor conversation action where you are asking for a topic. Topic in this sense can be an ordinary object or even some abstract topic. You can ask an actor for an object you can’t see the same way as you can tell about some object you know but don’t see at present time.

Thank you all for your answerd, I’ll try them and tell you if they worked out :slight_smile:

To Jim, it’s not read-the-author-mind. The player obtained the information from other NPC that John sells watches. Pretty much the way it would happen in real life. Moreover, in order for the ‘buy’ action to become available, you need to ‘ask John about watch’ first. I didn’t posted that part of the code because it was irrelevant to my question.

This I have also done :slight_smile:. If you try to ‘buy watch’ without having asked about it first, you are remapped to ‘ask about watch’. Second time, you actually buy the watch.

Ok, so I tried the isListedInContents function in a very simple way

isListedInContents {return false;}

and it doesn’t work. Still when I ‘x John’ I get “John is carrying watches”. Any ideas about this??
Because I have another question now… hehe. Since I wanted to solve this problem no matter what, I thought of doing it dirty. So I did 3 things

1.- I defined a

fakewatch: Hidden, Component 'watch' 'John's watch' "You know John has some expensive watches." ;

carried by John that is discovered when you Ask John explicitly about ‘watch’. Because it is of class Component, it won’t appear explicitly in John’s description.

2.- I dumped a

truewatch: Thing 'my watch' 'your watch' "This is the watch you bought from John." ;
in a room called Alcatraz where I dump things.

3.- I defined the action() for Buy on fakewatch so that it includes:

... truewatch.moveInto(gPlayerChar); ...

Admittedly, this is ugly, but it works. Or almost works as it happens. I’m running into a bug now.
After I buy the watch, if I ‘x watch’, the game of course7 asks, “Which watch do you mean John’s watch or your watch?”. But if I now say ‘x my watch’ I get a

TADS Runtime error

Wrong number of argumets.

Any idea why is this happening??

Hmm, don’t have a clue about your second question (though for RuntimeError a minimized code snippet that reproduce the error always helps), but this one is simple – TADS doesn’t use “false”, the opposite of “true” is “nil”.

Ok thanks!, I thought that boolean variables would be just the same in TADS as in every other programming language. In any case, this doesn’t work either

[code]startRoom: Room ‘Start Room’
"This is the starting room. "

  • me: Actor

  • Dude: Actor ‘dude’ ‘dude’

++ fakewatch: Thing ‘dude’s watch’ ‘watch’

isListedInContents() {return nil;}


If you now ‘x dude’ you will still get “The dude is carryiing a watch”. I don’t understand.

Can confirm that the sample code still generates “The dude is carryiing a watch.” Apparently in adv3 containers and actors are treated separately in this regard, and you need “isListedInInventory” instead.

P.S.: This is actually my first encounter of the frustratingly complex adv3 class hierarchy. I spent like 20 minutes trying to find where the output is actually printed and got nowhere. Had to resort to search “Listed” in class Thing’s propertied and methods to find the solution.

Don’t know how far into your game you are, or how committed you are to the adv3 library, but you might want to take a look at Eric Eve’s adv3lite library now in a late-stage beta release…

It reduces the class complexity, allows far more flexibility in custom messaging, and has a more robust implementation of NPC conversations.

If you’re too far invested in the current game, you might want to at least skim the adv3lite docs before starting your next one.


And this is good or bad in your eyes? You want to buy watch on one command without any negotiation between player and dude? Or another way - can you write example transcript you want from your game? Ideally with whole transaction, hello and goodbye.