NonPortable Problem

Hey,

I’m new to TADs, but not the boards. I used to get Inform 7 help :stuck_out_tongue: Kind of put off by the short comings of text lengths, and inadequate work arounds I figured I’d give TADS a go. I see it’s a bit harder, but I do have minor programming experience, so it looks semi comfortable. The issue I’m having is with an object that I’d like to be NonPortable. For some reason I can still pick it up.

shipPlank: NonPortable, Readable vocabWords = 'plank wood board' name = 'plank' location = beachEnd initSpecialDesc = "A damp-shattered - piece of wood. There\'s something scraweld on it in big letters." readDesc = "The Salvia" cannotTakeMsg = 'There\'s no use in taking the plank.' ;

Thanks for any help,
Jeremy.

Try using Fixture instead of NonPortable. NonPortable is basically a shell used to share basic functionality with Fixture and Immovable.

I hear ya. After some running around I found that. I’ve got a new issue. Can you maybe give me some insight. I’m not sure how to use variables and if statements properly. Also not sure which lines do and don’t get terminators.

The object should have a first time look under description.

[code]shipPlank: Heavy, Readable, Underside
vocabWords = ‘plank wood board’
name = ‘plank’
location = beachEnd
initSpecialDesc = “A damp-shattered - piece of wood. There’s something scraweld on it in big letters.”
readDesc = “The Salvia”
cannotTakeMsg = ‘There’s no use in taking the plank.’
LookUnderAction()
{

    if(not lifted)
    {
        "You lift the plank. You feel a searing pain rip through your mind. Your head pounds. You can see a ship
        rolling on massive storm bearing waves. Men are going to and fro, yelling, trying desperately to get the situation
        under control. You see yourself running for a rope. You near the washboards, as you get closer you edge towards the 
        fleeting rope. A crashing waves rolls over the ship, knocking you into the water.";
        lifted = true
        
    }else{
        
        "You check under the plank.";
    }
}
lifted = nil

;[/code]

for terminators, if the line is a property it doesn’t need the terminator. If it is code then the lines need the terminator. In the code given above, the lifted = true line needs a terminator as that is code in the LookUnderAction function changing the value of the property lifted defined on shipPlank. The lifted = nil line at the end is ok as that is defining the property lifted and it’s starting value on shipPlank.

On a different note, the function LookUnderAction is not going to work as I think you intend it to. I am assuming you want this code to run if the player looks under the plank. The name of that function would be actionDobjLookUnder. I would recommend using the dobjFor macro.

 dobjFor(LookUnder)
    {
        action() {
             if(!lifted)
            {
                 "You lift the plank. You feel a searing pain rip through your mind. Your head pounds. You can see a ship
                 rolling on massive storm bearing waves. Men are going to and fro, yelling, trying desperately to get the situation
                 under control. You see yourself running for a rope. You near the washboards, as you get closer you edge towards the 
                 fleeting rope. A crashing waves rolls over the ship, knocking you into the water.";
                 lifted = true;
            
             }else{
            
                 "You check under the plank.";
             }
         }
     }

I changed other things I saw in the code as well.

Thanks. I was wondering if there was some kind of property I should have been using. Something like if(shipPlank.lookedUnder).

I’m still having issues though. Lifting the plank should reveal a ring that’s underneath. This new set up doesn’t allow for the reveal. I tried using discover(heroRing) but that didn’t work.

Are there any secret coding resources? I’ve been looking through the books a bit. They help. I haven’t gotten to macros.

[code]shipPlank: Heavy, Readable, Underside
vocabWords = ‘plank wood board’
name = ‘plank’
location = beachEnd
initSpecialDesc = “A damp-shattered - piece of wood. There’s something scrawled on it in big letters.”
readDesc = “The Salvia”
cannotTakeMsg = ‘There’s no use in taking the plank.’
dobjFor(LookUnder)
{
action() {

        if(!lifted)
        {
             
            "As you lift the plank a searing pain rips through your fragile mind. Your head pounds, like rolling thunder. You see a 
             ship heaving over massive waves. It rolls back and forth, as men go to and fro. Their yells are unintelligible to
             your incoherent mind. All you can make out in the mess are pleas to nature. A rope begins to uncoil, and make its way 
             overboard. The importance of this rope is overbearing, but why? You aren't sure. You just know the lives of your men 
             depend on it. Fear grips your soul as it continues to uncoil. You near the washboards, getting closer and closer to the 
             edge. You reach for the rope; a crashing wave soaks you. You edge closer. A final zip of the rope jerks it out 
             of reach, just as a crashing wave rolls over the ship. The force of the water sends you over the port side into the cold
             waters below.";

             lifted = true;
     
        
         }else{
        
             "You check under the plank.";
         }
     }
 }

