Eden Editor Event Handlers – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(Page lifting)
Line 1: Line 1:
__NOEDITSECTION__
__NOEDITSECTION__
[[Eden Editor]] event handlers. When added, they will remain until Eden Editor is closed. Playing preview will not erase them.
{{SideTOC}}


{{Horizontoc|include=3|also=nonumtoc}}
== Editor Event Handlers ==
[[Eden Editor]] Event Handlers are added to the editor instance and will remain active for the duration of a session.
Launching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance.


== Editor Event Handlers ==
=== Related commands ===
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:
* [[add3DENEventHandler]]
* [[add3DENEventHandler]]
* [[remove3DENEventHandler]]
* [[remove3DENEventHandler]]
'''Example:'''
add3DENEventHandler ["onUndo",{[[hint]] "Undo";}]


=== Config ===
=== Config ===
Alternatively, you can define event handlers directly in the config. Use your custom section (<span style="color:green;">mySection</span> in the example) to prevent overriding handlers from other sources.
Alternatively, you can define event handlers directly in the config.
Handlers defined here will be added automatically when Eden Editor is opened.
Use your custom section (<span style="font-color: #00F; font-weight: bold;">mySection</span> in the example) to prevent overriding handlers from other sources.
class Cfg3DEN
Handlers defined here will automatically be added when Eden Editor is opened.
{
<syntaxhighlight lang="cpp">
class EventHandlers
class Cfg3DEN
{
{
class <span style="color:green;">mySection</span>
class EventHandlers
{
{
onUndo = "hint 'Undo';";
class mySection
{{codecomment|// <handlerName> <nowiki>=</nowiki> <handlerExpression>}}
{
};
onUndo = "hint 'Undo';";
};
// <handlerName> = <handlerExpression>
};
};
};
};
</syntaxhighlight>


=== List ===
=== Events ===
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.
{{note|Most handlers don't receive any arguments.
{| class="wikitable sortable"
That is intended, because in most cases, required data can be obtained either using [[get3DENActionState]], or by specialized 'get' commands.}}
! Class
{{Cfg ref|start}}
! class="unsortable" | Description
{{Cfg ref|abc}}
! class="unsortable" | Arguments
|-
| <!-- Title -->
==== OnConnectingStart ====
==== OnConnectingStart ====
| <!-- Description -->
When [[Eden_Editor:_Connecting|Connecting]] operation is initiated.
When [[Eden_Editor:_Connecting|Connecting]] operation is initiated.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[<class>,<from>]
add3DENEventHandler ["OnConnectingStart", {
params ["_class", "_from"];
}];
</syntaxhighlight>
 
* class: [[Config]] - connection config class
* class: [[Config]] - connection config class
* from: [[Array of Eden Entities]]
* from: [[Array of Eden Entities]]
|-
 
| <!-- Title -->
 
==== OnConnectingEnd ====
==== OnConnectingEnd ====
| <!-- Description -->
When [[Eden_Editor:_Connecting|Connecting]] operation is terminated, no matter if it was confirmed or canceled.
When [[Eden_Editor:_Connecting|Connecting]] operation is terminated, no matter if it was confirmed or canceled.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[<class>,<from>,<to>]
add3DENEventHandler ["OnConnectingEnd", {
params ["_class", "_from", "_to"];
}];
</syntaxhighlight>
 
* class: Config - connection config class
* class: Config - connection config class
* from: Array of 3DEN entities
* from: Array of 3DEN entities
* to: [[Eden Entity]] (when connecting was successful) or nil (when connecting was terminated)
* to: [[Eden Entity]] (when connecting was successful) or nil (when connecting was terminated)
|-
 
| <!-- Title -->
 
==== OnCopy ====
==== OnCopy ====
| <!-- Description -->
When entities are copied.<br />
When entities are copied.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnCut ====
==== OnCut ====
| <!-- Description -->
When entities are cut.<br />
When entities are cut.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnDeleteUnits ====
==== OnDeleteUnits ====
| <!-- Description -->
When entities are deleted.<br />
When entities are deleted.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnEntityMenu ====
==== OnEntityMenu ====
| <!-- Description -->
When [[Eden_Editor:_Entity_Context_Menu|Entity Context Menu]] is opened.
When [[Eden_Editor:_Entity_Context_Menu|Entity Context Menu]] is opened.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[position, entity, listPath]
add3DENEventHandler ["OnEntityMenu", {
params ["_position", "_entity", "_listPath"];
}];
</syntaxhighlight>
 
* position: [[Array]] - [[Position]] where user clicked to open the menu.
* position: [[Array]] - [[Position]] where user clicked to open the menu.
** Entity position when clicked on an entity.
** 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.)
** 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]]
* entity: [[Eden Entity]]
** Nil when clicked on empty space
** Nil when clicked on empty space
* listPath: [[Array]] - UI tree path when clicked on entity in the [[Eden Editor: Entity List|Entity List]].
* listPath: [[Array]] - UI tree path when clicked on entity in the [[Eden Editor: Entity List|Entity List]].
** Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)
** Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)
|-
 
