Extended format

Simpler FST writing from MMDAgent-EX 2.0 and later.

MMDAgent-EX ver. 2.0 and later has extension for FST writing as described before.

See also the Scenario FST page about how to set up and extended use.

Block definition

If you have an experience of writing FST scenario for MMDAgent, You may be bored of writing straight state sequences with unique numbers like this…

0 10   A      B
10 20  <eps>  C
30 40  <eps>  COMMAND2

From 2.0 you can write the same straight state sequence in a simpler form like this. Place “:” after state numbers, then write only the in-out pairs as indented lines. The indentation depth can be any.

0 40:
    A      B
    <eps>  C
    <eps>  COMMAND2

Furthermore, you can also write an “OR” arc in simpler form. You may experience writing several arcs on the same in-state and out-state to capture alternative messages like this:

#  at state 0 we should capture either A or B to issue X and proceed to 10
0 10   A      X
0 10   B      X
20 30  <eps>  COMMAND2

From 2.0, you can write the same sequence by using “+” inside a block definition.

0 30:
    A      X
    +B     X
    <eps>  COMMAND2

Internally, the “+” definition will not define a new state but append parallel arc to the previous one.

More, if the output of the “+” line is the same, you can omit it.

0 30:
    A      X
    <eps>  COMMAND2

Initialization of local variables at top

You can write initialization of local variables at the top of each .fst file. It will be evaluated at FST load time.

# initial values

# can not set after the beginning of any state definition
0 20:
    <eps> STAGE|Stage/floor.png,Stage/clouds.jpg

Local variable test

The 3rd field is normally a input text matching condition, but from 2.0 you can write a special condition that tests a local variable:

10 20  ${flag}==xxx  MODEL_ADD|mei|...

In this case, the local variable ${flag} will be tested when comes to state 10. If the value is xxx, the MODEL_ADD|mei|... will be issued.

Only != and == are available (local variables are strings), and no space is allowed in the equation.

10 20  ${flag}==xxx  MODEL_ADD|mei|...
10 20  ${flag}!=yyy  MODEL_ADD|mei|...

Please be aware of evaluation timing: the test will be evaluated at the first arrival of the state, and at every message arrival, not one-shot or busy wait.

Access to KeyValue

You can now get/set a KeyValue string value using local variable by specifying the key name with “%”.

      # get KeyValue to local variable:

      # set KeyValue from value or local variable:


## set initial values of local variable

## get definition of "current_time=..." in .mdf file

## block definition, use local variable
0 10:
    <eps> STAGE|Stage/floor.png,Stage/clouds.jpg
    <eps> MODEL_ADD|mei|${agentPMD}
    MODEL_EVENT_ADD|mei CAMERA|${camera_default}

## OR description in block
10 20:
   KEY|1 <eps>
   <eps>  SYNTH_START|mei|normal|"Hi!"
   SYNTH_EVENT_START|mei|normal <eps>

## variable test
# Before 1.3 (still works in 2.0)
#20 25 ${time}==morning SYNTH_START|mei|normal|"Good morning!"
#20 25 ${time}==evening SYNTH_START|mei|normal|"Good evening!"
#25 30 SYNTH_EVENT_START|mei|normal <eps>
20 30:
   ${time}==morning SYNTH_START|mei|normal|"Good morning!"
   +${time}==evening SYNTH_START|mei|normal|"Good evening!"
   SYNTH_EVENT_START|mei|normal <eps>

最終更新 2021.01.08: copied en to ja (adefa8b)