There's two ways I do it, for testing...
As a simple action or called as a material in an action
-------------------------------------------------------
-Add your code to a wdl file called something like shaders.wdl
-add the script to your level (file-->add script)

Here is an example of how I implement a reflection shader made by Ventilator...(Huge thanks, hope its ok to post it):
Ventilator's Environment mapping thread

-Add this code to a text file named shaders.wdl
-add it to level
- notice below, in the action you call the material...
- use a texture for your reflection named reflect.tga

action Shaders_Reflection {

the material is called with this line:
my.material=mat_envmap;

I think thats about it...

Code:
 ///////////////////////////////////////////////////////

//Ventilators reflection shader (Environment mapping
//////////////////////////////////////////////////////
bmap b_envmap=<reflect.tga>;

//--------------------------------------------mat_envmap

material mat_envmap

{

skin1=b_envmap;

effect=

"

texture mtlSkin1;

texture texSkin1;

matrix matWorldViewProj;

matrix matWorld;

matrix matWorldView;



technique envmap

{

pass p0

{

Texture[0]=<mtlSkin1>;

Texture[1]=<texSkin1>;


VertexShaderConstant[0]=<matWorldViewProj>;

VertexShaderConstant[4]=<matWorld>;

VertexShaderConstant[8]=<matWorldView>;

VertexShaderConstant[95]=(0.5f,1.0f,2.0f,0.0f);


VertexShader=

decl

{

stream 0;

float v0[3]; //position

float v3[3]; //normal

float v7[3]; //uv1

float v8[3]; //uv2 or tangent

}

asm

{

vs.1.1



m4x4 oPos,v0,c0 // transform position to clip space

mov oT1,v7 // output uvs for colormap



m4x4 r10,v0,c4 // transform position to world space

sub r10,c10,r10 // direction to view

dp3 r10.w,r10,r10 // renormalize it

rsq r10.w,r10.w

mul r10,r10,r10.w



m3x3 r0,v3,c4 // transform normal to world space

dp3 r0.w,r0,r0 // renormalize it

rsq r0.w,r0.w

mul r0,r0,r0.w

// calculate reflection vector

dp3 r2.xyz,r10,r0 // v.n

mul r1,r0,c95.z // 2n

mad oT0.xyz,r2,r1,-r10 // 2n(v.n)-v

};



PixelShader=

asm

{

ps.1.3

tex t0 // sample cubemap

tex t1 // sample colormap

mov r0,t0

//add r0,t0,t1_bias

};

}

}

";

}


starter mat_envmap_init

{

bmap_to_cubemap(bmap_to_mipmap(mat_envmap.skin1));

}

//i use this like that:

entity* blurp;
action Shaders_Reflection {
blurp=me;
my.material=mat_envmap;
my.pan=random(360); //rotation
my.tilt=random(360); //rotation
my.roll=random(360); //rotation
while(1) { //rotation
my.pan+=sin(my.tilt)/2*time; //rotation
my.tilt+=cos(my.roll)/2*time; //rotation
my.roll+=sin(my.pan)/2*time; //rotation
wait(1);
}
}




Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot