Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Here's a small program.

start_at = room01
locations {
   room01 : location "You're in a storeroom";
}
objects {
   tongue : object "some hound's tongue" start_at = "room01";
   fern : object "some adder's tongue fern" start_at = "room01";
}
on_command {
   : match "examine tongue" {
      : print "It's the tongue of a dog.";
      : done;
   }
   : match "examine fern" {
      : print "It's adder's fork.";
      : done;
   }
}

If you EXAMINE FERN or GET FERN, it's fine, but if you EXAMINE ADDER'S TONGUE FERN or GET ADDER'S TONGUE FERN, it examines or gets the hound's tongue.

(2 edits)

I'll document this better in the manual later, but quick answer for now is that after encountering a noun, subsequent nouns are ignored unless a proposition is supplied. (English language behaviour, slightly different behaviour for Spanish mode)

If a word is a noun and an adjective, then it will read the first word as a noun, and if it discovers the next word is also a noun, then it will try to interpret the first word as an adjective.

1. EXAMINE ADDER'S TONGUE FERN
    ^
   MATCHED VERB = EXAMINE
2. EXAMINE ADDER'S TONGUE FERN
             ^
         Not in dictionary, ignored (internally removes ' char so actually looking for adders in dictionary)
3. EXAMINE ADDER'S TONGUE FERN
                     ^
                MATCHED NOUN1 = TONGUE
4. EXAMINE ADDER'S TONGUE FERN
                           ^
                      Matched Noun but as follows previous noun, discard. Also checks
                      to see if tongue is an adjective as well as a noun so it can
                      change tongue to an adjective if in dictionary.

The fix is to add tongue as an adjective to the fern:

start_at = room01
locations {
   room01 : location "You're in a storeroom";
}
objects {
   tongue      : object "some hound's tongue" start_at = "room01";
   tongue_fern : object "some adder's tongue fern" start_at = "room01";
}
on_command {
   : match "examine tongue" {
      : print "It's the tongue of a dog.";
      : done;
   }
   : match "examine fern" {
      : print "It's adder's fork.";
      : done;
   }
}

I will also probably change the noun discardation order so that if two nouns are encountered in a row and the first noun is not also an adjective, that the most recent noun overwrites the existing noun. I may also retain additional nouns and adjectives in a future version of the parser. 

I hope this answers your question, and I realise I have to document the parser better.

FYI - by switching DEBUG ON in the editor you can see how Adventuron is parsing the logical sentence. It's very spammy but sometimes useful.

Chris

In your first sentence, I think you meant "preposition", not "proposition", so something like "bag of gold" should work.

In the code example, I didn't notice that you had included the adjective as a prefix to the object name, so I went looking for an adjective property. It doesn't show up with Ctrl+Space, but I guessed it to be adjective = "tongue" inside the object definition. Both methods work, providing you still supply a noun in the command. If you use a command like X ADDER'S TONGUE (without FERN), it still refers to the hound's tongue.

Can I somehow define multiple adjectives?

(1 edit)

Defining multiple adjectives to be associated with an object / scenery / entity  is not yet supported however aliases for an adjective are supported (via the vocabulary table) but probably not what you want.

Yes, I meant preposition.

So, if I type EXAMINE BIG BAD WOLF and have a test after my :match "examine wolf" statement that says something like :if (adjective="big") to distinguish from the small white wolf, then which adjective should I be testing for, the first one, the second one or both? Does this have an impact if I put the synonyms in the vocabulary table? For example, : adjective / aliases = [big, bad]. I presume it's the first entry in the array. Using the aliases could be troublesome if the same adjectives are used for multiple objects, e.g. the big table is big, but it's not bad and the bad apple is bad, but it's not big.