API for editor - Event Command

To add a new command :

EventCommand.add("ID", "text_1", "text_2", "group", function(layout, attr) {

}, params);
  • ID is the identifier of the command. It should be capitalized with no spaces. This will use the command in the game with RPG JS.
  • text_1 is the display of text in the command list event.
  • text_2 is the text on the button
  • group is the membership of the control group (tab). You can add here but existing :
    • party
    • maps
    • actor
    • music
    • other

The function is called when the window is opened after clicking the button. There are two usual parameters * layout : for layout (see the chapter on layout) * attr : each data element of the layout

params is an additional object parameters to the command. It has : * width : the width of the window in pixels * height : the height of the window in pixels

Exemple

EventCommand.add("MY_COMMAND", "<b>Ma commande</b>", "Une commande", "party", function(layout, attr) {

        layout.addTextArea("text", attr.text, {
        label: "Simple text",
        width: "300px",
        height: "100px"
    });

}, {
    width: 365,
    height: 250
});

Here is the result :

Commande

The button is added in the first tab. When clicked :

Commande

Finally, confirm :

Commande

Create a group (add a tab)

EventCommand.addGroup("mygroup", "Groupe", "color");
  • mygroup is the identifier of the group
  • Groupe is the name of the group
  • color is the hexadecimal color will appear in the list of commands