SIEGE UNIVERSITY 2 |
||||||||||||||||||||||
Siege University II Tutorials Modding FAQ 095: Upgrading DSII 100: The Basics of Siege Editor 201: Compass Map Radar 202: Conversations 203: Journal 204: Quest Indicator Icons 205: Start Positions 206: Teleporters 207: Town Portal Restrictions 208: Weapon Effects 209: Flick 210: Tuning Grids 211: Setting Up Good Map Lighting 212: Setting Up Simple Node Fading 215: Building Data Tables Siege University I Tutorials 200: Concepts and Terminology 201: Templates 203: Triggers 204: Moods 205: Fades 206: Elevators 211: Naming Key 213: Dungeon Siege Resource System 301: Introduction to Dungeon Siege Architecture Third Party Tutorials A Simple Mod Part One - Armor Textures A Simple Mod Part Two - A New Armor Beginners Guide to Stitching Regions How to Open and Create Tanks Making Chants Work in a New Map Ornaments Understanding the NKK Useful Links Siegetheday.org Dungeon Siege Outpost Dungeon Raider Kdawg.org - List of useful Links MCarp DS Nodes Dungeon Siege 2 at Gamefront Broken World at Gamefront |
215:
Dungeon Siege 2 Data Tables A
brief tutorial by SnowFox All
hail GPG for including these really, really, really data structures.
DS2 allows
you to make use of tables, allowing you to create, query and update
them from
Skrit. Player_Experience
It
is now possible to define tables, like the one above, that can has many
records
(i.e. rows) of information. When
creating a table, the first thing you need to do is define what the
table
format is (i.e. what it looks like). In the example above, you'd need
to
specify that there are three fields (i.e. columns), and for each field
specify
the field title, types, whether they are unique or not, default values
and
documentation. A
table's schema, or definition, defines a table. The schemas are kept in
/world/contentdb/tables/tables.gas.
In there is info about tables' field names, type, default value and
which
field(s) have to be unique or non-unique. Below
is an extract of the entry_schema schema used by
the DS2 Journal and
handbook. //
entry schema is used for both the journal lorebook and the handbook Once
a table schema has been defined, a table and records can be
created/added by
creating a table, specifying the schema it uses (which defines which
fields can
be assigned values), as well as setting up values for records (i.e. the
table's
rows). Let’s look at an example. Below
is an extract from /world/maps/ds2
world/info/lorebook_info.gas. t:table,n:lore_table] Each
new record in the above table data is defined in a The
above table has two records. And, because of the “default= *” part, the
id
field is automatically assigned a unique value that is unique within
the table. Let’s
take a look at what all that means, with some screenshots for the
Drevin's
medal block. The
code above tells us that we’re dealing with the Lore book (n:lore), so
open up
the in-game journal and click on the Lore tab. We’re dealing with a
quest item
(per the entry_type), so click on the Quest Items text. Looking
in the Quest Item's page 1 (because you get the medallion early in the
game),
we see the item’s Title and Icon data displayed. If you select (single
left-click) on that journal entry, you’ll see the summary text off on
the right
side of the journal. If
you double-click on the entry, the journal opens up and you’ll see the
Description_0 (left page) and Description_1 (right page). The right
page is
blank because there no text assigned to Description_1. Also,
notice the “\n\n” used within the description text in the n:lore_table
code.
Each ‘\n’ is a “new line”, which breaks the text up into paragraphs. Manipulating
Tables There
are a number of different methods with which tables can be manipulated
from
within Skrit. These are: Skrit::TableWrapper::GetName(void) Below
is an extract from /ui/interfaces/backend/journal/books/lorebook/lorebook.gas
showing the tables being used: //
Obtaining a reference to the map:lore_table table. If there is no such
table
(e.g. you gave Tables
can be queried to locate records that match certain criteria by making
using of
the Query method. Skrit::TableWrapper::Query(char
const *) The
char string pointed to by the argument is used to find records whose
fields
match the conditions given in the string. A dataset containing the
selected
records is returned, which can be traversed. Below
are a couple of example queries: //from
lorebook.gas Used
as in the following: dataset
entry_data$ = lore table$.Query(query$); Regards,
SnowFox |