[DGD] Question...

Christopher Allen ChristopherA at skotos.net
Thu Feb 28 02:37:56 CET 2002


"Noah Gibbs" <angelbob at monkeyspeak.com>:
>   Anyway, that's what you get if it parses as UNQ.  Then the UNQ DTD
> parser, which does *not* use parse_string, examines structure like the
> above and parses it into a better structure.  That section doesn't use
> parse_string, so I can do better error checking.  For instance if your
DTD
> says that the "number" field of "room" should be an integer, the word
> "bob" as an argument to "number" above is going to cause an error.  In
> particular, the stack returned will look something like:

The Skotos StoryBuilder library does something similar, though it does
not have a strict DGD. For instance, here is the XML of a real (but
simple) object:

<object id="OBJ(Ur:tool:smith:anvil)">
  <context/>
  <Base:Thing>
    <Ur:UrObject/>
    <Base:Inventory/>
    <Base:Misc gender="neuter" volition="false" weapon="false"
default_stance="none" combinable="false" discrete="false"
by_weight="false" tight="false" scriptrunner="false">
      <Base:Edible value="false"/>
      <Base:Potable value="false"/>
      <Base:DrinkMessageFirst/>
      <Base:DrinkMessageThird/>
      <Base:Potable value="false"/>
      <Base:Transparency value="true"/>
      <Base:Unsafe value="false"/>
      <Base:Safe value="false"/>
      <Base:ClothesExpected value="false"/>
      <Base:DieMessageFirst/>
      <Base:DieMessageThird/>
    </Base:Misc>
    <Base:Details>
      <Base:Detail id="anvil" prime="true" def="false" abstract="false"
hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="true" inside="true" near="true" over="true" behind="true"
before="true" beside="true"/>
        <Base:Names>
          <Base:Name sname="anvil" pname="anvils"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="grimy"/>
          <Base:Adjective adjective="heavy"/>
          <Base:Adjective adjective="iron"/>
          <Base:Adjective adjective="metal"/>
          <Base:Adjective adjective="smith"/>
          <Base:Adjective adjective="smithing"/>
          <Base:Adjective adjective="waist-high"/>
          <Base:Adjective adjective="waisted"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">anvil</Base:Description>
          <Base:Description type="examine">
             A grimy, heavy iron anvil, with a slightly narrowed waist
and a smooth upper surface at about waist height. It is mounted on a
sturdy, scarred wooden post. The anvil does not have a horn, but it does
have a square hardy hole (for mounting tool pieces in) and a round
pritchel hole (for punching out pieces of iron).
          </Base:Description>
          <Base:Description type="glance">
             A heavy, waisted anvil.
          </Base:Description>
          <Base:Description type="look">
             A grimy, heavy iron anvil, with a slightly narrowed waist.
It is mounted on a sturdy, scarred wooden post.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
      <Base:Detail id="base" prime="false" def="false" abstract="false"
hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="false" inside="false" near="true" over="false" behind="false"
before="false" beside="false"/>
        <Base:Names>
          <Base:Name sname="base" pname="base"/>
          <Base:Name sname="waist" pname="waists"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="anvil"/>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="grimy"/>
          <Base:Adjective adjective="heavy"/>
          <Base:Adjective adjective="iron"/>
          <Base:Adjective adjective="metal"/>
          <Base:Adjective adjective="smith"/>
          <Base:Adjective adjective="smithing"/>
          <Base:Adjective adjective="smooth"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">
             anvil's base
          </Base:Description>
          <Base:Description type="glance">
             The waist and base of a heavy anvil.
          </Base:Description>
          <Base:Description type="look">
             The middle section of the anvil narrows down slightly to
form a waist. The base is set atop a sturdy, scarred wooden post. The
pritchel hole in the anvil's upper surface penetrates all the way down
to exit the upper curve of the waist.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
      <Base:Detail id="hardy hole" prime="false" def="false"
abstract="false" hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="true" inside="true" near="true" over="true" behind="false"
before="false" beside="false"/>
        <Base:Names>
          <Base:Name sname="hole" pname="holes"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="anvil"/>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="grimy"/>
          <Base:Adjective adjective="hardy"/>
          <Base:Adjective adjective="heavy"/>
          <Base:Adjective adjective="iron"/>
          <Base:Adjective adjective="metal"/>
          <Base:Adjective adjective="smith"/>
          <Base:Adjective adjective="smithing"/>
          <Base:Adjective adjective="smooth"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">
             anvil's hardy hole
          </Base:Description>
          <Base:Description type="examine">
             There are two holes in the smooth, waist-high upper surface
