Adding box to first room(beach) - TADS3.1

I’m back! Just when I thought I was really understand this stuff, everything went to pot. The story ran well until I tried to add a box to the first room; which is the beach. I’m having all sorts of problems when I try to add the box. When I comment out all the box code, everything is great. I know that the beach code is a mess right now but I know longer can figure it out. Boy, could I use some code on this!

/*  (Room0001) - The story starts here.  **************************************/

beach: OutdoorRoom 'on the beach' 'on the beach.'
    "This large, formal entryway is slightly intimidating:
    the walls are lined with somber portraits of gray-haired
    men from decades past; a medieval suit of armor towers over a single 
    straight-backed wooden chair. The front door leads back outside to the
    south. A hallway leads north. "
    vocabWords='beach shore ocean'
    
    /*  Room contents lister.  */   
 
    roomContentsLister: roomLister
    {
        /*  Show the prefix/suffix in wide mode.  */
        
        showListPrefixWide(itemCount, pov, parent) { "\^"; }
        showListSuffixWide(itemCount, pov, parent) 
      { 
        " <<itemCount > 1 ? tSel('are', 'were') : tSel('is', 'was')>>
          lying on the rocky sand. "; 
      }        
    }
;
   
/*  Add box to beach.  ********************************************************/
+box:ComplexContainer,Fixture 'large slatted wooden(wood)box*boxes''large
slatted-wood box'
 "The large wooden box, left by from a previous helicopter flight, lies on some
  small rocks. At its top, there is a metal hasp that can unlock or lock the
  box. " 
cannotTakeMessage=(backpack.seen?'The backpack would be a more convenient
container. You would be better off using that instead.':'The box is much to
heavy to lift or carry around.') 
initSpecialDesc="A large slatted-wood box is lying nearby on some small rocks. "
subContainer:ComplexComponent,LockableContainer
{
currentlyLockedMsg='The hasp is at the locked position.'
currentlyUnlockedMsg='The hasp is currently at the unlocked position.' 
dobjFor(Lock) 
{ 
 action()
 { 
  "You twist the hasp, and lock the box shut. ";
  inherited;
 } 
}
dobjFor(Unlock)
{ 
 action()
 { 
  "You turn the hasp, allowing the box to be opened. ";
  inherited;
 }
} 
;

++Component'hasp''hasp'
"A simple hasp that does the job of unlocking and locking the box. "
   dobjFor(Turn){remap = [box.subContainer.isLocked?UnlockAction:
   LockAction,box.subContainer]} 
;  

As people have reminded you before, Ron, if you indent your code properly it will be much easier for you to spot the problems. It looks to me (and “looks” is a loaded word, because it’s hard to see, so it’s possible I’m wrong) as if you need one more closing curly brace to terminate the subContainer property.

Jim;

I honestly don’t know what’s happening when I try to indent my game properly. I have spent at least two weeks starting my coding for this game from scratch. When I look at my game code on my computer, everything looks fine and the indenting and formatting is extremely readable. However, when I post any of the code to this forum, it gets shoved to the left and looks like heck!!!

I have now restarted coding and indenting this game a minimum of three times. Does anyone have any ideas why this is happening? I know I’ve been told about this many times and would surely like to get it right and make everybody happy. Are there any examples around that will show me how the formatting should be done?

RonG

Ron,

Are you using the IDE? Are you writing in a text processor, in Notepad, or such? Are you indenting with TAB characthers, or such? – It’s difficult to answer without some more info.

Conrad.

I’m running Windows XP Professional - SR3. I’m using TADS3.1 WorkBench as my editor. I’m showing line numbers and I am not using any tabbing. My work area in WorkBench is 78 columns wide.

Don’t know what to tell you other than that.

Try this:

  • Turn off word wrap. This will cause your paragraphs to continue off the end of the screen, so you’ll have to either scroll or manually work your line returns.

The machine working your line returns for you I think is jazzing up your indentation.

  • When you work your line returns, carefully work from the top down. I see that some of your code is indented nicely. Do whatever you did there for all of it.

–I just cut and pasted your poorly indented code into my IDE, and working line returns in from the top down, I got this:

+box:ComplexContainer,Fixture 'large slatted wooden(wood)box*boxes''large slatted-wood box' "The large wooden box, left by from a previous helicopter flight, lies on some small rocks. At its top, there is a metal hasp that can unlock or lock the box. " cannotTakeMessage=(backpack.seen?'The backpack would be a more convenient container. You would be better off using that instead.':'The box is much to heavy to lift or carry around.') initSpecialDesc="A large slatted-wood box is lying nearby on some small rocks. " subContainer:ComplexComponent,LockableContainer { currentlyLockedMsg='The hasp is at the locked position.' currentlyUnlockedMsg='The hasp is currently at the unlocked position.' dobjFor(Lock) { action() { "You twist the hasp, and lock the box shut. "; inherited; } } dobjFor(Unlock)

I work in line returns by going to the beginning of an as-yet-un-properly-indented-line and pressing CTRL-BACKSPACE. This jumps me up to the end of the prior line, with the cursor at the join between the lines. Then I press ENTER. This jumps me back down to a new line, indented properly.

But this only works if the line above was properly indented, too. So you have to work from the top down.

I cut and pasted this into the editing window here on intfic by (a) pasting it in and (b) putting in the code tags. I don’t believe it’s important if you paste first and then put in the code tags, or vice versa, or if you type the code / close-code tags in manually, but if the code tags aren’t there intfic will automagically format what you’ve written into human-to-human, paragraph form.

Good luck!

Conrad.

Workbench formats the indenting properly. In fact, it’s “smart” in the sense that if you forget to add a closing parenthesis, bracket, or brace, when you hit Return the input cursor will NOT move to where you think it should. This is a clue that something in your code is wrong.

When you post to the forum, paste your code into the message, then select it, then click the button at the top of the input window that says “Code”. This will cause your code to be displayed as code, and it will be indented the way it is in Workbench.

Thanks many times for all your help. Here’s what I’ve done. I turned off line-counting and word-wrap; set the column width to 80, turned both indenting and auto-tabs to zero. Can’t think of anything else to do right now. I’m going to hang in there and start over again once more. I’m also going to cross my fingers.

Wish me luck,

Rong

btw: I won’t forget all you’ve told me in this group of posts.