Eden Editor Event Handlers – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add SQF examples)
m (Some wiki formatting)
Line 1: Line 1:
__NOEDITSECTION__
__NOEDITSECTION__
{{TOC|side}}
{{TOC|side}}
== Editor Event Handlers ==


== Editor Event Handlers ==
[[Eden Editor]] Event Handlers are added to the editor instance and will remain active for the duration of a session.
[[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.
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 ===
=== Related commands ===
* [[add3DENEventHandler]]
* [[add3DENEventHandler]]
* [[remove3DENEventHandler]]
* [[remove3DENEventHandler]]


=== Event Scripts ===
=== Event Scripts ===
* See [[Event_Scripts#init3DEN.sqf|init3DEN.sqf]]
 
* See [[Event Scripts#init3DEN.sqf|init3DEN.sqf]]
 
=== Config ===
=== Config ===
Alternatively, you can define event handlers directly in the config.
Alternatively, you can define event handlers directly in the config.
Use your custom section (<span style="color: #00F; font-weight: bold;">mySection</span> in the example) to prevent overriding handlers from other sources.
Use your custom section (<span style="color: #00F; font-weight: bold;">mySection</span> in the example) to prevent overriding handlers from other sources.
Line 31: Line 35:


=== Events ===
=== Events ===
{{Feature|Informative|Most handlers do not receive any arguments.
{{Feature|Informative|Most handlers do not receive any arguments.
This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}}
This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}}
{{ConfigPage|start}}
{{ConfigPage|start}}
{{ConfigPage|abc}}
{{ConfigPage|abc}}
==== OnConnectingStart ====
==== OnConnectingStart ====
When [[Eden_Editor:_Connecting|Connecting]] operation is initiated.
When [[Eden Editor: Connecting|Connecting]] operation is initiated.
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnConnectingStart", {
add3DENEventHandler ["OnConnectingStart", {
params ["_class", "_from"];
params ["_class", "_from"];
}];
}];
</syntaxhighlight>
</sqf>


* class: [[Config]] - connection config class
* class: [[Config]] - connection config class
Line 48: Line 54:


==== OnConnectingEnd ====
==== OnConnectingEnd ====
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.
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnConnectingEnd", {
add3DENEventHandler ["OnConnectingEnd", {
params ["_class", "_from", "_to"];
params ["_class", "_from", "_to"];
}];
}];
</syntaxhighlight>
</sqf>


* class: Config - connection config class
* class: Config - connection config class
Line 62: Line 68:
==== OnCopy ====
==== OnCopy ====
Fires when entities are copied.<br>
Fires when entities are copied.<br>
Also fires when entities are cut, but unlike {{Link|#OnCut}}, {{Link|#OnCopy}} fires before the entities are deleted, meaning the entities are still accessible with [[get3DENSelected]].<br>
Also fires when entities are cut, but unlike {{Link|#OnCut}}, {{Link|#OnCopy}} fires before the entities are deleted, meaning the entities are still accessible with [[get3DENSelected]].
''No arguments''
<sqf>
add3DENEventHandler ["OnCopy", {
// no arguments
}];
</sqf>




==== OnCut ====
==== OnCut ====
Fires when entities are cut (after the entities have been deleted).<br>
Fires when entities are cut (after the entities have been deleted).
<sqf>
<sqf>
add3DENEventHandler ["OnCut", {
add3DENEventHandler ["OnCut", {
Line 76: Line 86:


==== OnDeleteUnits ====
==== OnDeleteUnits ====
When entities are deleted.<br>
When entities are deleted.
<sqf>
<sqf>
add3DENEventHandler ["OnDeleteUnits", {
add3DENEventHandler ["OnDeleteUnits", {
Line 85: Line 95:


==== OnEntityMenu ====
==== OnEntityMenu ====
When [[Eden_Editor:_Entity_Context_Menu|Entity Context Menu]] is opened.
When [[Eden Editor: Entity Context Menu|Entity Context Menu]] is opened.
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnEntityMenu", {
add3DENEventHandler ["OnEntityMenu", {
params ["_position", "_entity", "_listPath"];
params ["_position", "_entity", "_listPath"];
}];
}];
</syntaxhighlight>
</sqf>


* position: [[Array]] - [[Position]] where user clicked to open the menu.
* position: [[Array]] - [[Position]] where user clicked to open the menu.
Line 103: Line 113:
==== OnGridChange ====
==== OnGridChange ====
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]].
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnGridChange", {
add3DENEventHandler ["OnGridChange", {
params ["_gridType", "_gridValue"];
params ["_gridType", "_gridValue"];
}];
}];
</syntaxhighlight>
</sqf>


* gridType: [[String]] - can be "translation", "rotation" or "scaling"
* gridType: [[String]] - can be "translation", "rotation" or "scaling"
Line 114: Line 124:


==== OnHistoryChange ====
==== OnHistoryChange ====
When history changes.<br>
When history changes.
<sqf>
<sqf>
add3DENEventHandler ["OnHistoryChange", {
add3DENEventHandler ["OnHistoryChange", {
Line 123: Line 133:


==== OnMapClosed ====
==== OnMapClosed ====
When map is closed.<br>
When map is closed.
<sqf>
<sqf>
add3DENEventHandler ["OnMapClosed", {
add3DENEventHandler ["OnMapClosed", {
Line 132: Line 142:


==== OnMapOpened ====
==== OnMapOpened ====
When map is opened.<br>
When map is opened.
<sqf>
<sqf>
add3DENEventHandler ["OnMapOpened", {
add3DENEventHandler ["OnMapOpened", {
Line 151: Line 161:
* 6 - Mission exported to MP
* 6 - Mission exported to MP
* 7 - Attempting to delete a default layer
* 7 - Attempting to delete a default layer
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnMessage", {
add3DENEventHandler ["OnMessage", {
params ["_messageID"];
params ["_messageID"];
}];
}];
</syntaxhighlight>
</sqf>
 
* messageID: [[Number]]
* messageID: [[Number]]




==== OnMissionAutosave ====
==== OnMissionAutosave ====
When scenario is autosaved.<br>
When scenario is autosaved.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionAutosave", {
add3DENEventHandler ["OnMissionAutosave", {
Line 169: Line 180:


==== OnMissionLoad ====
==== OnMissionLoad ====
When scenario is loaded.<br>
When scenario is loaded.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionLoad", {
add3DENEventHandler ["OnMissionLoad", {
Line 178: Line 189:


==== OnMissionNew ====
==== OnMissionNew ====
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.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionNew", {
add3DENEventHandler ["OnMissionNew", {
Line 188: Line 199:
==== OnMissionPreview ====
==== OnMissionPreview ====
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.
<syntaxhighlight lang="cpp">
<sqf>
add3DENEventHandler ["OnMissionPreview", {
add3DENEventHandler ["OnMissionPreview", {
params ["_objects", "_groups", "_waypoints", "_markers"];
params ["_objects", "_groups", "_waypoints", "_markers"];
}];
}];
</syntaxhighlight>
</sqf>


* objects: Array
* objects: Array
Line 205: Line 216:


==== OnMissionListChange ====
==== 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.<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.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionListChange", {
add3DENEventHandler ["OnMissionListChange", {
Line 214: Line 225:


==== OnMissionPreviewEnd ====
==== OnMissionPreviewEnd ====
When preview ends and user returns back to Eden Editor.<br>
When preview ends and user returns back to Eden Editor.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionPreviewEnd", {
add3DENEventHandler ["OnMissionPreviewEnd", {
Line 223: Line 234:


==== OnMissionSave ====
==== OnMissionSave ====
When scenario is saved.<br>
When scenario is saved.
<sqf>
<sqf>
add3DENEventHandler ["OnMissionSave", {
add3DENEventHandler ["OnMissionSave", {
Line 232: Line 243:


==== OnMissionSaveAs ====
==== OnMissionSaveAs ====
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).
<sqf>
<sqf>
add3DENEventHandler ["OnMissionSaveAs", {
add3DENEventHandler ["OnMissionSaveAs", {
Line 241: Line 252:


==== OnModeChange ====
==== OnModeChange ====
When editing mode is changed (i.e. from Objects to Triggers).<br>
When editing mode is changed (i.e. from Objects to Triggers).
<sqf>
<sqf>
add3DENEventHandler ["OnModeChange", {
add3DENEventHandler ["OnModeChange", {
Line 250: Line 261:


==== OnMoveGridToggle ====
==== OnMoveGridToggle ====
When '''translation''' grid is toggled on or off.<br>
When '''translation''' grid is toggled on or off.
<sqf>
<sqf>
add3DENEventHandler ["OnMoveGridToggle", {
add3DENEventHandler ["OnMoveGridToggle", {
Line 259: Line 270:


==== OnPaste ====
==== OnPaste ====
When entities are pasted.<br>
When entities are pasted.
<sqf>
<sqf>
add3DENEventHandler ["OnPaste", {
add3DENEventHandler ["OnPaste", {
Line 268: Line 279:


==== OnPasteUnitOrig ====
==== OnPasteUnitOrig ====
When entities are pasted on their original positions.<br>
When entities are pasted on their original positions.
<sqf>
<sqf>
add3DENEventHandler ["OnPasteUnitOrig", {
add3DENEventHandler ["OnPasteUnitOrig", {
Line 277: Line 288:


==== OnRedo ====
==== OnRedo ====
When undo operation is redone.<br>
When undo operation is redone.
<sqf>
<sqf>
add3DENEventHandler ["OnRedo", {
add3DENEventHandler ["OnRedo", {
Line 286: Line 297:


==== OnRotateGridToggle ====
==== OnRotateGridToggle ====
When '''rotation''' grid is toggled on or off.<br>
When '''rotation''' grid is toggled on or off.
<sqf>
<sqf>
add3DENEventHandler ["OnRotateGridToggle", {
add3DENEventHandler ["OnRotateGridToggle", {
Line 295: Line 306:


==== OnSelectionChange ====
==== OnSelectionChange ====
When entity selection changes. Use [[get3DENSelected]] to return currently selected entities.<br>
When entity selection changes. Use [[get3DENSelected]] to return currently selected entities.
<sqf>
<sqf>
add3DENEventHandler ["OnSelectionChange", {
add3DENEventHandler ["OnSelectionChange", {
Line 304: Line 315:


==== OnScaleGridToggle ====
==== OnScaleGridToggle ====
When '''area scaling''' grid is toggled on or off.<br>
When '''area scaling''' grid is toggled on or off.
<sqf>
<sqf>
add3DENEventHandler ["OnScaleGridToggle", {
add3DENEventHandler ["OnScaleGridToggle", {
Line 313: Line 324:


==== OnSearchCreate ====
==== OnSearchCreate ====
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).
<sqf>
<sqf>
add3DENEventHandler ["OnSearchCreate", {
add3DENEventHandler ["OnSearchCreate", {
Line 322: Line 333:


==== OnSearchEdit ====
==== OnSearchEdit ====
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).<br>
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).
<sqf>
<sqf>
add3DENEventHandler ["OnSearchEdit", {
add3DENEventHandler ["OnSearchEdit", {
Line 331: Line 342:


==== OnServerToggle ====
==== OnServerToggle ====
When server is created or destroyed from the preview.<br>
When server is created or destroyed from the preview.
<sqf>
<sqf>
add3DENEventHandler ["OnServerToggle", {
add3DENEventHandler ["OnServerToggle", {
Line 340: Line 351:


==== OnSubmodeChange ====
==== OnSubmodeChange ====
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.
<sqf>
<sqf>
add3DENEventHandler ["OnSubmodeChange", {
add3DENEventHandler ["OnSubmodeChange", {
Line 349: Line 360:


==== OnSurfaceSnapToggle ====
==== OnSurfaceSnapToggle ====
When surface snap settings are changed.<br>
When surface snap settings are changed.
<sqf>
<sqf>
add3DENEventHandler ["OnSurfaceSnapToggle", {
add3DENEventHandler ["OnSurfaceSnapToggle", {
Line 358: Line 369:


==== OnTerrainNew ====
==== OnTerrainNew ====
When new terrain is loaded. Executed also when Eden is opened.<br>
When new terrain is loaded. Executed also when Eden is opened.
<sqf>
<sqf>
add3DENEventHandler ["OnTerrainNew", {
add3DENEventHandler ["OnTerrainNew", {
Line 367: Line 378:


==== OnToggleMapTextures ====
==== OnToggleMapTextures ====
When map textures are toggled on or off.<br>
When map textures are toggled on or off.
<sqf>
<sqf>
add3DENEventHandler ["OnToggleMapTextures", {
add3DENEventHandler ["OnToggleMapTextures", {
Line 376: Line 387:


==== OnTogglePlaceEmptyVehicle ====
==== OnTogglePlaceEmptyVehicle ====
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.
<sqf>
<sqf>
add3DENEventHandler ["OnTogglePlaceEmptyVehicle", {
add3DENEventHandler ["OnTogglePlaceEmptyVehicle", {
Line 385: Line 396:


==== OnUndo ====
==== OnUndo ====
When an operation is undone.<br>
When an operation is undone.
<sqf>
<sqf>
add3DENEventHandler ["OnUndo", {
add3DENEventHandler ["OnUndo", {
Line 394: Line 405:


==== OnVerticalToggle ====
==== OnVerticalToggle ====
When vertical mode settings are changed.<br>
When vertical mode settings are changed.
<sqf>
<sqf>
add3DENEventHandler ["OnVerticalToggle", {
add3DENEventHandler ["OnVerticalToggle", {
Line 403: Line 414:


==== OnWidgetArea ====
==== OnWidgetArea ====
When [[Eden_Editor:_Transformation_Widget|area widget]] is selected.<br>
When [[Eden Editor: Transformation Widget|area widget]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetArea", {
add3DENEventHandler ["OnWidgetArea", {
Line 412: Line 423:


==== OnWidgetNone ====
==== OnWidgetNone ====
When no [[Eden_Editor:_Transformation_Widget|widget]] is selected.<br>
When no [[Eden Editor: Transformation Widget|widget]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetNone", {
add3DENEventHandler ["OnWidgetNone", {
Line 421: Line 432:


==== OnWidgetRotation ====
==== OnWidgetRotation ====
When [[Eden_Editor:_Transformation_Widget|rotation widget]] is selected.<br>
When [[Eden Editor: Transformation Widget|rotation widget]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetRotation", {
add3DENEventHandler ["OnWidgetRotation", {
Line 430: Line 441:


==== OnWidgetScale ====
==== OnWidgetScale ====
When [[Eden_Editor:_Transformation_Widget|scaling widget]] is selected.<br>
When [[Eden Editor: Transformation Widget|scaling widget]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetScale", {
add3DENEventHandler ["OnWidgetScale", {
Line 439: Line 450:


==== OnWidgetToggle ====
==== OnWidgetToggle ====
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)
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetToggle", {
add3DENEventHandler ["OnWidgetToggle", {
Line 448: Line 459:


==== OnWidgetTranslation ====
==== OnWidgetTranslation ====
When [[Eden_Editor:_Transformation_Widget|translation widget]] is selected.<br>
When [[Eden Editor: Transformation Widget|translation widget]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWidgetTranslation", {
add3DENEventHandler ["OnWidgetTranslation", {
Line 457: Line 468:


==== OnWorkspacePartSwitch ====
==== OnWorkspacePartSwitch ====
When [[Eden_Editor:_Scenario_Phases|scenario phase]] is selected.<br>
When [[Eden Editor: Scenario Phases|scenario phase]] is selected.
<sqf>
<sqf>
add3DENEventHandler ["OnWorkspacePartSwitch", {
add3DENEventHandler ["OnWorkspacePartSwitch", {
Line 467: Line 478:


== Object Event Handlers ==
== Object Event Handlers ==
Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.<br>
Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.<br>
{{Feature|important|These handlers exist only for the duration of active workspace.
{{Feature|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.}}
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 ===
=== Related commands ===
Line 478: Line 489:


=== Events ===
=== Events ===
{{Feature|Informative|Most handlers do not receive any arguments.
 
{{Feature|informative|Most handlers do not receive any arguments.
This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}}
This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}}
{{ConfigPage|start}}
{{ConfigPage|start}}
{{ConfigPage|abc}}
{{ConfigPage|abc}}
Line 488: Line 501:
* When attributes get changed using scripting commands such as [[set3DENAttributes]] or [[set3DENAttribute]]
* When attributes get changed using scripting commands such as [[set3DENAttributes]] or [[set3DENAttribute]]
Unlike ''Dragged3DEN'' this event handler will not fire continuously but only when the attributes were changed '''and''' saved
Unlike ''Dragged3DEN'' this event handler will not fire continuously but only when the attributes were changed '''and''' saved
<syntaxhighlight lang="cpp">
<sqf>
edenObject addEventHandler ["AttributesChanged3DEN", {
edenObject addEventHandler ["AttributesChanged3DEN", {
params ["_object"];
params ["_object"];
}];
}];
</syntaxhighlight>
</sqf>
 
* object: [[Object]] - affected object
* object: [[Object]] - affected object


Line 498: Line 512:
==== ConnectionChanged3DEN ====
==== ConnectionChanged3DEN ====
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.
<syntaxhighlight lang="cpp">
<sqf>
edenObject addEventHandler ["ConnectionChanged3DEN", {
edenObject addEventHandler ["ConnectionChanged3DEN", {
params ["_object"];
params ["_object"];
}];
}];
</syntaxhighlight>
</sqf>
 
* object: [[Object]] - affected object
* object: [[Object]] - affected object


Line 508: Line 523:
==== RegisteredToWorld3DEN ====
==== RegisteredToWorld3DEN ====
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.
<syntaxhighlight lang="cpp">
<sqf>
edenObject addEventHandler ["RegisteredToWorld3DEN", {
edenObject addEventHandler ["RegisteredToWorld3DEN", {
params ["_object"];
params ["_object"];
}];
}];
</syntaxhighlight>
</sqf>
 
* object: [[Object]] - affected object
* object: [[Object]] - affected object


Line 518: Line 534:
==== UnregisteredFromWorld3DEN ====
==== UnregisteredFromWorld3DEN ====
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.
<syntaxhighlight lang="cpp">
<sqf>
edenObject addEventHandler ["UnregisteredFromWorld3DEN", {
edenObject addEventHandler ["UnregisteredFromWorld3DEN", {
params ["_object"];
params ["_object"];
}];
}];
</syntaxhighlight>
</sqf>
 
* object: [[Object]] - affected object
* object: [[Object]] - affected object


Line 528: Line 545:
==== Dragged3DEN ====
==== Dragged3DEN ====
When object is '''dragged''' and/or '''rotated'''. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.
When object is '''dragged''' and/or '''rotated'''. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.
<syntaxhighlight lang="cpp">
<sqf>
edenObject addEventHandler ["Dragged3DEN", {
edenObject addEventHandler ["Dragged3DEN", {
params ["_object"];
params ["_object"];
}];
}];
</syntaxhighlight>
</sqf>
 
* object: [[Object]] - affected object
* object: [[Object]] - affected object
{{ConfigPage|end}}
{{ConfigPage|end}}

Revision as of 14:41, 24 April 2023

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

Event Scripts

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

Most handlers do not receive any arguments. This is intended, because in most cases, required data can be obtained using either get3DENActionState or specialised 'get' commands.

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

Fires when entities are copied.
Also fires when entities are cut, but unlike OnCut, OnCopy fires before the entities are deleted, meaning the entities are still accessible with get3DENSelected.

add3DENEventHandler ["OnCopy", { // no arguments }];


OnCut

Fires when entities are cut (after the entities have been deleted).

add3DENEventHandler ["OnCut", { // no arguments }];


OnDeleteUnits

When entities are deleted.

add3DENEventHandler ["OnDeleteUnits", { // 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.

add3DENEventHandler ["OnHistoryChange", { // no arguments }];


OnMapClosed

When map is closed.

add3DENEventHandler ["OnMapClosed", { // no arguments }];


OnMapOpened

When map is opened.

add3DENEventHandler ["OnMapOpened", { // 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.

add3DENEventHandler ["OnMissionAutosave", { // no arguments }];


OnMissionLoad

When scenario is loaded.

add3DENEventHandler ["OnMissionLoad", { // no arguments }];


OnMissionNew

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

add3DENEventHandler ["OnMissionNew", { // 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.

add3DENEventHandler ["OnMissionListChange", { // no arguments }];


OnMissionPreviewEnd

When preview ends and user returns back to Eden Editor.

add3DENEventHandler ["OnMissionPreviewEnd", { // no arguments }];


OnMissionSave

When scenario is saved.

add3DENEventHandler ["OnMissionSave", { // no arguments }];


OnMissionSaveAs

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

add3DENEventHandler ["OnMissionSaveAs", { // no arguments }];


OnModeChange

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

add3DENEventHandler ["OnModeChange", { // no arguments }];


OnMoveGridToggle

When translation grid is toggled on or off.

add3DENEventHandler ["OnMoveGridToggle", { // no arguments }];


OnPaste

When entities are pasted.

add3DENEventHandler ["OnPaste", { // no arguments }];


OnPasteUnitOrig

When entities are pasted on their original positions.

add3DENEventHandler ["OnPasteUnitOrig", { // no arguments }];


OnRedo

When undo operation is redone.

add3DENEventHandler ["OnRedo", { // no arguments }];


OnRotateGridToggle

When rotation grid is toggled on or off.

add3DENEventHandler ["OnRotateGridToggle", { // no arguments }];


OnSelectionChange

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

add3DENEventHandler ["OnSelectionChange", { // no arguments }];


OnScaleGridToggle

When area scaling grid is toggled on or off.

add3DENEventHandler ["OnScaleGridToggle", { // no arguments }];


OnSearchCreate

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

add3DENEventHandler ["OnSearchCreate", { // no arguments }];


OnSearchEdit

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

add3DENEventHandler ["OnSearchEdit", { // no arguments }];


OnServerToggle

When server is created or destroyed from the preview.

add3DENEventHandler ["OnServerToggle", { // no arguments }];


OnSubmodeChange

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

add3DENEventHandler ["OnSubmodeChange", { // no arguments }];


OnSurfaceSnapToggle

When surface snap settings are changed.

add3DENEventHandler ["OnSurfaceSnapToggle", { // no arguments }];


OnTerrainNew

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

add3DENEventHandler ["OnTerrainNew", { // no arguments }];


OnToggleMapTextures

When map textures are toggled on or off.

add3DENEventHandler ["OnToggleMapTextures", { // no arguments }];


OnTogglePlaceEmptyVehicle

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

add3DENEventHandler ["OnTogglePlaceEmptyVehicle", { // no arguments }];


OnUndo

When an operation is undone.

add3DENEventHandler ["OnUndo", { // no arguments }];


OnVerticalToggle

When vertical mode settings are changed.

add3DENEventHandler ["OnVerticalToggle", { // no arguments }];


OnWidgetArea

When area widget is selected.

add3DENEventHandler ["OnWidgetArea", { // no arguments }];


OnWidgetNone

When no widget is selected.

add3DENEventHandler ["OnWidgetNone", { // no arguments }];


OnWidgetRotation

When rotation widget is selected.

add3DENEventHandler ["OnWidgetRotation", { // no arguments }];


OnWidgetScale

When scaling widget is selected.

add3DENEventHandler ["OnWidgetScale", { // no arguments }];


OnWidgetToggle

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

add3DENEventHandler ["OnWidgetToggle", { // no arguments }];


OnWidgetTranslation

When translation widget is selected.

add3DENEventHandler ["OnWidgetTranslation", { // no arguments }];


OnWorkspacePartSwitch

When scenario phase is selected.

add3DENEventHandler ["OnWorkspacePartSwitch", { // no arguments }];


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

Most handlers do not receive any arguments. This is intended, because in most cases, required data can be obtained using either get3DENActionState or specialised 'get' commands.

AttributesChanged3DEN

Fires when object's attributes are changed. Can happen when:

  • Changing the attributes by dragging, rotating or using one of the widgets
  • Changing and saving the attributes from within the attributes window
  • When attributes get changed using scripting commands such as set3DENAttributes or set3DENAttribute

Unlike Dragged3DEN this event handler will not fire continuously but only when the attributes were changed and saved

edenObject addEventHandler ["AttributesChanged3DEN", { params ["_object"]; }];

  • object: Object - affected object


ConnectionChanged3DEN

When a connection is added or removed from an object.

edenObject addEventHandler ["ConnectionChanged3DEN", { params ["_object"]; }];

  • object: Object - affected object


RegisteredToWorld3DEN

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

edenObject addEventHandler ["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.

edenObject addEventHandler ["UnregisteredFromWorld3DEN", { params ["_object"]; }];

  • object: Object - affected object


Dragged3DEN

When object is dragged and/or rotated. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.

edenObject addEventHandler ["Dragged3DEN", { params ["_object"]; }];

  • object: Object - affected object