RobotStudio event

Event driven system

I want to make an event driven rapid program. But I have trouble finding a starting point.

In a production manager system, it i possible to listen to events that is made by PM by writing:
 CONST ee_event pePreFetchPadv1:=[EE_PRE_PART,"PreAuxFunc1","",1,1];

but how can I create my own events and listen to them?