I have two entities of the 'Alien' entity class with ids "Alien0001" and "myAlien". I have bound the KEY_UP key to the 'MoveUp' event which is tied to the player's character, 'myAlien'.
What happens now is that the game will detect the keypress and generate an event 'MoveUp' on object 'myAlien' with the call:- rasieEvent( 'MoveUp', 'myAlien', 'Game' ); (it's worth noting that this can be done in C++ and in script, allowing you to raise any event on any object at any time).
The event reaches the event handler of the 'myObject' and goes one of two ways. First it looks for the presence of a scripted method that is based on the event name and the object id, in this case myObject_MoveUp. If this function isn't found, it'll then look for a scripted function based on the entity class id and the event name, in this case Alien_MoveUp. If this isn't found, the event goes nowhere and the game continues.
This allows for use cases; first, you can effectively build 'classes' in script by providing event methods based on the class name and the event. Every single entity that is an instance of the Alien entity class will have the chance to call Alien_MoveUp when it's called. This allows you to script a generic behaviour for the class, so all 'basic' Aliens will act the same. From here you can specialise certain entities; so imagine you wanted one of your aliens to drop a powerup. You would simply create a scripted method override for a specific event (eg: 'Die') and add the special code in there.
Because it's all 100% scripted, you can specialise any entity in the game by just adding a scripted method. I will be expanding the system to allow 'named event functions', so the user can specify a named function to use as the event handler. This would allow a group of entities with different classes to share the same behaviour for certain actions. There's a good chance that this specialisation will be applicable at both class and object level, although this makes things a little more complicated. One final addition I might make is to give the entity classes the ability to be inherited from. This would effectively open up a huge inheritance tree of possible events and further specialisation of entity classes; so a class called 'SuperAlien' could be derived from 'Alien' which behaves a lot like alien, except it maybe moves faster or shoots more. Like the previous situation, the complexity of the event lookups will start growing exponentially, but with a little script function caching we could keep the same speed - perhaps even boosting it from the current implementation.