How to create an index for custom environments?

I have defined a custom script environment, and would like to include an index in the output listing all scripts with their titles. How can I create such an index?

The custom environment looks like:

\newcounter{script}
\def\thescript{\thechapter-\arabic{script}}
\newenvironment{script}[2][]{
\colorbox{orange}
{\refstepcounter{script}\textbf{Script~\thescript #1: #2}}\nobreak}
{}

-
A few details could be helpful. How did you create that environment? Is it a float environment like figure or table? – Thorsten Donig Oct 8 '10 at 10:06
Added my custom environment. – Egon Willighagen Oct 8 '10 at 10:29

Have a look at the tocloft package. There is, in particular, a \newlistof command to do exactly what you're looking for. Read section 2.4 of it's documentation for the full details (on how to make it work with your own environment).