intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Apr 19, 2018 10:33 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Random Questions
PostPosted: Wed Nov 23, 2016 1:01 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
Hello,

I figured I'd make another game help thread like I did earlier in the year. I'm getting questions, but don't want multiple threads.
Right now I'm having a problem with output.

You see a satchel (which contains some cooking scrolls) here. On the spice rack are a jar (which contains some thyme spice), a jar (which contains some pikun spice), and a jar (which contains some safrin spice).

does that look weird? are a jar, and then other jars.

I also have to get over disambiguation, but it's kind of confusing to me. Say I want to have the player be able to buy jars of stuff. They could have 10 jars in their inventory. It doesn't make sense to come up with disambiguation names, or names, or different vocab words for every instance. I could change vovabLikelihood on every instance of same named objects to one above each other, but that doesn't sound right either...

Is there a clear cut solution to this?

Thanks,
Jeremy.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Wed Nov 23, 2016 6:24 pm 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
Based on what you've said, you want to set isEquivalent = true for the jars in your game. When you've done that, the 10 jars in your inventory should behave the way you're saying you want. For the jars on the shelf with different contents, the parser will go to fairly great lengths to differentiate them by their contents, their location, etc. It's been a while since I did this, but try it and see.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Wed Nov 23, 2016 8:45 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
Edit

I just fixed something. I noticed one of the spices had the same vocabWord set. It made it easier to grab the spices by name from the jars, but it didn't fix all the problems. With three jars stacked you can "put spice in jar." but after that it doesn't know how to put another kind of spice in a different jar.

Original

It doesn't work right. The jars show up on the spice rack as The spice rack has 3 jars. The problem is I can say take jar three times to take all three, but the contents are wrecked. I only get one content. When I type look at jar, I only get the description of jar, and I can't type look at safrin spice, even though I've got it in one of the jars..

Two fantasy spices, one real world spice, and three jars.

Code:
thymeJar : Container, Dumpable
    name = 'jar'
    vocabWords = 'thyme jar'
    disambigName = 'jar'
    desc = "A tiny glass jar, used for holding spices, or other small contents. "
    location = greysSpiceRack
    bulkCapacity = 1
    bulk = 1
    isEquivalent = true
;

pikunJar : Container, Dumpable
    name = 'jar'
    vocabWords = ' jar'
    disambigName = 'jar'
    desc = "A tiny glass jar, used for holding spices, or other small contents. "
    location = greysSpiceRack
    bulkCapacity = 1
    bulk = 1
    isEquivalent = true
;

safrinJar : Container, Dumpable
    name = 'jar'
    vocabWords = 'jar'
    disambigName = 'jar'
    desc = "A tiny glass jar, used for holding spices, or other small contents. "
    location = greysSpiceRack
    bulkCapacity = 1
    bulk = 1
    isEquivalent = true
;


thyme : Food
    name = 'thyme spice'
    vocabWords = 'thyme spice'
    uses = 30
    type = 'spice'
    location = thymeJar
    becomesPluralDropped = true
    beceomesSingularTaken = true
    isPlural = true
    desc = "These dried thyme leaves resemble hundreds of
        tiny green and light brown sticks."
    bulk = 1
    isEquivalent = true
    nutrition = 1
    canRot = true
    shelfLife = 300
 
;

pikun : Food
    name = 'pikun spice'
    vocabWords = 'pikun spice'
    uses = 20
    type = 'spice'
    location = pikunJar
    becomesPluralDropped = true
    beceomesSingularTaken = true
    isPlural = true
    desc = "Pikun spice is a reddish-orange spice, made from the ground seeds of a
            pikun tree."
    isEquivalent = true
    bulk = 1
    nutrition = 1
    canRot = true
    shelfLife = 300
 
;

safrin : Food
    name = 'safrin spice'
    vocabWords = 'safrin spice'
    uses = 20
    type = 'spice'
    location = safrinJar
    becomesPluralDropped = true
    beceomesSingularTaken = true
    isPlural = true
    desc = "Safrin smells sweet. It's made from silver buds, from a small herb plant with silver leaves."
    isEquivalent = true
    bulk = 1
    nutrition = 1
    canRot = true
    shelfLife = 300
 
;



Last edited by JeremyBenson on Wed Nov 23, 2016 11:00 pm, edited 4 times in total.

Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Wed Nov 23, 2016 10:54 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
Meh, the jars don't seem worth the trouble. I just removed them, and put the spice on the rack. It's just easier to have single items, that can be set it isEquivalent. I'd still like to hear advice on it, if there is any.

