Author Topic: How to use Qualifying Adjectives with the parser?  (Read 35551 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

How to use Qualifying Adjectives with the parser?
« on: May 05, 2010, 04:11:18 PM »
I guess this should have been in the Syntax Help forum. My bad.

I know you've given up on the parser, Cloudee, but if you or anyone else has any insight into how this works I'm all ears. I'm trying to handle some said strings to do different things for "get silver key" and "get gold key". But I can't seem to figure out how to use qualifying adjectives. Sentences are split into three parts and so only two "/"'s are allowed. Any ideas? Can you use the semantic operator "<"?

EDIT: Apparently the semantic operator doesn't work either. Here's my code. Any idea how I can script in adjectives? Just putting a space between the words makes the compiler complain that there is no "gold key" or "silver key" word in the vocabulary list. But it's impossible to have 2-word words in the vocabulary list. So I'm stumped.

Here's the code I have that doesn't work:

Code: [Select]
(if(Said('get>'))
(if(Said('/gold<key'))
(if(not send gEgo:has(INV_GOLDKEY))
(if(== gCoffinOpen TRUE)
(if(== gCoffinOccupied FALSE)
(if(send gEgo:has(INV_PILLOW))
(if(<= send gEgo:distanceTo(Coffin) 5)
PrintOK()
(send gEgo:get(INV_GOLDKEY))
++gKeyQuest
(send gGame:changeScore(5))
)(else
PrintNotCloseEnough()
)
)(else
PrintDontSeeIt()
)
)(else
PrintDontSeeIt()
)
)(else
PrintDontSeeIt()
)
)(else
PrintAlreadyTookIt()
)
)
(if(Said('/silver<key'))
(if(not send gEgo:has(INV_SILVERKEY))
(if(== gCoffinOpen TRUE)
(if(== gCoffinOccupied FALSE)
(if(== gDraculaDead TRUE)
(if(<= send gEgo:distanceTo(Coffin) 5)
PrintOK()
(send gEgo:get(INV_SILVERKEY))
(send gGame:changeScore(2))
)(else
PrintNotCloseEnough()
)
)(else
PrintDontSeeIt()
)
)(else
PrintDontSeeIt()
)
)(else
PrintDontSeeIt()
)
)(else
PrintAlreadyTookIt()
)
)
)
« Last Edit: May 06, 2010, 06:49:59 PM by MusicallyInspired »


Brass Lantern Prop Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #1 on: May 07, 2010, 04:54:05 PM »
I still can't figure this out so for the moment I'm going to just make him pick up both keys when you type "get key". If anybody ever has any ideas on figuring this out, please let me know.
Brass Lantern Prop Competition

Offline Cloudee1

Re: How to use Qualifying Adjectives with the parser?
« Reply #2 on: May 07, 2010, 05:07:24 PM »
Yeah, maybe I should rename the board to something besides how to, your not the first to post a question in there, no biggie. Anyway I'll fiddle around with it some this weekend, hopefully, and see if I can't come up with something. It's been a while since I've played kq2 are the keys in the same spot? like on a table together or something...
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #3 on: May 07, 2010, 05:18:48 PM »
Yes. In Dracula's coffin there are (potentially) two keys. The gold key that opens the final door to the tower realm is underneath the pillow. The silver key appears after you kill Dracula with a stake and mallet while he's sleeping in his coffin, after which he disintegrates into a pile of ashes. If you kill Dracula and pick up the pillow there are two keys that you are able to pick up. I've programmed in every other state. I just need to figure out how I can program "get silver key" and "get gold key".
Brass Lantern Prop Competition

Offline Cloudee1

Re: How to use Qualifying Adjectives with the parser?
« Reply #4 on: May 07, 2010, 07:50:55 PM »
I havenlt tried it yet, but my first inclinations would be to make 3 said phrases. Turn gold and silver into nouns and if said gold, if said silver, and if said key. I think as long as the gold or silver comes before the just key phrase in an if else statement then it would return them? but I don't know it might not like two nouns in the users parse phrase. But that is the direction I would try.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #5 on: May 07, 2010, 08:25:05 PM »
I'll try it. But it still bugs me. Why is there a Qualifying Adjective flag in Vocabs.000 at all?
Brass Lantern Prop Competition

Offline Cloudee1

Re: How to use Qualifying Adjectives with the parser?
« Reply #6 on: May 07, 2010, 09:19:35 PM »
Yeah so I couldn't get it to work right. I managed to get it to respond correctly to "get key gold" and silver, but that really doesn't help. I'm out of ideas right now but I'll keep mulling it over. It's almost as if only the first and last word are recognised and everything else is ignored. I remember having similar trouble trying to do a top and bottom drawer. I think in the end I tossed out the idea and went with one drawer. ;P    For now, I guess my best suggestion would be to give them whichever key is visible and if they both are then give them both...
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #7 on: May 07, 2010, 10:01:24 PM »
It's still going to be frustrating for players who will instinctively type "get gold key" only to have it fail on them. I had the same problem with trying to type "get basket of goodies" at the mailbox. In the end I had to just do "get basket" and "get goodies". ANNOYING!
Brass Lantern Prop Competition

Offline gumby

Re: How to use Qualifying Adjectives with the parser?
« Reply #8 on: August 16, 2010, 11:08:30 PM »
Hey, so I've been building a vocab.000 file from scratch and I think it is possible to have 'multiple part' words.  I discovered this with mokalus's utility which I found on the agigames site for converting a words.tok file (agi) to a vocab.000 (sci).  I ran it against an agi game and imported the resulting file into SCI Comp, and sure enough, I have words like 'bolt of lightning'.

I'm still in the process of building a vocab.000 file from scratch, and I'm thinking of perhaps making a utility which allows you to construct an entire vocab file from a spreadsheet.  Alternately, you could always create a 'multi part' word in the vocab file with all the spaces replaced with an arbitrary printable character, then export the resource & edit it with a hex editor, replacing your bogus character references with a 0x20 (space character) and then re-import the file into your game. 

The one thing that I'm not clear on is if the parser can handle these words.  Part of me thinks that it probably chops a sentence up using the spaces, but maybe not necessarily?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: How to use Qualifying Adjectives with the parser?
« Reply #9 on: August 16, 2010, 11:34:57 PM »
This may seem like a silly response, given that I have not really looked at SCI scripting, but is it possible to declare a global variable that could be assigned a two word value?
KQII Remake Pic

Offline gumby

Re: How to use Qualifying Adjectives with the parser?
« Reply #10 on: August 17, 2010, 08:22:30 AM »
Yes, you can declare a global variable that can contain any characters (I *think*).  What did you have in mind?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #11 on: August 17, 2010, 10:44:15 AM »
Wow! If you manage to get this working it would be INVALUABLE to my KQ2 remake! I have to settle with things like "basket" and "goodies" instead of "basket of goodies" or "girl" instead of "red riding hood".
Brass Lantern Prop Competition

Offline gumby

Re: How to use Qualifying Adjectives with the parser?
« Reply #12 on: August 17, 2010, 11:02:30 PM »
Okay, I've had more time to do some testing with this.  It appears that despite the fact the vocab will support a multi-part word, the Said() string doesn't (it looks like it parses each word individually).  I'm now hoping that perhaps I can substitute the spaces in the Said() string with an equivalent escape sequence.

I used some code like:
Code: [Select]
(if(Said('bolt of lightning'))
   Print("You can't do that!!!")
 )

and I couldn't get it to match it (it is interesting to note that each word *individually* needs to be in the vocab for the sentence to even parse, otherwise you get the response "I don't know the word 'xxx'").  All I get is the boiler-plate "You've left me responseless".

I'm really starting to dislike the parser...

In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: How to use Qualifying Adjectives with the parser?
« Reply #13 on: August 18, 2010, 01:34:49 AM »
I'm starting to think that the parser interface in the SCI template game is unfinished. Other Sierra games have no problem using adjectives. The function is even there in SCI Studio/Companion, but there is no explanation as to how to use it!
Brass Lantern Prop Competition

Offline gumby

Re: How to use Qualifying Adjectives with the parser?
« Reply #14 on: August 18, 2010, 11:23:40 PM »
Okay, I haven't given up on this yet.  Going back to your original post, I was able to get 'take gold key' and 'take silver key' to work properly.   Here's what I did:

Code: [Select]
(if(Said('take/key<gold'))
      Print("Ahh!  The gold key!")
)

(if(Said('take/key<silver'))
      Print("Ahh!  The silver key!")
)

Typing simply 'take key' resulted in neither response being displayed.  I ran this test against a brand-new template game, didn't have the touch to vocab at all.  Does this help?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.042 seconds with 23 queries.