Adv3 Lite "Creating Things" Stack/English.t

I’m working with Adv3 Lite or trying to, and a problem I keep encountering is when I try to create things, I get a stack error message, which points to a place in english.t. At first I thought maybe I had modified the file accidentally and tried to reinstall adv3 Lite, but I still get the problem.

Then I thought it’s related to my ‘thing’ so I tried to copy and paste a thing from an example changing only the location and I get the same following problem even though the Debug Log comes up fine.

Step 1. I write the code for the black crystal using the same structure as redball “Learning Tads 3”, the only thing I haven’t done is desc. there is no ; separating, because when I do that the entire thing shows up blank.

BlackCrystal: Thing
    vocab = 'black crystal; glowing black crystal'
    desc = "The small crystal glows black."
    location = Cavern
;

vs.

redBall: Thing
   vocab = 'red ball; small red hard round cricket'
   location = frontLawn
   desc = "It's quite small and hard; it looks much like a cricket ball. "
;

Step 2. I Press F5 to run the game. The game debug’s successfully, however english.t & stack file opens up, and the game either displays the object or it doesn’t. It points me to this in the stack file:

BlackCrystal.aNameFrom('black crystal') + 0x50 [b]<---Points out this line with yellow marker[/b]
BlackCrystal.aName() + 0x12
inventoryLister.listName(BlackCrystal) + 0xE
func#64f08(BlackCrystal) + 0x19
List [[BlackCrystal]].mapAll(obj#ca44 (AnonFuncPtr))
inventoryLister.showList([BlackCrystal], nil, 0) + 0x24
inventoryLister.show([BlackCrystal], 0, true) + 0x77
inventoryLister.show([BlackCrystal], 0) + 0x23
Inventory.execAction(obj#cabb (Command)) + 0x98
Inventory.execAction(obj#cabb (Command)) + 0xF
Inventory.execCycle(obj#cabb (Command)) + 0x98
Inventory.exec(obj#cabb (Command)) + 0x3F
default1Doer.execAction(obj#cabb (Command)) + 0x13
default1Doer.exec(obj#cabb (Command)) + 0x56
Command [cabb].execDoer([Inventory]) + 0x89
Command [cabb].execIter([Inventory]) + 0xF
Command [cabb].exec() + 0xD0
Parser.parse('i') + 0x422
mainCommandLoop() + 0x72
runGame(true) + 0x37
gameMain.newGame() + 0x35
mainCommon(&newGame) + 0x41

Step 3. In the game window I check to see if it’s the object is there, it appears to be there. It’s there with this particular code, I take the ‘crystal’ and it says “Taken”, I type i for inventory, the game window displays: "You are carrying " and brings me back to the english.t file, and points out this bit of code:

[code] /*
* if the first word is in our special-case list, use the special
* case handling
*/
local sc;
if (rexMatch(firstWordPat, str) //<–Red Marker starts here
&& (sc = specialAOrAn[rexGroup(1)[3]]) != nil)
return (sc == 1 ? 'a ’ : 'an ') + str;

        /* get the first character of the name */
        firstChar = inStr.substr(1, 1);

[/code]

Step 4. I repeat the steps, I check my inventory before I pick up the object, no crash, after, crash. I try different ways of creating the object: Thing, I add (:wink: I remove (:wink: in desc section, I add (.) and remove (.) in the description .

I even copy and paste from the Tads 3 Lite book (as maybe I have forgotten a comma or a period, putting in a period or removing it in the sentence effects whether it displays or not), no matter what I do, I still have this issue.

Step 5. I F5 again while the game is still running and it shows what’s in my inventory, and it shows what’s in the room. Making me think my code is fine, but I have to F5 it twice while the game window is still open before it shows.

I realize then the program is stopping in two places in the room: "You can see a " ,

and when you type inventory: “You are carrying a…”

It’s the first time I’ve struggled with creating an object using Tads 3; I am familiar with creating them using the regular adv3 library. I’m not sure what I’m doing wrong with the lite version.

I don’t know that this is the source of the problem, but it looks suspicious. You’ve repeated the noun (crystal) after the semicolon. Eric’s example repeats the adjective, but it doesn’t repeat the noun (ball). Try deleting “crystal” from the second part of vocab.

No, that’s not it. When I copy your code into my test game, it works perfectly without changes (other than the name of the location, which I changed to my room name).

So it’s something else in your code that’s causing the hangup.

I can offer only one question (probably irrelevant): You say you’re learning adv3Lite. You are using the adv3Lite Library, right? Near the top of the Project pane in Workbench, it says “adv3Lite Library” in the Source Files area.

Thanks! I am going to attach my entire code here:

Where I keep all my objects, classes, and main code. Game.t



gameMain: GameMainDef
    initialPlayerChar = me
;


//////////////////////////////////////////////OBJECTS//////////////////////////////


BlackCrystal: Thing
    vocab = 'black crystal; glowing black crystal'
    desc = "The small crystal glows black."
    location = AbyssRoom  
;

/////////////////////////////////////////////////////////////CLASSES///////////////////////



class RobotPeople: Actor

    isHer = true
    cannotEatMsg = 'You attempt to eat MK, your teeth crack.'
    cannotAttackMsg  = 'You throw a kick at MK, she smacks you in the face.'
    kissResponseMsg
        {         
            return noKiss.getNextValue; 
        }

    noKiss : ShuffledList
    {
                valueList =
                [ //would like to add some sort of ParamName or variable where She/Her is
                    'Mk raises a brow and moves away from you. ',
                    'Mk turns her head as you reach in to kiss air.',
                    'You reach into kiss her and she moves away.',
                    'There is a serpentine glint in her eyes, on second thought you think maybe not.'
                ]

            ;
    }
;

////////////////////////////////////////////////MK/////////////////////
mk: RobotPeople 'MK; young female robot; woman; her' @Precipice
    "Young female robot"
;   

    + mkStanding: ActorState
        isInitState = true
        specialDesc = "Mk sits here humming quietly to herself. "
        stateDesc = " sits here, humming quitely to herself "
    ;

    + mkWalking: ActorState
        specialDesc = "Mk is walking briskly towards the swamp. "
        stateDesc = "She's walking briskly towards the swamp. "
    ;


And here are is room where it starts (all the rest of the rooms have no objects in them they’re just basic rooms):

    
AbyssRoom: Room 'The Abyss'
    "Cloud and smoke surrounds you. <b>Go down.</b>"
    down = Precipice

;

+ me: Thing 'you'     
    isFixed = true       
    person = 2  // change to 1 for a first-person game
    contType = Carrier    
;

I’m currently in the process of moving most of my code from the Adv3 library into the adv3 lite library so I’m just exploring and building items and trying to learn how to do things in it, so it’s pretty much an empty space with 2 objects and a few rooms.

In Adv3 Lite the problem began when I added the crystal, the only thing I can think of is code elsewhere but then I reinstalled Adv3Lite so not sure. The file (with some adjustments) run fine in Adv3 Regular, so I’m not sure what I’m doing wrong with Lite.

I also took your suggestion and removed the second ‘crystal’ but then I get the same problem. Another thing I thought was english.t was broken but I redownloaded english.t so still not sure what I’ve done (I haven’t changed any library files with adv3 lite)

Are you saying you haven’t changed (edited) any of the library files that are in (that is, part of) adv3Lite? I think that’s what you’re saying.

I don’t see anything in your code that should cause a problem like this. I’ll do some more testing. Can you post a transcript of the output, so we can see what the problematical output looks like?

When I test your code, it works fine for me. Are you using Workbench, or are you compiling from the command line? What version of adv3Lite are you using? What version of TADS 3?

Thank you Jim! This is the error message that I get (from the stack file), with a yellow marker pointing to the first line.


[b]BlackCrystal.aNameFrom('black crystal') + 0x50<---Points out this line with yellow marker[/b]
BlackCrystal.aName() + 0x12
inventoryLister.listName(BlackCrystal) + 0xE
func#64f08(BlackCrystal) + 0x19
List [[BlackCrystal]].mapAll(obj#ca44 (AnonFuncPtr))
inventoryLister.showList([BlackCrystal], nil, 0) + 0x24
inventoryLister.show([BlackCrystal], 0, true) + 0x77
inventoryLister.show([BlackCrystal], 0) + 0x23
Inventory.execAction(obj#cabb (Command)) + 0x98
Inventory.execAction(obj#cabb (Command)) + 0xF
Inventory.execCycle(obj#cabb (Command)) + 0x98
Inventory.exec(obj#cabb (Command)) + 0x3F
default1Doer.execAction(obj#cabb (Command)) + 0x13
default1Doer.exec(obj#cabb (Command)) + 0x56
Command [cabb].execDoer([Inventory]) + 0x89
Command [cabb].execIter([Inventory]) + 0xF
Command [cabb].exec() + 0xD0
Parser.parse('i') + 0x422
mainCommandLoop() + 0x72
runGame(true) + 0x37
gameMain.newGame() + 0x35
mainCommon(&newGame) + 0x41

In the English.T stack it points here:

   /* 
             *   if the first word is in our special-case list, use the special
             *   case handling 
             */
            local sc;
            if (rexMatch(firstWordPat, str) [b]//<--Red Marker starts here[/b]
                && (sc = specialAOrAn[rexGroup(1)[3]]) != nil)
                return (sc == 1 ? 'a ' : 'an ') + str;

            /* get the first character of the name */
            firstChar = inStr.substr(1, 1);

(Answering Questions)
I am using Adv3 Lite 1.3

The version of Tads 3 I am using is: 3.1.3

I use Tads 3 Workbench and compile from the work bench.

Yes, I’m saying that I have not tampered with any of the library files, and even deleted the adv3 Lite library and reinstalled Adv3 Lite to try again, I run into the same issues.

Aha! I think I’ve figured it out. Open up english.t in Workbench for editing, if it isn’t already open. Do you see a red dot in the left margin by that line? That would be line 1562 (at least in my version of adv3Lite – don’t know if it’s the most current version).

If you see a red dot, that means you’ve set a breakpoint there (maybe accidentally). Click on the red dot to get rid of it. That should solve your problem.

Execution of the game from within Workbench will always stop when a breakpoint is reached. It’s a feature.

Ahhh thank you!!! That worked xD!!! Awesome feature once you realize what it does, ahaaha, thanks so much Jim!