| <!-- Title -->
 
==== OnGridChange ====
==== OnGridChange ====
| <!-- Description -->
When grid changes, either using [[Eden Editor: Toolbar|Toolbar]] option, ot by scripting command [[set3DENGrid]].
When grid changes, either using [[Eden Editor: Toolbar|Toolbar]] option, ot by scripting command [[set3DENGrid]].
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[gridType, gridValue]
add3DENEventHandler ["OnGridChange", {
params ["_gridType", "_gridValue"];
}];
</syntaxhighlight>
 
* gridType: [[String]] - can be "translation", "rotation" or "scaling"
* gridType: [[String]] - can be "translation", "rotation" or "scaling"
* gridValue: [[Number]]
* gridValue: [[Number]]
|-
 
| <!-- Title -->
 
==== OnHistoryChange ====
==== OnHistoryChange ====
| <!-- Description -->
When history changes.<br />
When history changes.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMapClosed ====
==== OnMapClosed ====
| <!-- Description -->
When map is closed.<br />
When map is closed.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMapOpened ====
==== OnMapOpened ====
| <!-- Description -->
When map is opened.<br />
When map is opened.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMessage ====
==== OnMessage ====
| <!-- Description -->
Handler used for showing on-screen notifications, triggered by various range of events.
Handler used for showing on-screen notifications, triggered by various range of events.
Message IDs:
Message IDs:
*0 - Mission saved
* 0 - Mission saved
*1 - Mission autosaved
* 1 - Mission autosaved
*2 - Trying to move a character into full vehicle
* 2 - Trying to move a character into full vehicle
*3 - Moved character into enemy vehicle
* 3 - Moved character into enemy vehicle
*4 - Trying to run mission without any player
* 4 - Trying to run mission without any player
*5 - Mission exported to SP
* 5 - Mission exported to SP
*6 - Mission exported to MP
* 6 - Mission exported to MP
*7 - Attempting to delete a default layer
* 7 - Attempting to delete a default layer
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[messageID]
add3DENEventHandler ["OnMessage", {
params ["_messageID"];
}];
</syntaxhighlight>
* messageID: [[Number]]
* messageID: [[Number]]
|-
 
| <!-- Title -->
 
==== OnMissionAutosave ====
==== OnMissionAutosave ====
| <!-- Description -->
When scenario is autosaved.<br />
When scenario is autosaved.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionLoad ====
==== OnMissionLoad ====
| <!-- Description -->
When scenario is loaded.<br />
When scenario is loaded.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionNew ====
==== OnMissionNew ====
| <!-- Description -->
When new scenario is started. Executed also when Eden is opened with an empty scenario.<br />
When new scenario is started. Executed also when Eden is opened with an empty scenario.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionPreview ====
==== OnMissionPreview ====
| <!-- Description -->
When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.
When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[objects, groups, waypoints, markers]
add3DENEventHandler ["OnMissionPreview", {
params ["_objects", "_groups", "_waypoints", "_markers"];
}];
</syntaxhighlight>
 
* objects: Array
* objects: Array
* groups: Array
* groups: Array
Line 173: Line 168:
* entity: [[Object]], [[Group]], [[Array]] or [[String]]
* entity: [[Object]], [[Group]], [[Array]] or [[String]]
* ID: [[Number]]
* ID: [[Number]]
|-
 
| <!-- Title -->
 
