Learning TADs, Guides only getting me so far!

Hello, first off I apollogise if this is already on here, but I’ve just started to use TADS and I’m starting off by just getting a feel for it by making a simple game but trying to implent as many of the usual/common sort of actions that you would expect to find in any game. I’m following Eric’s guide but it’s only working to a certain degree and trying to search on google for the specific thing you are looking for is like a needle in a haystack.
So basically the game is just for me to get a feel and will not be released or anything, just I spent few months playing with Inform7 and now I’m trying TADS to see which I prefer. The story is just a simple objects lying around in places and you finding them and doing what is neccessary to aquire them. The PC is getting ready for football match and needs to gather the things.
I need some help with trying to get a wardrobe to open so that when you examine it, it reveals the shinpads, here is what I have so far:

[code]wardrobe: ComplexContainer, Immovable ‘large wardrobe’ ‘wardrobe’ @startroom
"Your wardrobe, you’ve had it longer than you can remember but it is still standing strong. You usually keep your school stuff in there like your bag, books, shirt etc. "
subContainer: ComplexComponent, OpenableContainer { }
;

  • ContainerDoor, Component ‘wardrobe door*doors’ ‘wardrobe door’
    ;

+shinpads: Hidden, Wearable ‘shinpads shinguards’ ‘Shinpads’
"These are your shinpads which are always a neccessity when playing against your mates, after all there is no refferee, so the rules are very limited and legs do go flying into tackles. So always best to be safe. "[/code]
Trying to hide the shinpads in the wardrobe is always going wrong in that the PC doesn’t even need to open the wardrobe to see them or get them. Any helps appreciated.

I’m still learning myself. Wouldn’t the syntax be:

If I understand the syntax you’re using correctly, the second + would nest the shinpads INSIDE the wardrobe, where as right now they’re in the room WITH the wardrobe?

You can make the wardrobe inherit from ‘Openable’ and ‘Container’. Or from ‘OpenableContainer’, which does the same thing.

Take a look in objects.t (in the adv3 directory.)

In “Learning T3” there’s a good section on complex containers, starting on page 83. This is one of the more convoluted concepts in T3, so reading that section with care would be very useful.

I’m using adv3lite at the moment, so my adv3 is a little rusty, but I notice that you’re using the + notation for containment without specifying a subLocation for the shinpads object. That may be the root of your difficulty.

And welcome to TADS! It’s not the easiest IF programming system around, but in my opinion it’s the most powerful. Closely related is the new adv3Lite library by Eric Eve. This uses the TADS programming language and compiler, but substitutes a simpler set of classes and slightly different templates and macros. It also adds several desirable features of Inform 7, such as scenes and regions. Adv3Lite code is a bit different from adv3 code, so you can’t mix and match. But you might find it worth checking out.

Huh, look, a moderation queue. By the time my post arrives it’ll be clear that other people understand this much better than I do. :wink:

You don’t need to make the shinpads Hidden, since they won’t be visible until the wardrobe is opened in any case, but as Jim says you do need to make them start out in the wardrobe’s subContainer, so what you need is something like this:

+ shinpads: Wearable 'shinpads shinguards' 'shinpads'
    "These are your shinpads which are always a neccessity when playing against your mates, after all there is no refferee, so the rules are very limited and legs do go flying into tackles. So always best to be safe. "
  
   subLocation = &subContainer
;

Thanks Jim, Eric and RealNC. You were right Jim I wasn’t reading that section carefully enough I see it now.
I spent nearly 10 minutes wondering why I couldn’t get it to go and why it kept bringing me to a line I was certain was right because I had followed the simplest part of the guide, only to find I had given a bedroom the class of “Toom” instead of “Room”. I was ready to smash my head off the desk and then I went on to read about complex containers and didn’t give it full attention.
But thank you!

Sorry agian if this is already on here. This is displayed when playing the game:

x bag
Your sports bag is where you dump all your crap needed such as your kit, boots and ball, etc. It’s open, and contains a football, some shinpads, a deodorant can, and a pair of gloves.

Now, I would like to remove the “a” before the object “a deodorant can”, I only added the can to deodorant so it didn’t say “a deodorant” and sound stupid. So I’m curious to know can I do it and is it listed in the Learning TADS guide. I thought it would have been located around the guide to plural objects, but if it is I haven’t seen it.
Thanks.

Method 1: define isQualifiedName on the deodorant can as true; this will suppress the use of articles with this object.

Method 2: define the aName property of the deodorant can to whatever you want (e.g. ‘deodorant’ or ‘deodorant can’).

Method 3: define the isMassNoun property of the deodorant can as true (this some result in ‘some deodorant’ if you named the object ‘deodorent’).

These all have slightly different effects. Use Method 2 if you want to see the deodorant referred to as ‘deodorant’ instead of ‘a deodorant’ but you want to retain ‘the deodorant’ in contexts where the definite article is appropriate. Use Method 1 to suppress both the definite and the indefinite articles (‘the’ and ‘a’). Use Method 3 to give ‘some deodorant’ and ‘the deodorant’.