;

heroRing: Thing, Hidden
vocabWords = ‘ring gold ring’
name = ‘golden ring’
location = shipPlank
initSpecialDesc = “A golden ring of some pristine origin. Angelic wings-Outstretching from the sides- shield a white crystalline
stone on the front of it.”

;[/code]

A hack like this is futile:

[code] dobjFor(LookUnder)
{
action() {

        if(!lifted)
        {
             
            "As you lift the plank a searing pain rips through your fragile mind. Your head pounds, like rolling thunder. You see a 
             ship heaving over massive waves. It rolls back and forth, as men go to and fro. Their yells are unintelligible to
             your incoherent mind. All you can make out in the mess are pleas to nature. A rope begins to uncoil, and make its way 
             overboard. The importance of this rope is overbearing, but why? You aren't sure. You just know the lives of your men 
             depend on it. Fear grips your soul as it continues to uncoil. You near the washboards, getting closer and closer to the 
             edge. You reach for the rope; a crashing wave soaks you. You edge closer. A final zip of the rope jerks it out 
             of reach, just as a crashing wave rolls over the ship. The force of the water sends you over the port side into the cold
             waters below.";

            lifted = true;
            heroRing.moveInto(beachEnd);
            discover(heroRing);
     
        
         }else{
        
             "You check under the plank.";
         }
     }
 }

;[/code]

Fixed :slight_smile:


                lifted = true;
                heroRing.moveInto(beachEnd);
                heroRing.discover();

Thanks for the help. Just wondering, is there a good place to learn about all these functions? A good tutorial site pop up with many details?

Thanks again,
Jeremy.

I learned it by reading Eric’s excellent docs, especially “Learning TADS 3.” Going through that will tell you a great deal. Not everything is in there, of course. The articles in the Technical Manual are also a great resource.

As you get deeper into the system, you’ll discover how useful the Library Reference Manual is. It’s not the place to start, however!

The moveInto line shouldn’t be necessary as your ring is a hidden item. Hidden makes the ring invisible till it is discovered. It is under the plank because that is where you placed it. It should be visible after you marked the ring as discovered. Make sure to describe the discovery in the displayed text so the player knows the ring is there.

Like Jim said, the docs are the best source of information. If you would like some source code to look at you can look on the ifarchive for released TADS3 games where the author released the source code as well.

The source for “Mrs. Pepper’s Nasty Secret,” which Eric and I wrote, is available at http://musicwords.net/if/pepper.htm. (Eric wrote the complicated stuff where the cabinets open and close! That’s all way beyond me.)

You can test whatever the ring was discovered: if(!heroRing.discovered) { "Blah, blah. "; heroRing.discover(); }

Thanks for the reply.

I’m finding a new bug with this method. It’s dumb to have a fixture or heavy set to the item, because it can’t be moved. I tried overriding move with the same method as the prior solution, but I still get a message saying the plank can’t be moved.

It doesn’t make sense to have a plank that can be looked under, but not moved…

[code]dobjFor(LookUnder)
{
action() {

        if(!lifted)
        {
             
            "As you lift the plank a searing pain rips through your fragile mind. Your head pounds, like rolling thunder raging 
            across violent seas. You see a ship heaving over massive waves. It rolls back and forth, as men go to and fro trying 
            desperately to save her. Their unintelligible yells make no sense to your incoherent mind. Only their desperate pleas to 
            nature can be made out in the panic stricken turmoil. A rope begins to uncoil, making its way overboard. The importance of this rope is overbearing,
            but why? You aren't sure. You just know the lives of your men-- the safety of your vessel-- depend on it. Fear grips your 
            soul as it continues to uncoil. The emergency bell rings in you ears. You near the washboards, getting closer and closer to the edge. You reach for the rope; a 
            crashing wave soaks you. You edge closer. The tips of your fingers vibrate, as you try to stretch them beyond arm's reach. 
            A final zip of the rope jerks it beyond your grasp. Your heart sinks to the pit of 
            your stomach, just as a crashing wave rolls over the ship. The force of the water sends you over the port side, into the 
            cold dark waters below. Nothingness consumes you.
            
            \n \n
            There was an ornate gold ring under the plank.";

            lifted = true;
            heroRing.moveInto(beachEnd);
            heroRing.discover();
           
         }else{
        
             "You check under the plank, seeing nothing but an indentation where the ring had been forced into the sand. It's now 
             filled with water.";
         }
     }
 }[/code]

