SUGGESTION: Categorization of parser words

Started by Rui 'Trovatore' Pires, Fri 03/02/2006 08:43:41

Previous topic - Next topic

Rui 'Trovatore' Pires

Yes, yes, I know I already asked for this and it was turned down. But I need it now, so I'm asking again.

So, I'm working on a template. An IF template. With point and click interface. And the part of it that's point and click works well. So that's that.

The optional parser, though, doesn't yet. Naturally - I haven't coded it yet. But that's because I'm running into problems.

Now, for my code I've managed to separate inputs neatly. That mmeans that inventoryitem actions will take place on the item's script, and characters' actions on their script, and so on. Better than a huge lump in the global script.

In order to do the same with the parser, I'd have to find out the composition of the inputted sentence. ANd this is the problem. How do I know whether the played has entered, say, a verb and an inventory item? There actually is a hack-ish sort of thing I can do, using String functions instead, but what if I check for the inventory item's name, "Excalibur", and the player has inputted "sword", a valid synonim? I need to use the parser's synonim ability.

What would I like? Simply, an optional way to categorize the words into verbs/objects/custom_user_mode1 stuff, and then be able to check for the categories of the words in the parser, and get THEM. I don't even have to get their actual position in the sentence, it's not necessary here.

Incidently, there IS a workaround I can use, and will until I get a response...but it allows for a strict "Verb+Object+Character+Inventory" approach. "Give Poster (to) Roger" wouldn't work, but "Give Roger (the) Poster" would. Now, this is a bit of a hack. It works, but I'd rather avoid it. It's just not how IF works.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

scotch

If you are making an IF template (seems a funny thing to want to do in AGS) I think scripting your own parser is the way to go... AGS's is really only usable for AGI sort of "verb noun" command games, and even then it can be frustrating for the coder to get a lot of things to work, an IF game player is going to find it quite frustrating.
A better parser could be done in a module, if someone feels like doing it, I might even use it myself.

Rui 'Trovatore' Pires

Oh, but I've found a way to get it to work very niftly, don't worry about that. :) Like I said, that extra bit of versatility is all I require. You see, due to the point-and-click aspect of it, I've got verbs, inventory, characters and objects neatly tucked in their own listboxes. That makes it so much easier to handle than an abstract way - and really, I'm getting it to work surprisingly well.

I don't really think that a better parser needs coding separately - AGS' default one is a good one, even if it is a bit basic. It follows good principles - synonims, the "()" and "," operators, "rol" and "anyword" and "ignore words"... it can grow. One step at a time, of course - and right now, this one step is all I strictly require.

Anyway, like I said, I can do without it... it'll just be a bit awkward on some instances. "give man thing" is less usual than "give thing man".
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

So what you're really asking for is like a custom field on the word list, where you could set the word types in the Text Parser pane and then have some sort of Parser.GetWordType() function to retrieve it in the script?

Rui 'Trovatore' Pires

Yep, that would be a grand thing indeed, very nice way to put it. Plus a way to get the type of a given word in the input (1st word, 2nd word, last word, something of the sort), otherwise it wouldn't be nearly as useful.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

Well, I have to admit that this is a bit of a specialized request, so I can't make it a priority.

Rui 'Trovatore' Pires

Right-o, I see what you mean. I'll make do without it for a bit, but I'd like to see it sometime in the future then. I can always release a v1.x with the tydier code that'll allow.

(incidently, this would also mean that the same word could be in the database more than one time, if listed as more than one type. "Water" as verb and as noun, for instance)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.


SMF spam blocked by CleanTalk