Wait whats Doonce and Onadd?
Doonce is a variable that is declared so it can be used in the script -- that way when the script is run the first time (Doonce is initialised as = 0) it passes the check in the line ( if ( Doonce == 0 ) ) so the rest of the script continues then once it runs the variable is set to = 1 so afterwards if the script runs again the check fails and the script does not run (without it the script would get stuck in an endless loop and run continually setting the recipt value to 0, adding the key, and displaying the messagebox over and over and over etc. !!)
SO it pretty much does what it says in the naming (makes the code run only once !)
OnAdd -- is a defined Block Type that runs when the item the script is on is added to the containers (in this case the players inventory) ( http://cs.elderscrolls.com/index.php/Begin )