Something else is wrong here though. Check the output:

You see a satchel (which contains some cooking scrolls) and some frying pans here. On the spice rack are some thyme spice, some pikun spice, and some safrin spice.

Is there any way I can change 'are' to 'is?'

It should read: on the spice rack is some thyme spice, some pikun spice, and some safrin spice.

I think either would be grammatically wrong?

To bad it wouldn't say: on the spice rack there is some..


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Fri Nov 25, 2016 11:05 am 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
Not sure I agree with you about what is and isn't grammatical. But regardless, try this:

// Approach suggested by Jeremy
spiceRack: Surface
[...]
contentsLister: surfaceContentsLister {
showListPrefixWide(itemCount, pov, parent)
{ "On <<parent.theNameObj>> there is "; }
showListPrefixTall(itemCount, pov, parent)
{ "On <<parent.theNameObj>> there is:"; }
}
;

// Traditional approach
spiceRack: Surface
[...]
contentsLister: surfaceContentsLister {
showListPrefixWide(itemCount, pov, parent)
{ "On <<parent.theNameObj>> there <<itemCount == 1 ? 'is' : 'are'>> "; }
showListPrefixTall(itemCount, pov, parent)
{ "On <<parent.theNameObj>> there <<itemCount == 1 ? 'is' : 'are'>>:"; }
}
;

Also, if you got rid of your jars, I would get rid of the isEquivalent on your other objects. It serves no purpose to just put isEquivalent = true on everything. The purpose of isEquivalent is to make it so, e.g. for the code below, it will say "You are carrying 4 pencils" rather than "You are carrying a pencil, a pencil, a pencil, and a pencil."

me: Actor;
+Pencil;
+Pencil;
+Pencil;
+Pencil;


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Fri Nov 25, 2016 3:23 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
Thanks for the tips. I'm having an issue wrapping my head around a Drinkable, or Liquid class. I know this is one of the toughest ones. It's just, there can't be an RPG without ale, and brooks! The problem I'm having with liquid is that I don't want the user to be able to take it. Tads3 expects a take before drink. I can make the item be dropped again after drinking, but that doesn't cover take. If I make take impossible, drink fails. Has a work around been done for this?

One thing that bothers me about Tads is all the pre-made assumptions. It's like tads came a little too high level. All commands, and outputting should have been left up to the authors. Building high level, and then expecting us to go low level to work around is a bit of a backwards plan, lol. Only works for really smart people.

This is Drinkable, though I may change it to Liquid.

Code:
class Drinkable : Thing
    isFinite = nil
    canDrink = true
    isNoxious = nil
    canTake = nil
    canFill = nil
    thirstFill = 100
    uses = 0
   
    verify() {  logical; }
    dobjFor(Drink)
    {
        verify(){logical;}
        action()
        {
            if(canDrink)
            {
               
                if(isFinite)
                {
                   
                     // drink
                        uses -= 1;
                        if(gActor == me)
                        {
                           
                            gActor.thirstBar += thirstFill;
                           
                            if(gActor.thirstBar > gActor.maxThirst)
                            {
                               
                                gActor.thirstBar = gActor.maxThirst;
                               
                            }
                           
                            "<<gActor.name>> takes a refreshing drink of {the dobj/him}.";
                           
                        }else{
                           
                            "{You/he} drinks {the dobj/him}.";
                        }
                       
                   
                   
                    // end if finite
                }else{
                   
                    if(gActor == me)
                        {
                           
                            gActor.thirstBar += thirstFill;
                           
                            if(gActor.thirstBar > gActor.maxThirst)
                            {
                               
                                gActor.thirstBar = gActor.maxThirst;
                               
                            }
                           
                            "<<gActor.name>> tanks a refreshing drink of {the dobj/him}.";
                           
                        }else{
                           
                            "{You/he} drinks {the dobj/him}.";
                        }
                   
                    // end if not finite
                }
               
                if(isFinite && uses <= 0)
                {
                   
                    // remove finite source, all drinks used
                   
                    gDobj.moveInto(nil);
                   
                }
              // end if canDrink 
            }else{
                // can't drink
                if(isNoxious)
                {
                   
                    "{The dobj/he} is far too noxious.";
                       
                }else{
                   
                    "<<gActor.theName>> has second thoughts about drinking {the dobj/he}.";
                   
                }
            }
           
            gDobj.moveInto(gActor.getOutermostRoom());
            // end action
        }
        // drink
    }
   
 
