Events

C++
There's a few things you need for making an Event in C++. First thing is you need to inherit from the Event class. Second thing is you need to include the EVENT_REGISTER macro in the public section. Finally, you need to register the Event with the Meta System. Here is an example event: class   LogicUpdate   :   public   Event {    public : LogicUpdate ( float  dt ); float   GetDt   const ; EVENT_REGISTER ; private : float   m_Dt  =  0.0f ; CLASS_START ( LogicUpdate ) DERIVE ( Event ); MEMBER ( m_Dt ). GET ( GetDt ). SCRIPT ; BIND_LUA ; CLASS_END };

Scripting
In the folder "Data\Events", make a text file with the name of the file being the name of the event (extension needs to still be ".txt"). Inside of the text file is where you add the different variables for the event where each line is a new variable with the format being: DataType NameOfVariable Here is an example of an event: string AString int AnInt Vector3D Vec

C++
You need to register for events inside of C++ like this: space -> GetEventManager . RegisterEvent ( this ,  & ActionListComp :: Update );

In the above example, the first parameter is for the objec that will be recieving that event, and the second parameter is a pointer to the function that will recieve the event. It will know what event you are trying to register for based on the first parameter of the function pointer you passed in. For example, if we look at the Update function for the ActionListComp, void   <span style="font-family:Consolas;color:rgb(78,201,176);">ActionListComp <span style="font-family:Consolas;color:rgb(180,180,180);">:: <span style="font-family:Consolas;color:rgb(200,200,200);">Update <span style="font-family:Consolas;color:rgb(180,180,180);">( <span style="font-family:Consolas;color:rgb(200,200,200);">GenericEvent <span style="font-family:Consolas;color:rgb(180,180,180);">:: <span style="font-family:Consolas;color:rgb(78,201,176);">LogicUpdate <span style="color:rgb(218,218,218);font-family:Consolas;">  <span style="font-family:Consolas;color:rgb(180,180,180);">* <span style="font-family:Consolas;color:rgb(127,127,127);">event <span style="font-family:Consolas;color:rgb(180,180,180);">) we can see that it takes a LogicEvent.

Scripting
In the Initialize function, you register for events in the Initialize function. You probably shouldn't register for events anywhere else in the script. Here is a quick example of registering an event in Lua: function Initialize this.Space:RegisterEvent("LogicUpdate"); end The format for the function to recieve the event needs to be the event name with the word "Event" at the end. This is to avoid a weird issues when trying to construct an event but calling the function to recieve the event instead in the script. This is how you would recieve the LogicUpdateEvent after you have registered for it: function LogicUpdateEvent(event) end The variable "event" can be named anything.

If you register for an event, you must have a function to accompany it.

Troubleshooting
In C++ when creating the Event, don't forget to use the BIND_LUA macro at the bottom, and don't forget the DERIVE macro either as that causes issues.