You need a material event.. say in the begining of you material put event=envmapevent
then make a function:
function envmapevent() { mtl.enablerender=on; //means this function will run every frame mtl.skin1=newenvmap; //skin1 is the environment map you are using in the shader }