API for editor - Hook

The editor can be modified to add entries and save the data. The data are then used in the game. Managing editor is in several parts.

Generality

To add or edit the code is the following :

Plugin.hook(ID, ACTION, [PARAMETERS], function(layout, attr) {

});
  • ID is identifier of hook
  • ACTION is the action to be performed
  • PARAMETRES (in some cases) parameters are attributed to the action

Called function has two parameters:

  • layout for the layout of elements. It is a Layout object (see below)
  • attr the data for each field. In the case of an addition, these data are blank.

Examples are listed below

Database

In the database, the identifier is always database

List of identifiers of existing tabs :

  • actors
  • classes
  • skills
  • items
  • weapons
  • amors
  • states
  • animations
  • tilesets
  • autotiles
  • actions
  • common_events
  • dynamic_events
  • switches
  • variables
  • elements

Add a tab :

Plugin.hook("database", "add_tab", {
    name: "Foo",
    id: "foo"
    // ,dynamic_event: true ou false,
}, function(layout, attr) {

});

The action is add_tab and has two mandatory parameters:

  • name : Tab name
  • id : The identifier (lowercase preferably allowing you to retrieve data from the game (see API server)
  • dynamic_event (optional and false by default) : indicates whether the data used to define an event type dynamically

To add a tab after an existing tab :

Plugin.hook("database", "add_after_ID", {
    name: "Foo",
    id: "foo"
    // ,dynamic_event: true ou false,
}, function(layout, attr) {

});
  • ID : Identifying the existing tab

Add elements to an existing tab

Plugin.hook("database", ID, function(layout, attr) {

});
  • ID : Identifying the existing tab

Event window and dynamic event

The identifier is always event

Add a tab in the event

Plugin.hook("event", "add_tab", {
    name: "Foo"
}, function(layout, attr) {

});

Add elements in Conditions

Plugin.hook("event", "conditions", function(layout, attr) {

});

Add elements in Appearances

Plugin.hook("event", "graphic", function(layout, attr) {

});

Add elements in Movement

Plugin.hook("event", "movement", function(layout, attr) {

});

Add elements in Switches

Plugin.hook("event", "trigger", function(layout, attr) {

});

Add elements in Options

Plugin.hook("event", "options", function(layout, attr) {

});

Menus

The identifier is always menus

Add elements in Switch

Plugin.hook("menus", "trigger", function(layout, attr, scene) {

});

Add elements in Conditions

Plugin.hook("menus", "condition", function(layout, attr, scene) {

});

Add elements in Graphism

Plugin.hook("menus", "graphism", function(layout, attr, scene) {

});

Add elements in Graphim parameters

Plugin.hook("menus", "add_param_graphism", function(layout, attr, params) {

});
  • params : Object with :
    • el : Element
    • scene : Scene
    • name: Nanme
    • container: the Div

Global Settings

The identifier is always settings

Add elements in Game

Plugin.hook("settings", "game", function(layout, attr) {

});

Add elements in Screen

Plugin.hook("settings", "screen", function(layout, attr) {

});

Add elements in Input

Plugin.hook("settings", "input", function(layout, attr) {

});

Add elements in Other

Plugin.hook("settings", "other", function(layout, attr) {

});