Eden Editor Event Handlers – Arma 3

From Bohemia Interactive Community
Revision as of 10:30, 5 November 2015 by Str (talk | contribs)
Jump to navigation Jump to search

Eden Editor event handlers. When added, they will remain until Eden Editor is closed. Playing preview will not erase them.

Template:Horizontoc

Editor Event Handlers

Editor handlers are added to the editor instance and will remain active for the duration of a session. Launching a preview won't erase them, but leaving to main menu will close the editor and erase all handlers with it.

Scripting

Commands:

Example:

add3DENEventHandler ["onUndo",{hint "Undo";}]

Config

Alternatively, you can define event handlers directly in the config. Use your custom section (mySection in the example) to prevent overriding handlers from other sources. Handlers defined here will be added automatically when Eden Editor is opened.

class Cfg3DEN
{
	class EventHandlers
	{
		class mySection
		{
			onUndo = "hint 'Undo';";
			// <handlerName> = <handlerExpression>
		};
	};
};

List

Most handlers don't receive any arguments. That is intended, because in most cases, required data can be obtained either using get3DENActionState, or by specialized 'get' commands.

Class Description Arguments

OnConnectingStart

When Connecting operation is initiated.

[<class>,<from>]

OnConnectingEnd

When Connecting operation is terminated, no matter if it was confirmed or canceled.

[<class>,<from>,<to>]
  • class: Config - connection config class
  • from: Array of 3DEN entities
  • to: Eden Entity (when connecting was successful) or nil (when connecting was terminated)

OnCopy

When entities are copied.

None

OnCut

When entities are cut.

None

OnDeleteUnits

When entities are deleted.

None

OnEntityMenu

When Entity Context Menu is opened.

[position, entity, listPath]
  • position: Array - Position where user clicked to open the menu.
    • Entity position when clicked on an entity.
    • Empty array when clicked on something that doesn't have position (i.e., abstract folder in Edit list like BLUFOR, Trigger, etc.)
  • entity: Eden Entity
    • Nil when clicked on empty space
  • listPath: Array - UI tree path when clicked on entity in the Entity List.
    • Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)

OnGridChange

When grid changes, either using Toolbar option, ot by scripting command set3DENGrid.

[gridType, gridValue]
  • gridType: String - can be "translation", "rotation" or "scaling"
  • gridValue: Number

OnMapClosed

When map is closed.

None

OnMapOpened

When map is opened.

None

OnMessage

Handler used for showing on-screen notifications, triggered by various range of events. Message IDs:

  • 0 - Mission saved
  • 1 - Mission autosaved
  • 2 - Trying to move a character into full vehicle
  • 3 - Moved character into enemy vehicle
  • 4 - Trying to run mission without any player
  • 5 - Mission exported to SP
  • 6 - Mission exported to MP
  • 7 - Attempting to delete a default layer
[messageID]

OnMissionLoad

When a scenario is loaded.

None

OnMissionNew

When new scenario is started. Executed also when Eden is opened with an empty scenario.

None

OnMissionPreview

When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.

[objects, groups, waypoints, markers]
  • objects: Array
  • groups: Array
  • waypoints: Array
  • markers: Array

Each array is in format:

[entity1, id1, entity2, id2, ..., entityN, idN]

OnMissionPreviewEnd

When preview ends and user returns back to Eden Editor.

None

OnMissionSave

When a scenario is saved.

None

OnMissionSaveAs

None

OnModeChange

When Save As action is triggered (i.e., Save window is opened, but the mission is not necessarily saved yet).

None

OnMoveGridToggle

When translation grid is toggled on or off.

None

OnPaste

When entities are pasted.

None

OnPasteUnitOrig

When entities are pasted on their original positions.

None

OnRedo

When undo operation is redone.

None

OnRotateGridToggle

When rotation grid is toggled on or off.

None

OnScaleGridToggle

When area scaling grid is toggled on or off.

None

OnSearchCreate

When "SearchCreate" action is triggered (e.g., when pressing Ctrl+Shift+F).

None

OnSearchEdit

When "SearchEdit" action is triggered (e.g., when pressing Ctrl+F).

None

OnServerToggle

When server is created or destroyed fro the preview.

None

OnSubmodeChange

When submode (e.g., BLUFOR or OFPOR for Objects, or Modules for Systems) changes.

None

OnSurfaceSnapToggle

When surface snap settings are changed.

None

OnTerrainNew

When new terrain is loaded. Executed also when Eden is opened.

None

OnToggleMapTextures

When map textures are toggled on or off.

None

OnUndo

When an operation is undone.

None

OnVerticalToggle

When vertical mode settings are changed.

None

OnWidgetNone

When no widget is selected.

None

OnWidgetRotation

When rotation widget is selected.

None

OnWidgetScale

When area scaling widget is selected.

None

OnWidgetToggle

When widget is toggled (i.e., browsing through all widget types)

None

OnWidgetTranslation

When translation widget is selected.

None

OnWorkspacePartSwitch

When scenario phase is selected.

None


Object Event Handlers

Editor specific event handlers can be also added directly to objects, using addEventHandler command.

List

Most handlers don't receive any arguments. That is intended, because in most cases, required data can be obtained either using get3DENActionState, or by specialized 'get' commands.

Class Description Arguments

AttributesChanged3DEN

When object's attributes are changed. Can happen when moving or rotating the object, when changing its attributes in attributes window, or when some scripts change attributes using set3DENAttributes command.

[object]
  • object: Object - affected object

ConnectionChanged3DEN

When a connection is added or removed from an object.

[object]
  • object: Object - affected object

RegisteredToWorld3DEN

When object is added to the scenario. That happens when you place it, but also when you paste it after copying, or when redoing placement operation after it was undone.

[object]
  • object: Object - affected object

UnregisteredFromWorld3DEN

When object is removed from the scenario. That happens when you delete it, but also when you undo placement operation.

[object]
  • object: Object - affected object