I'm having some trouble with syntax. I want to be able to walk up to a dresser and say "open top drawer" or "open bottom drawer". Saying just "open drawer" should result in a "be more specific" response.
What keeps happening is that when I say any of those things, it thinks I'm just saying "open drawer".
I had this trouble before with "house door" vs. "car door" and was advised to work around the problem based on where the ego was standing. It worked in that case but won't work in this case.
I'm sure the problem has to do with both the said-handling syntax and how the words are defined in the vocab file, but I can't seem to find the right combination.
Can anyone help? Thanks very much.
i remember youre last post and i told you to use a button, but this time i went to the trouble of finding out how to work it how you want it.
the problem is that you are telling it to 'open' something, but you have 2 nouns following the verb. the only way ive gotten it to work is to change 'top' and 'bottom' from nouns to adverbs.
do that and run in this code:
i hope it all works out, but remember to make sure that 'top' and 'bottom' arent both nouns and adverbs, because it will not work then...i think they must be adverbs and nothing else.
Great, thanks, doan.|
I wouldn't have thought of making them just adverbs. Figuring out how to change the vocab file to make things work is tricky sometimes.
I'll give it a try. Thanks for the help!
|Jim C||It worked! Thanks a lot, that's been killing me for days...|
no prob! just remember that top and bottom can no longer be used as nouns...but that doesnt seem like a big loss, and there may be some other way that they can (if anyone wants to tell us?)|
|cloudee1||Don't type in "Open the top drawer" with the top or bottom set as adverb this becomes an improper sentence and will not work :-\|
You should be able to eliminate the three Said('..drawer') expressions to one by checking something like:
IF SAID '//drawer'
IF SAID '/top'
ELSE IF SAID '/bottom'
etc. (it's just pseudocode, don't try and copy/paste :))
|Jim C||Ok, thanks, Brian. I'll try that, because now I'm running into problems when I try to say "look in top drawer".|
|Jim C||Ah, I couldn't figure it out, so I just changed it so there's only one drawer. Doan's idea of changing top and bottom to adverbs worked when I said "open top drawer" but not when I said "look inside top drawer". I don't understand why I can't just make top and bottom into adjectives. For some reason, they don't function as adjectives when I do that. Thanks anyway, it's no big deal. But has anyone else had a problem like this and been able to work through it?|
i wasnt able to make the 'look in top drawer, bottom drawer' thing work, sorry. but here is what i think you can do to make it work somewhat. you could do two things...either a button (which is what i think would be easiest) or you can use a local variable. if you open the top drawer, you can make a variable (i.e. TOP_OPEN) and set it to true...if you enter 'look in drawer', you can do a check to see if the variable is true, and then do whatever you want to do when you look in the drawer otherwise saying "open it first!"...and you could do the same for the bottom one.
Or another way to do it and I think the easiest is to change search so that it is not a simile for look and then script it with "search" everywhere where you want to "look in". |
If you make a walkthru to start someone off like sierra did then just make sure that you give them an example to first look at and then search, showing them that these are two different expressions and will get two different responses.
Somewhere, I haven't been able to find it, in the scripts there should be someplace where sentence structures are defined, and the problem seems that certain types of words in certain places are ignored.
|Jim C||Ah, good idea. The darned syntax kills me whenever I try to make it understand a sentence longer than three words!|
SCI doesn't exactly treat them as "three word sentences". But rather, the engine includes a very powerful sentence parser which handles each word by their literary type and proper useage. It discards useless words like "the" "a" "an", etc. What's left then makes up the key word(s). You wouldn't do if(Said('look/at/the')) for example.|
Have you done the complete tutorial yet? If not, it's a good idea.
Oh yeah, believe me, I read the whole tutorial before I even started on my game. And I've gone back and referred to specific sections many times since then. I find the tutorial to be very helpful. The format makes it easy for beginners to follow. But it's not always thorough enough to help me with some slightly more advanced things I want to try. I'm sure everything I need is in the help file, but, to be honest, the help file is a little over my head. Actually, a lot over my head. But I certainly do spend a lot of time trying to work through my problems myself before I post here asking questions.|
As far as the sentence parser goes, yeah, I have played all of the SQ games, and a few of the PQ and KQ games too. I know pretty much which words not to bother with (the, a, etc.). I'll give an example of something I was having trouble with. It sounds weird out of context, but I wanted a command to be: "balance blocks on head". So first I tried the following:
I defined "balance" as a verb and "block(s)" as a noun in the vocab script. It didn't work. I tried various combinations of /, <, (), and . Still couldn't get it to work. I tried several different sentence structures. Nothing would work until I just trimmed it down to 'balance/blocks'. This type of thing has happened almost every time I try to program in a command that's longer than three words. In some cases, I have to change the grammatical form of a word in the vocab file. Usually, though, I just give up and shorten the command.
It's probably just lack of experience on my part. I'm not necessarily blaming the sentence parser. But maybe that section of the tutorial could be expanded a little. For instance, I find that sometimes, when a '/' doesn't work, a '<' does work, and I don't understand why. It seems like they're not strictly interchangeable (and I'm not talking about within parentheses or brackets).
Anyway, thanks for your time, Brian. I hope you don't think I'm a pain in the neck who asks too many questions. ;)
The problem is that it doesn't seem to recognize prepositions eg.. look in box vs. look at box. ::)
or adjectives in conjunction with prepositions eg.. look in top box :-*
I'm at work right now so i can't put in actual code to illustrate my point. :'(
|Brian_Provinciano||couldn't you do "inside"/"in"? Many problems are simply due to improper use of vocab resources.|
Hey Brian |
Here is an example that I am going to guess is relatively common for those people who have seemed to struggle with this.
Any form of sentence which includes "look" and "shoe" produce the final response only. . . Remove the last response and regardless of what combination you type in, the game has been left responseless.
(if(Said('look>')) // imperative verb
(if(Said('/inside>')) // preposition
(if(Said('//shoe')) // noun
Print("It is dark inside the shoe!")
(else(if(Said('/under>')) // preposition
(if(Said ('//shoe')) // noun
Print("There is mud under the shoe!")
Print("It's a shoe!")
|Jim C||Yes, cloudee, thank you. That's a good example of what I've been having trouble with.|
Does anybody know how to get it to accept the command "give *** to ***" from the user? |
Specifically, I'm trying to "give/package/to/steve", where steve and package are both defined as nouns in the vocab file. This does not compute. The best I can come up with that works is "give/package" or "give/package[<to,steve]". But that results in giving the package to steve even if the user said to give it to someone else.
Any advice? Thanks.
|BP out of area||You would do GIVE/SOMETHING/SOMEONE. Like the docs say, the, to and others are removed.|
|Jim C||Oh, of course. Thanks Brian, it works perfectly. Hope you had a good Thanksgiving, btw.|
|BP ooa||Erm...thanks, though I am Canadian ;)|
|Jim C||hahahahaha I'm stupid! sorry|