Using KeyValue

Share variables among modules.

MMDAgent-EX has a global key-value pair sharing scheme to help modules interacting with each other.

Use case:

  • Enable configuration: set a custom value at content’s .mdf file and refer it in a plugin.
  • Switch inside content: set or change a value by button or menu, and refer it in dialogue scenario FST.
  • Enhanced interaction: bind a bone or face to be dynamically controlled by a value.

Set or modify key values

Set value in .mdf file

Any pair of key values like xxx=yyy in .mdf file are stored as KeyValue pairs at system startup. Not only the defined parameters in .mdf, but also any key-value pairs written in .mdf file are stored.

Set value by message

Issueing the command message KEYVALUE_SET will set the specified key-value.


Set value by menu tap

You can define a menu item that sets or modifies a key value when tapping the item, by using menu action message as @Key=Value.

Set value by button tap

You can define a button that sets a key value when tapped. Use the setkeyvalue directive at exec parameter in BUTTON*.txt.


Show value in button label

A button with @KeyName label specified in BUTTON*.txt will display the live value of the key on the button.


Bind a key value to a bone or a face

MODEL_BINDBONE|(key name)|(min)|(max)|(model alias)|(bone name)|x,y,z|rx,ry,rz|x,y,z|rx,ry,rz
MODEL_BINDFACE|(key name)|(min)|(max)|(model alias)|(face name)|r1|r2

The motion of the specified bone or face in the model can be controlled by the value of a key. Motion controls of the specified bone or face are omitted if MODEL_BINDBONE or MODEL_BINDFACE is specified. See this section about its details.

Predefined key values

Here is reserved key values defined by system.

Key name Value Description default
ContentFile .fst file FST file name to start the content the same basename of the starting .mdf file, with suffix “.fst”
Julius_MaxVol [0..1] Current audio input volume scaled from 0.0 to 1.0

Use case

Bind a face to be contolled by input volume

Tell MMDAgent-EX to dynamically set rate of a face named morph1 in model loaded with alias base from 0.0 to 1.0, according to the current audio input volume that can be reffered by Julius_MaxVol key value.