zeeebra
Why? Can't you use the built in pass mechanism? You get 4 different z depth forms to choose form (which are free actions for your renderer, that means faster). And since your going to comp anyway, you can do any remapping you'd ever want there instead.
PS: please link the script we dont have all day to dig things up you know.