java script text based game and objects
<p>I am writing a text based game where I want users to be able to manipulate any item. </p>

<p>I want the user to be able to say, for example, "I throw the bottle of oil at the monster."
Now when this happens [throw] will be an action, [bottle of oil] is an inventory item with the property [contains oil], and the monster will be the nearest monster in the room unless specified further.</p>

<p>Code needs to analyze the various properties of all these things and then pick actions that cause those things to interact.</p>

<p>When i write the Game story code it will be like follows</p>

<blockquote>
  <p>*room.darkroom.1 "wake up" [...] everything appears blurry, the voice sounds strange as if echoing down a long tunnel. From what you can see you can tell [you are in a dark room] your vision blurs from white to dark. [pc is inside very dark room. Inside this room everything is hidden in darkness. The northern wall has a locked thick wooden door. the southern wall has a barrel full of oil containing a bottle of oil. In the eastern side of the room are 2 medium sized crates one crate contains flint and rusty dagger. In the western side of the room a [small window] */room.darkroom.1</p>
</blockquote>

<p>The script will take all those words and apply properties to them randomizing certain elements that are left unstated. So if you then say "chair" it will go to the chair properties and randomly assign unstated properties. One property of chair will be material. If its not stated that its an oak chair then the script should pick from any of the material properties and assign them. This new chair will pick up a few properties and be saved for future reference on the database with all properties. </p>

<p>Another property would be an action. A chair would not necessarily have an action .. but it might break. The script needs to know if the chair is breakable. But I am thinking that could be nested into another property like [toughness].</p>

<p>Many things will have many of the same properties: chair, night stand, table would all be similar in many ways. But they would also have different outcomes depending on the actions applied to them. </p>

<p>How do I specify for instance when "broken" contains chair legs and scrap material? The chair legs and the scrap material would both need to inherit the properties of the chair that was destroyed, such as oak / flammable / breakable. Obviously, as stated before, it might not have to inherit flammable or breakable if oak is the part that holds that value. </p>

<p>I want to make it easy to access the array that stores properties and that might include a script that effects behavior and descriptions of things. </p>

<p>I started to just create a keyed array which would be looped through... But now I am thinking that I should utilize the object based element of JavaScript. </p>

<p>Here is what i have started to do but I stopped right away:</p>

<pre class="lang-js prettyprint-override"><code>var language = {
    // key    currentmodifyers   possible modifyers   action/condition description of item

    item: ";medium,material;;its a thing thats not a person",
    chair: "item,chair_Legs;;pile_of.@scraps.collection.chairlegx3/broken,@[chair ]scraps/destroyed; and someone could sit on it. ",
    chair_leg:"item,blunt,light,"
}
</code></pre>

<p>I have so many definitions to write so it would be a shame to start writing it all and then have to do it over when I discover the best way. </p>

<p>I am looking at various ways to build objects in JavaScript, but would like the best way from someone experienced. </p>

<p>Understanding the complexity of my problem, what is the best way to store and apply properties?</p>