of the anvil; one of these is the hardy hole. It is square, about an
inch across and a few inches deep.
          </Base:Description>
          <Base:Description type="glance">
             The square hardy hole on the top of an anvil.
          </Base:Description>
          <Base:Description type="look">
             There are two holes in the smooth upper surface of the
anvil; one of these is square, and is the hardy hole.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
      <Base:Detail id="post" prime="false" def="true" abstract="false"
hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="true" inside="false" near="true" over="true" behind="false"
before="false" beside="false"/>
        <Base:Names>
          <Base:Name sname="post" pname="posts"/>
          <Base:Name sname="mount" pname="mounts"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="anvil"/>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="knee-high"/>
          <Base:Adjective adjective="round"/>
          <Base:Adjective adjective="scarred"/>
          <Base:Adjective adjective="sturdy"/>
          <Base:Adjective adjective="thick"/>
          <Base:Adjective adjective="wood"/>
          <Base:Adjective adjective="wooden"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">
             the wooden post supporting an anvil
          </Base:Description>
          <Base:Description type="glance">
             A sturdy, scarred thick wooden post supporting an anvil.
          </Base:Description>
          <Base:Description type="look">
             This anvil is supported on a knee high post, of sturdy,
scarred wood.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
      <Base:Detail id="pritchel hole" prime="false" def="false"
abstract="false" hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="true" inside="true" near="true" over="true" behind="false"
before="false" beside="false"/>
        <Base:Names>
          <Base:Name sname="hole" pname="holes"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="anvil"/>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="grimy"/>
          <Base:Adjective adjective="heavy"/>
          <Base:Adjective adjective="hole"/>
          <Base:Adjective adjective="iron"/>
          <Base:Adjective adjective="metal"/>
          <Base:Adjective adjective="pritchel"/>
          <Base:Adjective adjective="punch"/>
          <Base:Adjective adjective="smith"/>
          <Base:Adjective adjective="smithing"/>
          <Base:Adjective adjective="smooth"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">
             anvil's pritchel hole
          </Base:Description>
          <Base:Description type="examine">
             There are two holes in the smooth, waist-high upper surface
of the anvil; one of these is the pritchel hole. It is round, about an
inch across, and penetrates all the way through the top of the anvil, to
come out at the waist. There are many scratches and scrapes down the
inside of the pritchel hole.
          </Base:Description>
          <Base:Description type="glance">
             The round pritchel hole on the top of an anvil.
          </Base:Description>
          <Base:Description type="look">
             There are two holes in the smooth upper surface of the
anvil; one of these is round, and is the pritchel hole.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
      <Base:Detail id="surface" prime="false" def="false"
abstract="false" hidden="false" luminosity="0">
        <Base:Preposition close="true" against="true" under="false"
on="true" inside="false" near="true" over="true" behind="false"
before="false" beside="false"/>
        <Base:Names>
          <Base:Name sname="top" pname="tops"/>
          <Base:Name sname="surface" pname="surfaces"/>
          <Base:Name sname="face" pname="faces"/>
        </Base:Names>
        <Base:Adjectives>
          <Base:Adjective adjective="anvil"/>
          <Base:Adjective adjective="forge"/>
          <Base:Adjective adjective="grimy"/>
          <Base:Adjective adjective="heavy"/>
          <Base:Adjective adjective="iron"/>
          <Base:Adjective adjective="metal"/>
          <Base:Adjective adjective="smith"/>
          <Base:Adjective adjective="smithing"/>
          <Base:Adjective adjective="smooth"/>
          <Base:Adjective adjective="top"/>
          <Base:Adjective adjective="upper"/>
        </Base:Adjectives>
        <Base:Descriptions>
          <Base:Description type="brief">
             anvil's surface
          </Base:Description>
          <Base:Description type="examine">
             The waist-high upper surface of the anvil is smooth and
dark. There are two holes in it: a square hardy hole, and a round
pritchel hole.
          </Base:Description>
          <Base:Description type="glance">
             The upper surface of an anvil.
          </Base:Description>
          <Base:Description type="look">
             The upper surface of the anvil is smooth and dark. There
are two holes in it.
          </Base:Description>
        </Base:Descriptions>
        <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
        <Base:Climbable/>
      </Base:Detail>
    </Base:Details>
    <Base:Bulk flexible="false">
      <Base:Mass value="50"/>
      <Base:Density value="7.8">
         The density of this object in relatoin to some common
