-
Notifications
You must be signed in to change notification settings - Fork 7
Tutorial: Creating the JSON
<< Tutorials / << Setting up the ACEs | Adding properties and editdata >>
As you learned in the previous tutorial, your extension's Actions, Conditions, and Expressions are linked to IDs. In turn, you assign information to these IDs using the JSON, which describes your extension's information, menus, and A/C/E parameter names and types. It is vital that the JSON matches your A/C/E functions exactly - minor differences can cause crashes and bugs. If you're coming from rSDK, the idea of the JSON may seem ludicrous; the JSON exists and is separate from the A/C/Es for these reasons:
- The JSON can be external to the MFX, which allows language translations of the extension without changing the MFX
- The JSON can be used with a blank EDIF Extension to make the boilerplate Windows version of an extension that only works in a particular export (Flash, HTML5, Anaconda, iOS, etc.)
- The JSON serves as a centralized place to change all text for an extension
{
"About":
{
"Name": "EDIF Template Object",
"Author": "Your Name",
"Copyright": "Copyright © 2012 Your Name",
"Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.",
"URL": "http://www.example.com/",
"Help": "Help/My New EDIF Extension/Help.chm",
"Identifier": "X&pl"
},
"ActionMenu":
[
"Separator",
[0, "Action Example"],
"Separator",
["Sub Menu",
[1, "Second Action Example"]
],
"Separator",
[0, "A Disabled Menu Item", true],
"Separator"
],
"ConditionMenu":
[
"Separator",
[0, "Are two numbers equal?"]
],
"ExpressionMenu":
[
"Separator",
[0, "Add two numbers"],
[1, "Hello world"],
"Separator"
],
"Actions":
[
{ "Title": "Action Example with parameter %0",
"Parameters":
[
["Integer", "Example Parameter"]
]
},
{ "Title": "Second Action Example"
}
],
"Conditions":
[
{ "Title": "%o: Are %0 and %1 equal?",
"Parameters":
[
["Integer", "First number"],
["Integer", "Second number"]
],
"Triggered": false
}
],
"Expressions":
[
{ "Title": "Add(",
"Returns": "Integer",
"Parameters":
[
["Integer", "First number"],
["Integer", "Second number"]
]
},
{ "Title": "HelloWorld$(",
"Returns": "Text"
}
]
}The first main section of the JSON is the About section:
"About":
{
"Name": "EDIF Template Object",
"Author": "Your Name",
"Copyright": "Copyright © 2012 Your Name",
"Comment": "A sentence or two to describe your extension,\nwith up to four lines of text.",
"URL": "http://www.example.com/",
"Help": "Help/My New EDIF Extension/Help.chm",
"Identifier": "X&pl"
}Comment is the description text shown at the bottom of the Insert New Object dialog in MMF2. This textarea is 4 lines tall without scrollbars, and it has line wrapping, so try to keep to a minimum of text and lines - not everyone has the same width and height for the dialog as you do.
URL and Help are your website and extension help file, respectively, and are displayed in the information properties tab of your extension. The help file path is relative to the MMF2 root directory.
Identifier is used by MMF2 to keep rack of your extension in various ways, and shot not change once decided. It can be any four characters (it is always stored as a 32-bit number) and it should be unique - having two different extensions with the same identifier can cause issues when both are in use in MMF2.
Writing in progress...