There’s no simple way to have a container that can be lifted, looked under, moved, but not taken?

Try adding this to shipPlank:

dobjFor(Move) asDobjFor(LookUnder) dobjFor(Push) asDobjFor(LookUnder) dobjFor(Pull) asDobjFor(LookUnder) This will make Moving, Pushing, and Pulling the plank to be the same as Looking Under the plank.

Thanks, that fixed everything. can you do me a favor? What do these mean?

dobjFor(Move) asDobjFor(LookUnder)

I’m not sure of the acronyms dobjfor, and asDobjFor.

There’s one last thing bugging me about the output for moving the plank. There is a single newline char at the end of the text. Even if I put two there isn’t a space. It just drops that line right under the first paragraph. That’s when just building to test in the Workbench.

[code] "As you lift the plank a searing pain rips through your fragile mind. Your head pounds, like rolling thunder raging
across violent seas. You see a ship heaving over massive waves. It rolls back and forth, as men go to and fro trying
desperately to save her. Their unintelligible yells make no sense to your incoherent mind. Only their desperate pleas to
nature can be made out in the panic stricken turmoil. A rope begins to uncoil, making its way overboard. The importance of this rope is overbearing,
but why? You aren’t sure. Confusion grips you. You just know the lives of your men-- the safety of your vessel-- depend on it. Fear grips your
soul as it continues to uncoil. The emergency bell rings in you ears. You near the washboards, getting closer and closer to the edge. You reach for the rope; a
crashing wave soaks you. You edge closer. The tips of your fingers vibrate, as you try to stretch them beyond arm’s reach.
A final zip of the rope jerks it beyond your grasp. Your heart sinks to the pit of
your stomach, just as a crashing wave rolls over the ship. The force of the water sends you over the port side, into the
cold dark waters below. Nothingness consumes you.

            \n
            There was an ornate gold ring under the plank.";[/code]

Thanks again for all your help. It’s appreciated. Once I get the hang of it I think this will be a bit more promising than Inform on the power side.

asDobjFor is a macro, one of many in T3. So is dobjFor. The way it works is, dobjFor means “direct object for,” so this block of code executes when the verb (in this case LookUnder) is used with the object as its direct object. The asDobjFor macro maps its own action in EVERY case to the second action, so in this case Move will always have the same result as LookUnder.

The canonical way to get a new paragraph is with <.p> rather than \n – this will leave, I believe, a blank line because that’s the IF standard: Paragraphs have no indentation, but are separated by blank lines.

I see. Found /b. not sure I’ll be releasing on the web. Thanks for explaining the macro for me. I know this is turning into an extensive thread, but I can’t figure out how to put a decoration in more than one room. I’m thinking ocean will be south of all beach rooms. I saw room parts, but it doesn’t really fit. It’s not a wall, floor, ceiling, or sky.

The following will put the ocean in one room.

oceanStormPort: Decoration vocabWords = 'ocean sea water' name = 'ocean' desc = "The ocean rages. " location = beachEnd ;

Multiple rooms after commas will place it nowhere.

Thanks again, you guys have been super helpful.

You’re looking for the MultiLoc class. See p. 255 in “Learning TADS 3.” This text refers to MultiLoc as a “mix-in class,” which you need to know about. You can’t use a mix-in class by itself. This class designation must always precede another class declaration – things like MultiLoc, Fixture or MultiLoc, Distant.

Thanks again :slight_smile: You guys are life savers.

Here’s the solution if others need it:

[code]oceanStormPort: MultiLoc, Distant
vocabWords = ‘ocean sea water’
name = ‘ocean’
desc = “The ocean rages.”
locationList = [beachEnd, beach1]

;[/code]

The locationList for the MultiLoc is an array/list. Not sure what’s going on behind the scenes there for data types.

Learning T3 just by reading the docs … I don’t know if I could have done it! Having conversations with others as you learn your way around is essential, I think.

With respect to your code, you can simplify it a bit using the standard template for Thing-derived classes:

oceanStormPort: MultiLoc, Distant 'ocean sea water' 'ocean' "The ocean rages." locationList = [beachEnd, beach1] ;
The point of templates is that they save a bit of typing. When you’re defining a hundred different objects, there’s a lot of typing. I’d suggest, also, thinking about all of the vocabWords a player might try – ‘waves’, ‘raging’, ‘surf’, etc.