Some Rudimentary Help?

Ok, so I'm taking this MEL class, and I have to admit this is all somewhat confusing to me. I can read the language and usually understand what an individual line is doing, but as soon as I start trying to write this out I get an error on every line, so... anybody mind giving me a hand? This is all very basic stuff to most of you, but it's still pretty greek to me. The assignment goes something like this: I have to create a MEL script which finds all of the lights in a scene (which I assume would be something like: $lights = ls -lights;
and creates a single control object which changes all of the light intensities with a single control attribute.
I have an IDEA how to do this part from some very minor experience with character rigging, but I'm not really positive. It's not UI for this assignment, it would be like... creating a sphere with an intensity attribute applied to it that you'd tinker with in the channel box settings.
The next criteria would be to include an argument in the global proc that allows the user to name the object.
I also have to produce an error if no lights are selected when the script is ran.

Please understand, I don't want anyone to do my homework for me. =P I'm trying to LEARN it, because it's been a crappy term and I'm just not getting what I think I should out of this class. So if you reply with an script, please explain to me what's happening, even if it seems trivial. Just to try and get as much time for help as I can, I'll post this now, but I will follow up with either an edit or additional posts with what I've gotten so far.

This is the outline I've written for myself so far.

global proc fileName (user assigned control name)
{

                          $lights = `ls -lights`;  (I know there's a way to capture the SIZE of the selection, and have the definition mean exactly that, but I can't figure it out...  something like = `size(ls -lights)`?)

                          polySphere;

                         addAttr -ln Intensity -at double  -min -50 -max 50 ***need to use captured variable for control object here***;

                         setAttr -e -keyable true ***need to use captured variable for control object here***.Intensity;

if *** statement that uses $lights variable to determine selection size ***

        {
                        print "There are no lights selected."
         }
          }

Ugg... So confused. ><

i just uploaded a new script call light pack box .. there you can find some good functions mayebe it wil get updated soon ..

$lights = ls -type light;

just have a look to this script .. it will help you i think ..

just have a look to this script .. it will help you i think ..
http://www.highend3d.com/maya/downloads/me...ckBox-4559.html