I’ve had a problem trying to get the initial description to work for objects. I know it’s possibly going to be something simple, but after 3 hours yesterday I gave up trying to work it and had to settle for this just to get it to work like I wanted:

[code]washbasket: Container ‘washing wash laundry basket’ ‘washing basket’ @bathroom
isListed = nil
dobjFor(Examine)
{
action()
{
if(clothes.discovered)
"The washing basket is where you put your dirty clothes. ";
else
{
clothes.discover();
"The washing basket is where you put your dirty clothes. You think your shorts might be in there. ";
}
}
}
;

+clothes: Thing, Hidden, CustomImmovable ‘dirty laundry/clothes’ ‘dirty clothes’
"These clothes are here in the washing basket waiting for your mum to collect them and take them to the kitchen to be washed. "[/code]
I wanted the inital description to say "The washing basket is where you put your dirty clothes. You think your shorts might be in there. " when you first examined it and then to say "The washing basket is where you put your dirty clothes. " when you examined it from then on or would that be the special desc? I tried to sort it out, but nada! so settled for making clothes hidden, which worked, but not the funtion I wanted to use.
Thanks to anyone!

Did you try this?

"The washing basket is where you put your dirty clothes.<<one of>> You think your shorts might be in there.<<or>><<stopping>> "

Perhaps what you’re looking for is something like this:

washbasket: Container 'washing wash laundry basket' 'washing basket' @bathroom
    "The washing basket is where you put your dirty clothes. <<unless described>>You think your shorts might be in 
     there<<else>>The washing basket is where you put your dirty clothes. <<end>> "
      
    isListed = nil // Do you actually need this?
   
;

But Jim’s solution, which appeared while I was typing this, would work just as well.

Thanks again Jim and Eric.
The first basic TADS guide I read had, isListed = nil, as the way to hide an object so that it doesn’t say " The washing basket is here, The washing basket contains clothes." at the bottom of the room description. For me personally I don’t like playing through games where the objects are clearly put in your face so you know what your doing and it really feels like the interaction is removed.
I prefer reading the room descriptions and examining objects listed e.g. the washing basket is mentioned in the description of the bathroom when you walk in and when examining it you find there is clothes inside, then you think about why its listed? Do I search? Do I look under? Do I take? That sort of thing.
So because I prefer playing games like that I’d rather create one like that. I’m just fiddling around with a practice project just trying to implement what I’ve read in the guides to get a feel for TADS.
Also is the “<< >>” function listed in the learning TADS guide? So far I’ve just read about creating rooms and objects as they are the foundation and then when I feel I’ve got the jist, I’ll look at NPC’s and then actions? Or would you recommend trying NPC’s and actions together? Or is that too much at once?

This is an understandable desire – indeed, I like having a game’s output read well! But you need to be careful. In this particular case, your washbasket object is portable. The player can pick it up and carry it somewhere else. So at the very least, your room description needs to test whether the basket is actually present, as the text will need to be altered. And then, if the player sets the washbasket down in a different room, it will effectively disappear from the transcript, because you have isListed=nil. A more flexible approach might be:

isListed = (getOutermostRoom() != bathroom)

…but the bathroom’s description will also still need to be modified.

I was going to just use the nonportable function on the washing basket, like I have for the clothes inside it, so when PC tries to take it

cannotTakeMsg = 'You best just leave the basket where it is, your mum gets annoyed when things are not where she has left them.' Also I’ll stop them from moving it as well of course, but thanks.
As there are a few items which I have isListed = nil and so by using the code you have given, would that then mean once those items have been moved and dropped in a new location that it will then appear as listed in the new location?
If so I don’t have any problems with once it’s found and been moved it being listed. So thank you very much!

You can use ‘initDesc’ for this:

initDesc = "The washing basket is where you put your dirty clothes. You think your shorts
           might be in there. "
desc = "The washing basket is where you put your dirty clothes. "
isInInitState = (!described)

(You can get that information from the thing.t comments.)

However, when in doubt, you can always code it manually by implementing ‘desc’ as a method:

desc()
{
    if (!described) {
        "The washing basket is where you put your dirty clothes. You think your shorts might
        be in there. ";
    } else {
        "The washing basket is where you put your dirty clothes. "
    }
}

Which IMO is actually cleaner and easier to understand.

I had it exactly like that and when I went to go through it I got this:

x washing basket
The washing basket is where you put your dirty clothes. You think your shorts might be in there. The washing basket is where you put your dirty clothes.
The washing basket is where you put your dirty clothes. You think your shorts might be in there.

After just over 3 hours trying to find where I messed it up, I then spent 10-15 minutes flicking through google trying to find something before I decided to post here asking for advice as by that point it was 2:24am and I was completely ruined.