After some testing I realised that this wasn't helping the framerate at all!
So I instantly realised why and fixed it.
Here is the working version.
I tested it with a massive level made out of seperate map entities.
In my massive test level using the old snippet my fps was usually 8FPS.
With this new snippet the average FPS was 50FPS.
Huge improvement!

///////////////////////////////////////////optimizer
//Include this wdl as the first include
//in your main script. After the path definitions.
//Then choose the action that you want to have the
//detain model properties and put detail_model();
//at the top of its action.
///////////////////////////////////////////
var DM_DistFromCam;
///////////////////////////////////////////
Var DM_Fade_Start =2000;
Var DM_Fade_End = 2200;//2500
///////////////////////////////////////////
Starter Fading{
DM_Fade_End -= DM_Fade_Start;
}
///////////////////////////////////////////
function detail_model(){
while(me)
{
DM_DistFromCam = vec_dist (my.x, camera.x);
My.alpha = 100 - ((DM_DistFromCam - DM_Fade_Start) / DM_Fade_End) * 100;
my.transparent = ((DM_DistFromCam - DM_Fade_Start) > 0);
if(my.alpha < 1)
{
my.invisible = on;
}else{
my.invisible = off;
}
wait(1);
}}
///////////////////////////////////////////