materials, listed from less dense to more dense: granite \< slate \<
titanium \< steel \< THIS OBJECT \< bronze \< brass \< copper \< silver
      </Base:Density>
      <Base:Capacity value="0"/>
      <Base:MaxWeight value="0"/>
    </Base:Bulk>
    <Base:Combat>
      <Base:Strength value="1"/>
      <Base:MaxFatigue value="1"/>
    </Base:Combat>
    <Base:Clothing>
      <Base:SingleWear value="false"/>
    </Base:Clothing>
    <Base:Crafting see_level="0" do_level="0" time="0" attention="false"
held="false">
      <Base:Ingredients/>
      <Base:Tools/>
      <Base:CraftVerbs/>
    </Base:Crafting>
    <Base:Container>
      <Base:ContainerVerbSecond/>
      <Base:ContainerVerbThird/>
    </Base:Container>
    <Base:InitialContents/>
    <Base:InitialProperties/>
    <Core:Properties>
      <Core:Property property="skill:fatigue">1.0</Core:Property>
      <Core:Property property="theatre:bigmapurl">
         "http://www.skotos.net/MarrachGame/images/MarrachMap0.jpg"
      </Core:Property>
      <Core:Property property="theatre:gamebrief">
         "Castle Marrach"
      </Core:Property>
      <Core:Property property="theatre:gamedesc">
         "Castle Marrach - Multiplayer Roleplaying Environment"
      </Core:Property>
      <Core:Property property="theatre:gameid">
         "Marrach"
      </Core:Property>
      <Core:Property property="theatre:loginurl">
         "https://www.skotos.net/user/login.php"
      </Core:Property>
      <Core:Property property="theatre:port">80</Core:Property>
      <Core:Property property="theatre:realmurl"/>
      <Core:Property property="volition">0</Core:Property>
    </Core:Properties>
    <Notes:Notes>
      <Notes:Category cat="QA" catstate="Open">
        <Notes:Note ix="974567102" state="Open" user="michaelb">
           A tool.
        </Notes:Note>
      </Notes:Category>
    </Notes:Notes>
  </Base:Thing>
</object>

However, we can also break this up smaller, for instance, the detail
above called "surface" can also be XML'ized as:

<object id="OBJ(Ur:tool:smith:anvil)">
  <context>
    <iterator var="id" val="surface" type="lpc_str"/>
  </context>
  <Base:Detail id="surface" prime="false" def="false" abstract="false"
hidden="false" luminosity="0">
    <Base:Preposition close="true" against="true" under="false"
on="true" inside="false" near="true" over="true" behind="false"
before="false" beside="false"/>
    <Base:Names>
      <Base:Name sname="top" pname="tops"/>
      <Base:Name sname="surface" pname="surfaces"/>
      <Base:Name sname="face" pname="faces"/>
    </Base:Names>
    <Base:Adjectives>
      <Base:Adjective adjective="anvil"/>
      <Base:Adjective adjective="forge"/>
      <Base:Adjective adjective="grimy"/>
      <Base:Adjective adjective="heavy"/>
      <Base:Adjective adjective="iron"/>
      <Base:Adjective adjective="metal"/>
      <Base:Adjective adjective="smith"/>
      <Base:Adjective adjective="smithing"/>
      <Base:Adjective adjective="smooth"/>
      <Base:Adjective adjective="top"/>
      <Base:Adjective adjective="upper"/>
    </Base:Adjectives>
    <Base:Descriptions>
      <Base:Description type="brief">
         anvil's surface
      </Base:Description>
      <Base:Description type="examine">
         The waist-high upper surface of the anvil is smooth and dark.
There are two holes in it: a square hardy hole, and a round pritchel
hole.
      </Base:Description>
      <Base:Description type="glance">
         The upper surface of an anvil.
      </Base:Description>
      <Base:Description type="look">
         The upper surface of the anvil is smooth and dark. There are
two holes in it.
      </Base:Description>
    </Base:Descriptions>
    <Base:Exit door="false" never_obvious="false"
obvious_when_open="false"/>
    <Base:Climbable/>
  </Base:Detail>
</object>

Or the description examine can be XML'ized:

<object id="OBJ(Ur:tool:smith:anvil)">
  <context>
    <iterator var="id" val="surface" type="lpc_str"/>
    <iterator var="type" val="examine" type="xml_pcdata"/>
  </context>
  <Base:Description type="examine">
     The waist-high upper surface of the anvil is smooth and dark. There
are two holes in it: a square hardy hole, and a round pritchel hole.
  </Base:Description>
</object>

Theoretically (though never done in practice) we could convert a whole
game into a single XML file.

-- Christopher Allen

------------------------------------------------------------------------
.. Christopher Allen                                 Skotos Tech Inc. ..
..                           1512 Walnut St., Berkeley, CA 94709-1513 ..
.. <http://www.Skotos.net>               o510/647-2760  f510/647-2761 ..



_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list