TADS Programming (1) Sent in by The Grue! The problem with using an adventure writing utility is that quite often the manual doesn't give enough information or the information is explained in a manner too technical for a lot of users. TADS is a brilliant adventure writing utility but the manual is pathetic, having said that I'm progressing nicely with the conversion of my game, even though I couldn't be described as @+intelligent! (No laughing, Sue) ~ The problem I had with a particular part of my game was not due to the manual or my understanding of it. The problem was a puzzle in my game which didn't fit neatly into any of the object classes that TADS uses. This, hopefully, is a simple explanation of how I got around my problem, whether it is the correct way or the neatest is another matter but it works. The particular puzzle involves a coffin that the player needs to enter at a particular location. If they have done other things in the game correctly the coffin and the player will then be transported to another area of the game. At first I thought I could just make the coffin a Vehicle but the vehicle class comes under a nested room. If I did this the player would be able to get in and out of the coffin but would not be able to carry or move it around. Also being a nested room the player would get the description of the main room from inside the coffin. The easy way out was to make the coffin too heavy for the player to lift or move and put it in the location where it and the player would later be transported from. For some reason I preferred my original idea and like most adventurers I couldn't resist the challenge. As it turned out the solution was fairly simple, I invented 3 coffins! Below is the code and explanation of the problem. Coffin 1 is the one the player finds in the game. I made this a general item so they could carry it and move it around, also made it openable so they could open and close it as you would with a coffin. The short description is `coffin` and when the player finds the coffin it is closed `isopen = nil`. It also has two long descriptions depending if the coffin is open or closed and its starting location is the Storage room. Up to now the player can move the coffin around, open and close it. Now we have to allow for the player entering the coffin. If the coffin is closed tell the player he will have to open it, then if he is carrying it, tell him he will have to drop it. Once the coffin is open and not being carried we can move the player inside the coffin, which in reality is a separate room. We print a message saying that he climbs into the coffin and then move the player into the `insidecoffin` location and do a lookaround so the location is described to the player. Because the insidecoffin location is a separate room we will not allow the player to put any other objects into coffin 1. coffin1 :item,openable sdesc = "coffin" isopen = nil ldesc = { if (self.isopen=nil){"There is nothing elaborate about this coffin.";} else {"There is nothing elaborate about this coffin. It still awaits an occupant but it is well made and would undoubtably stand up to the test of time";} } noun = 'coffin' location = storage verDoEnter (Me) ={} doEnter (Me) = { if (self.isopen=nil){"You'll have to open the coffin first.";} else if (self.location = Me) {"You'll have to drop it first.";} else {"You climb into the coffin\b";Me.moveInto(insidecoffin); insidecoffin.lookAround(true);} } ioPutIn (Me,do)={"I don't really think you should put that in the coffin.";} ; Coffin 2 is a dummy coffin. We need to do this otherwise if the player tries to refer to the coffin (the first one) the game will respond with things like, you don't see a coffin here etc. This second coffin is made a fixeditem so that it remains invisible to the player and we put it in the location insidecoffin. Coffin2 is also openable and starts off being open, obviously as coffin1 must have been open for the player to be inside the coffin. Now when the player is inside the coffin he can open and close it and refer to it as if it were still the coffin he entered. We also have to do one last thing with coffin2, we print a better message telling him he can't take the coffin if he is inside it. coffin2 : fixeditem,openable sdesc = "coffin" ldesc = "It's not very comfortable but if you're dead then it's not really going to matter." isopen = true noun = 'coffin' location = insidecoffin doTake (Me) ={ "Take the coffin from in here? That would be a good trick!";} ; Coffin3 is the location `insidecoffin` all we have to do here is allow for when the player tries to leave the coffin and make sure he ends up at whatever location the moveable coffin is (coffin1). First if the player has closed the dummy coffin (coffin2) when he is inside the coffin, tell them they will have to open it first. Else if the dummy coffin (coffin2) is open, send them back to the location of coffin1. insidecoffin :room sdesc = "Inside coffin" ldesc = "A perfect fit, although it's not very comfortable!" noun = 'coffin' out ={ if (coffin2.isopen = nil) {"You'll have to open the coffin first.\b"; return(insidecoffin);} else{"You climb back out of the coffin\b"; return(coffin1.location); } } ; This might seem a bit long winded but it works! What we have now is a coffin that the player can pick up and move around, they can then drop it and enter it. Once inside they can also open and close the coffin and when they get out of the coffin they will be in the same location where they dropped it. It also means that if they have done other things correctly the coffin can be transported to another area of the game, whilst they are inside it. Then if the player gets out of the coffin they will find they have been moved also. As I said near the beginning I'm not intelligent, so I have a request for help with TADS. If anyone knows how to change the screens colors on TADS or knows a bit about C or some other of those crazy languages can write a little routine to do this for me. I'd be very VERY grateful. In Frobs We Trust The Grue!