View Single Post
Old 03-21-10, 02:32 AM   #92
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

Yea you are on the right track. The commands.xml file maps the recognized text to an ingame order (optionally with default or spoken numbers in the param1/param2 fields). To actually let the speech engine recognize a certain word or phrase, you must also edit the grammar.xml file, because the engine only 'listens' to what is defined in there. The grammar-file uses a W3C specification:

http://www.w3.org/TR/speech-grammar/

This specification defines the structure of that file. The most basic way to add a new grammar-line is to add a new item to the root:

<item>navigation map</item>

And you can add more for the same command:

<item>map</item>

You can see I've used more detailed definitions:

<item repeat="3">dive</item>

This means the word dive must be said 3 times in a row to be recognized as 'dive dive dive'.

There's also 'optional' words (repeat="0-1"), or even 'choice' (the one-of element)

Each accepted phrase (item) is looked up in the commands.xml file and then passed on to the .py script file, which finally passes the command on to the game... This is how it basically works.

Basically, you could define your map command like so:

Code:
<item>
   <item repeat="0-1">
       <one-of>
            <item>navigation</item>
            <item>close</item>
       </one-of>
   </item>
   map
</item>
You can also add each line using a seperate <item></item> line, but the above method is better optimized for the speech engine to use less resources or find close matches.

PLEASE NOTE: We are working on improved commands and phrases, for both English and German. Also note, not all game commands work (yet). So stay tuned for an 'official' update.

NOTE2: all game commands can be found in a file in the Documentation folder of this mod.

Last edited by skwasjer; 03-21-10 at 02:50 AM.
skwasjer is offline   Reply With Quote