Main Game code problems - TADS3.1

I received part of this code from bcressey some time back. Now that I’'ve restarted coding my story,
I can’t figure out how to get this to work. I get many errors in the section that actually holds the original ‘intro’ text. I must be fitting something in wrong. Where does the ‘intro’ text actually fit into all this? Help!


gameMain: GameMainDef
/* the initial (and only) player character is 'me' */
   initialPlayerChar = me

 [0, 'a rank beginner'],
 [100, 'a novice explorer'],
 [200, 'an advancing spelunker'],
 [400, 'an anxious learner'],
 [600, 'an apprentice adventurer'],
 [800, 'an experienced searcher'],
 [1000, 'an unquestioned expert']
/* show our introduction */
showIntro() {
"First line of text.<p>"; 
"<i>Press any key to continue.<i>";
"Second line if text.<p>";
"Behold, a work of interactive fiction! ";
    /* show the prologue */
    "\b This is the actual introductory text. Where does it fit in all 

        /* show the game title */
        "<b>The Magic Forest</b>\n
        by Ronald J.\ Gaudet\n
        Release <<versionInfo.version>> (<<versionInfo.serialNum>>)

    /* show our "goodbye" message */
        "<.p>Thanks for playing <i>The Magic Forest</i>!\b";

The semicolon about halfway through your code listing is terminating the gameMain block. The code after that doesn’t belong to a function or object so the compiler will complain.

Your “show the prologue” code chunk is missing a method name and it’s not clear what it should be. showText(), maybe?

The showGoodbye() block has turned into a function (because it’s outside an object definition). That’s probably not what you want since it will never be called. Also the compiler will complain because you’ve redefined an existing method name (gameMain.showGoodbye) as a function (showGoodbye).

You should really pay more attention to formatting. What you’ve posted seems to be randomly indented which makes it almost unreadable. If you’re getting code from multiple sources, it can be a pain to reformat it into your preferred style, but it’s worth doing.

In this case a few tabs would at least show us where you thought the object definition should start and end.

/* the line below tells us what you are trying to define or modify */
gameMain: gameMainDef
    // every property indented four spaces from left margin
    scoreRankTable = ...
    maxScore = ...
    crueltyLevel = ...

    // method names indented four spaces, method body indented eight
    showIntro() {

    showText() {
/* the semicolon above marks the end of the object */

/* some random stuff that doesn't belong here and generates a compiler error */
    /* show the prologue */

    a method name outside of an object definition is a function... 
    ... but you can't have a function with the same name as an existing method
showGoodbye() {

Ron, I don’t know if you’ve ever worked with Inform 7. Perhaps so … because you’re trying to drop chunks of code just anywhere, without putting them in objects. T3 is extremely object-oriented. Your brackets around the show-the-prologue code can’t do anything, because you haven’t created an object there.

I am thoroughly chastised and will stand in a corner for a week. You are all correct, I am terrible at formatting. I keep trying different methods but they all look lousy. My problem is that I’m still not completely sure what objects, chunks, functions and such really are. I’m constantly going through the TADS manuals but my memory is very bad. I will continue to forge forward and to comply with your suggestions.

At any rate, I did figure out my latest mistake. I put all that startup message coding in the wrong location. It should have gone into the ‘new game’ block where my startup menu code is located.

Thanks again for the help and encouragement.