==== OnMissionListChange ====
==== OnMissionListChange ====
| <!-- Description -->
When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.<br />
When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionPreviewEnd ====
==== OnMissionPreviewEnd ====
| <!-- Description -->
When preview ends and user returns back to Eden Editor.<br />
When preview ends and user returns back to Eden Editor.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionSave ====
==== OnMissionSave ====
| <!-- Description -->
When scenario is saved.<br />
When scenario is saved.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMissionSaveAs ====
==== OnMissionSaveAs ====
| <!-- Description -->
When ''Save As'' action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).<br />
When ''Save As'' action is triggered (i.e., Save window is opened, but the mission is not necessarily saved yet).
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnModeChange ====
==== OnModeChange ====
| <!-- Description -->
When editing mode is changed (i.e. from Objects to Triggers).<br />
When editing mode is changed (i.e., from Objects to Triggers).
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnMoveGridToggle ====
==== OnMoveGridToggle ====
| <!-- Description -->
When '''translation''' grid is toggled on or off.<br />
When '''translation''' grid is toggled on or off.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnPaste ====
==== OnPaste ====
| <!-- Description -->
When entities are pasted.<br />
When entities are pasted.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnPasteUnitOrig ====
==== OnPasteUnitOrig ====
| <!-- Description -->
When entities are pasted on their original positions.<br />
When entities are pasted on their original positions.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnRedo ====
==== OnRedo ====
| <!-- Description -->
When undo operation is redone.<br />
When undo operation is redone.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnRotateGridToggle ====
==== OnRotateGridToggle ====
| <!-- Description -->
When '''rotation''' grid is toggled on or off.<br />
When '''rotation''' grid is toggled on or off.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnSelectionChange ====
==== OnSelectionChange ====
| <!-- Description -->
When entity selection changes. Use [[get3DENSelected]] to return currently selected entities.<br />
When entity selection changes. Use [[get3DENSelected]] to return currently selected entities.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnScaleGridToggle ====
==== OnScaleGridToggle ====
| <!-- Description -->
When '''area scaling''' grid is toggled on or off.<br />
When '''area scaling''' grid is toggled on or off.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnSearchCreate ====
==== OnSearchCreate ====
| <!-- Description -->
When "SearchCreate" action is triggered (e.g. when pressing Ctrl+Shift+F).<br />
When "SearchCreate" action is triggered (e.g., when pressing Ctrl+Shift+F).
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnSearchEdit ====
==== OnSearchEdit ====
| <!-- Description -->
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).<br />
When "SearchEdit" action is triggered (e.g., when pressing Ctrl+F).
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnServerToggle ====
==== OnServerToggle ====
| <!-- Description -->
When server is created or destroyed from the preview.<br />
When server is created or destroyed from the preview.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnSubmodeChange ====
==== OnSubmodeChange ====
| <!-- Description -->
When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.<br />
When submode (e.g., BLUFOR or OFPOR for Objects, or Modules for Systems) changes.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnSurfaceSnapToggle ====
==== OnSurfaceSnapToggle ====
| <!-- Description -->
When surface snap settings are changed.<br />
When surface snap settings are changed.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnTerrainNew ====
==== OnTerrainNew ====
| <!-- Description -->
When new terrain is loaded. Executed also when Eden is opened.<br />
When new terrain is loaded. Executed also when Eden is opened.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnToggleMapTextures ====
==== OnToggleMapTextures ====
| <!-- Description -->
When map textures are toggled on or off.<br />
When map textures are toggled on or off.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnTogglePlaceEmptyVehicle ====
==== OnTogglePlaceEmptyVehicle ====
| <!-- Description -->
When the ''Place vehicles with crew'' is toggled on/off in Objects mode.<br />
When the ''Place vehicles with crew'' is toggled on/off in Objects mode.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnUndo ====
==== OnUndo ====
| <!-- Description -->
When an operation is undone.<br />
When an operation is undone.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnVerticalToggle ====
==== OnVerticalToggle ====
| <!-- Description -->
When vertical mode settings are changed.<br />
When vertical mode settings are changed.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetArea ====
==== OnWidgetArea ====
| <!-- Description -->
When [[Eden_Editor:_Transformation_Widget|area widget]] is selected.<br />
When [[Eden_Editor:_Transformation_Widget|area widget]] is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetNone ====
==== OnWidgetNone ====
| <!-- Description -->
When no [[Eden_Editor:_Transformation_Widget|widget]] is selected.<br />
When no [[Eden_Editor:_Transformation_Widget|widget]] is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetRotation ====
==== OnWidgetRotation ====
| <!-- Description -->
When [[Eden_Editor:_Transformation_Widget|rotation widget]] is selected.<br />
When [[Eden_Editor:_Transformation_Widget|rotation widget]] is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetScale ====
==== OnWidgetScale ====
| <!-- Description -->
When [[Eden_Editor:_Transformation_Widget|scaling widget]] is selected.<br />
When [[Eden_Editor:_Transformation_Widget|scaling widget]] is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetToggle ====
==== OnWidgetToggle ====
| <!-- Description -->
When [[Eden_Editor:_Transformation_Widget|widget]] is toggled (i.e. browsing through all widget types)<br />
When [[Eden_Editor:_Transformation_Widget|widget]] is toggled (i.e., browsing through all widget types)
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWidgetTranslation ====
==== OnWidgetTranslation ====
| <!-- Description -->
When [[Eden_Editor:_Transformation_Widget|translation widget]] is selected.<br />
When [[Eden_Editor:_Transformation_Widget|translation widget]] is selected.
''No arguments''
| <!-- Arguments -->
 