;


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Fri Nov 25, 2016 3:46 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
Woops. I solved the liquid issue by removing a preCond in things.t

Here's one that gets me. I'm trying to take an object, but I get an un-usable object in my inventory. It shows up as listed, but I can't drop it, look it, or nothing. The culprit is a frying pan.

Code:
greysPans : Thing
    name = 'frying pans'
    vocabWords = 'castiron iron frying pan*pans'
    location = greysKitchen
    isPlural = true
    oneTaken = nil
    desc = "Cast iron frying pans, with wooden handles. They're in pretty good shape, but
         some bare the marks of daily use. A couple are filled with scratches, and dings,
        but they're hardly noticable without close inspection."
    disambigName = 'hanging pans'
   
    dobjFor(Take)
    {
       
        action()
        {
                if(!oneTaken)
                {
                    local hasPan = nil;
                       
                    foreach(obj in gActor.contents)
                    {
                       
                        if(obj.name == 'frying pan')
                        {
                            hasPan = true;
                        }
                    }
                   
                    if(!hasPan)
                    {
                        //BUG : Taking the pan puts an un-usable fying pan in inventory.
                        fryingPan = new Pan;
                        fryingPan.name = 'frying pan';
                        fryingPan.vocabWords = 'prized frying pan';
                        fryingPan.disambigName = 'prized pan';
                        fryingPan.desc = '<<me.name>> knows this as Greys prized frying pan. It\'s formed
                                          of solid cast iron, and has a dark stained handle. Grey often remarked
                                            in its ability to cook perfect meals, without needing much attention.';
                        fryingPan.location = greysKitchen;
                        fryingPan.bulkCapacity = 10;
                        fryingPan.weightCapacity = 30;
                        fryingPan.bulk = 8;
                        fryingPan.weight = 8;
                   
                        if(fryingPan.bulk + gActor.getBulkHeld() < gActor.bulkCapacity &&
                           fryingPan.weight + gActor.getWeightHeld() < gActor.weightCapacity)
                        {
                           
                            fryingPan.moveInto(gActor);
                           
                            if(gActor == me)
                            {
                               
                                 "<<me.name>> takes one of Grey's prized frying pans.";
                               
                            }else{
                               
                                "{You/he} takes one of Grey's prized frying pans.";
                               
                               
                            }
                       
                        }else{
                       
                            fryingPan.moveInto(nil);
                       
                            if(gActor == me)
                            {
                               
                                "<<me.name>> has too many possessions.";
                               
                            }else{
                               
                                "{You/he} has too many possessions.";
                               
                            }
                           
                       
                        }
                     
                   
                    }else{
                       
                        if(gActor == me)
                        {
                           
                            "<<me.name>> already has a frying pan.";
                           
                        }else{
                           
                            "{You/he} already has a frying pan.";
                           
                        }
                       
                    }
                   
                }else{
                   
                    "You've already taken on of Grey's frying pans.";
                   
                }
            // end action
            }       
          // end dobjFor(Take)
        }
;


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Fri Nov 25, 2016 3:54 pm 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
There is documentation for this stuff. In my experience you don't get to be proficient at TADS 3 until you've read a fair proportion of what's out there to read.

In this case, the TADS 3 Technical Manual mentions a nice example similar to this. See "Pre-Conditions" on:
http://www.tads.org/t3doc/doc/techman/t3res.htm

For what you're doing, I would consider the following:

class Drinkable : Thing
[...]
dobjFor(Drink)
{
[...]
preCond = (inherited() - [objHeld])
}
;


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Sat Nov 26, 2016 3:25 pm 
Offline

Joined: Wed Feb 24, 2016 10:27 pm
Posts: 91
My current issue is the frying pan posted just under. I solved the liquid issue via preCond. I just took the main preCond out of the action itself, under thing.t, as it's useless.

In the frying pan issue, I'm instantiating an object that goes into my inventory, but can't be used or accessed. I'm not sure what I'm missing.

I read the docs though. I've been reading them for weeks, and cross checking every page. I can only soak in so much, or you know, come across an issue that I just can't find an answer to...


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Random Questions
PostPosted: Sat Nov 26, 2016 4:28 pm 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
The main thing is I can't see your definition of the Pan class. If you want help, please include that definition. The most obvious possibility that comes to mind is that maybe your Pan class doesn't inherit from Thing, in which case that would explain it.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group