description: Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality.
Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality.
The commands are listed below.
*`[eventName, eventCodeBlock] call ace_common_fnc_addEventHandler`<br/> adds an event handler with the event name and returns the event handler id.
*`[eventName, args] call ace_common_fnc_globalEvent`<br/> calls an event with the listed args on all machines, the local machine, and the server.
*`[eventName, args] call ace_common_fnc_serverEvent`<br/> calls an event just on the server computer (dedicated or self-hosted).
*`[eventName, targetObject(s), args] call ace_common_fnc_targetEvent`<br/> calls an event just on the targeted object or list of objects.
*`[eventName, args] call ace_common_fnc_localEvent`<br/> calls an event just on the local machine, useful for inter-module events.
Events can be removed or cleared with the following commands.
*`[eventName, eventHandlerId] call ace_common_fnc_removeEventHandler`<br/> will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addEventHandler`.
*`[eventName] call ace_common_fnc_removeAllEventHandlers`<br/> will remove all event handlers for that type of event.
*`[eventName, eventCodeBlock, ttlNumberOrCodeBlock] call ace_common_fnc_addSyncedEventHandler`<br/> adds a globally synchronized event handler which will expire events after the provided TTL, or the code returns true.
*`[eventName] call ace_common_fnc_removeSyncedEventHandler`<br/> will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addSyncedEventHandler`.
* * `[eventName, args, ttlNumberOrCodeBlock] call ace_common_fnc_syncedEvent`<br/> calls a global synchronized event, which will also be run on JIP players unless it has expired; event will expire after the provided TTL, or the code returns true.