''None''
 
|-
| <!-- Title -->
==== OnWorkspacePartSwitch ====
==== OnWorkspacePartSwitch ====
| <!-- Description -->
When [[Eden_Editor:_Scenario_Phases|scenario phase]] is selected.<br />
When [[Eden_Editor:_Scenario_Phases|scenario phase]] is selected.
''No arguments''
| <!-- Arguments -->
{{Cfg ref|end}}
''None''
|}




== Object Event Handlers ==
== Object Event Handlers ==
Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.
Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.<br />
{{Important|These handlers exist only for the duration of active workspace.
Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.}}


These handlers exist only for the duration of active workspace. Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.


=== List ===
=== Related commands ===
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="wikitable sortable"
* [[addEventHandler]]
! Class
* [[removeEventHandler]]
! class="unsortable" | Description
 
! class="unsortable" | Arguments
=== Events ===
|-
{{note|Most handlers don't receive any arguments.
| <!-- Title -->
That is intended, because in most cases, required data can be obtained either using [[get3DENActionState]], or by specialized 'get' commands.}}
{{Cfg ref|start}}
{{Cfg ref|abc}}
==== AttributesChanged3DEN ====
==== AttributesChanged3DEN ====
| <!-- Description -->
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.
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.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[object]
add3DENEventHandler ["AttributesChanged3DEN", {
params ["_object"];
}];
</syntaxhighlight>
* object: [[Object]] - affected object
* object: [[Object]] - affected object
|-
 
| <!-- Title -->
 
==== ConnectionChanged3DEN ====
==== ConnectionChanged3DEN ====
| <!-- Description -->
When a [[Eden Editor: Connecting|connection]] is added or removed from an object.
When a [[Eden Editor: Connecting|connection]] is added or removed from an object.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[object]
add3DENEventHandler ["ConnectionChanged3DEN", {
params ["_object"];
}];
</syntaxhighlight>
* object: [[Object]] - affected object
* object: [[Object]] - affected object
|-
 
| <!-- Title -->
 
==== RegisteredToWorld3DEN ====
==== RegisteredToWorld3DEN ====
| <!-- Description -->
When object is re-added to the scenario after undoing a delete operation.
When object is re-added to the scenario after undoing a delete operation.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[object]
add3DENEventHandler ["RegisteredToWorld3DEN", {
params ["_object"];
}];
</syntaxhighlight>
* object: [[Object]] - affected object
* object: [[Object]] - affected object
|-
 
| <!-- Title -->
 
==== UnregisteredFromWorld3DEN ====
==== UnregisteredFromWorld3DEN ====
| <!-- Description -->
When object is removed from the scenario. That happens when you delete it, but also when you undo [[Eden Editor: Entity Placing|placement]] operation.
When object is removed from the scenario. That happens when you delete it, but also when you undo [[Eden Editor: Entity Placing|placement]] operation.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[object]
add3DENEventHandler ["UnregisteredFromWorld3DEN", {
params ["_object"];
}];
</syntaxhighlight>
* object: [[Object]] - affected object
* object: [[Object]] - affected object
|-
 
| <!-- Title -->
 
==== Dragged3DEN ====
==== Dragged3DEN ====
| <!-- Description -->
When object is dragged.
When object is dragged.
| <!-- Arguments -->
<syntaxhighlight lang="cpp">
[object]
add3DENEventHandler ["Dragged3DEN", {
params ["_object"];
}];
</syntaxhighlight>
* object: [[Object]] - affected object
* object: [[Object]] - affected object
|}
{{Cfg ref|end}}





Revision as of 20:47, 19 May 2018

Template:SideTOC

Editor Event Handlers

