well, let's untangle this a bit:
Scenarios are simply what we call internally CommandGroups. They are groups of commands that get executed when asked by the DCERouter. The Execute Command Group command sent to DCERouter is what executes scenarios, given a PK_CommandGroup #.
If you look into the anatomy of a scenario, (go to Advanced > Scenarios in web admin), you will see that each scenario has a SPECIFIC command and a destination device the command is going to. Some commands go to individual devices (Turn this lamp on, turn another off), some commands go to the Plugins (i.e. sending a Set Level to the Lighting Plugin, to turn the lights in a room to a certain level, it knows which room by the from device on the orbiter).
So where are these scenarios generated? look in src/UpdateEntArea. UpdateEntArea is basically a utility that is run at each router reload. It has a boat load of heuristics throughout its .cpp source to determine if certain devices are available and if so, create certain sets of scenarios based on a set of rules. It is very simplistic at the moment, and should be rewritten to handle very complex rules, but this will happen in time.
What plugins DO handle, are essentially callbacks. The most common of these callbacks are:
* Event Interceptors: these handle events that happen throughout the system, and are used to do useful things when events happen, such as storing state, or sending out a bunch of messages when events happen.
* Datagrid Generators: These generate the dynamic rows and columns of data seen throughout the system, you create a DataGridTable, and fill it with DataGridCells, and return the finished pointer to the datagrid table when done.
* Media Plugins: These are plugins which extend media plugin to create new media streams, and as of Apr 2008, can also be used to extend the media source grids in the file browser. This is what you're doing.
I hope this has untangled things a little.
-Thom