Eden Editor Event Handlers are added to the editor instance and will remain active for the duration of a session. Launching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance.

Related commands

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 automatically be added when Eden Editor is opened.

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

Events

Template:note Template:Cfg ref Template:Cfg ref

OnConnectingStart

When Connecting operation is initiated.

add3DENEventHandler ["OnConnectingStart", {
	params ["_class", "_from"];
}];


OnConnectingEnd

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

add3DENEventHandler ["OnConnectingEnd", {
	params ["_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.
No arguments


OnCut

When entities are cut.
No arguments


OnDeleteUnits

When entities are deleted.
No arguments


OnEntityMenu

When Entity Context Menu is opened.

add3DENEventHandler ["OnEntityMenu", {
	params ["_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.

add3DENEventHandler ["OnGridChange", {
	params ["_gridType", "_gridValue"];
}];
  • gridType: String - can be "translation", "rotation" or "scaling"
  • gridValue: Number


OnHistoryChange

When history changes.
No arguments


OnMapClosed

When map is closed.
No arguments


OnMapOpened

When map is opened.
No arguments


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
add3DENEventHandler ["OnMessage", {
	params ["_messageID"];
}];


OnMissionAutosave

When scenario is autosaved.
No arguments


OnMissionLoad

When scenario is loaded.
No arguments


OnMissionNew

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


OnMissionPreview

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

add3DENEventHandler ["OnMissionPreview", {
	params ["_objects", "_groups", "_waypoints", "_markers"];
}];
  • objects: Array
  • groups: Array
  • waypoints: Array
  • markers: Array

Each array is in format:

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


OnMissionListChange

When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.
No arguments


OnMissionPreviewEnd

When preview ends and user returns back to Eden Editor.
No arguments


OnMissionSave

When scenario is saved.
No arguments


OnMissionSaveAs

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


OnModeChange

When editing mode is changed (i.e. from Objects to Triggers).
No arguments


OnMoveGridToggle

When translation grid is toggled on or off.
No arguments


OnPaste

When entities are pasted.
No arguments


OnPasteUnitOrig

When entities are pasted on their original positions.
No arguments


OnRedo

When undo operation is redone.
No arguments


OnRotateGridToggle

When rotation grid is toggled on or off.
No arguments


OnSelectionChange

When entity selection changes. Use get3DENSelected to return currently selected entities.
No arguments


OnScaleGridToggle

When area scaling grid is toggled on or off.
No arguments


OnSearchCreate

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


OnSearchEdit

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


OnServerToggle

When server is created or destroyed from the preview.
No arguments


OnSubmodeChange

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


OnSurfaceSnapToggle

When surface snap settings are changed.
No arguments


OnTerrainNew

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


OnToggleMapTextures

When map textures are toggled on or off.
No arguments


OnTogglePlaceEmptyVehicle

When the Place vehicles with crew is toggled on/off in Objects mode.
No arguments


OnUndo

When an operation is undone.
No arguments


OnVerticalToggle

When vertical mode settings are changed.
No arguments


OnWidgetArea

When area widget is selected.
No arguments


OnWidgetNone

When no widget is selected.
No arguments


OnWidgetRotation

When rotation widget is selected.
No arguments


OnWidgetScale

When scaling widget is selected.
No arguments


OnWidgetToggle

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


OnWidgetTranslation

When translation widget is selected.
No arguments


OnWorkspacePartSwitch

When scenario phase is selected.
No arguments Template:Cfg ref


Object Event Handlers

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

These handlers exist only for the duration of active workspace. Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.


Related commands

Events

Template:note Template:Cfg ref Template:Cfg ref

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.

add3DENEventHandler ["AttributesChanged3DEN", {
	params ["_object"];
}];
  • object: Object - affected object


ConnectionChanged3DEN

When a connection is added or removed from an object.

add3DENEventHandler ["ConnectionChanged3DEN", {
	params ["_object"];
}];
  • object: Object - affected object


RegisteredToWorld3DEN

When object is re-added to the scenario after undoing a delete operation.

add3DENEventHandler ["RegisteredToWorld3DEN", {
	params ["_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.

add3DENEventHandler ["UnregisteredFromWorld3DEN", {
	params ["_object"];
}];
  • object: Object - affected object


Dragged3DEN

When object is dragged.

add3DENEventHandler ["Dragged3DEN", {
	params ["_object"];
}];
  • object: Object - affected object

Template:Cfg ref