Can't add this script because 'Script needs to derive from monoBehaviour'

Any help on this im trying to add a splatmap from WorldMachine
to my unity terrain

import System.IO;

class ReplaceSplatmap extends ScriptableWizard
{
var Splatmap: Texture2D;
var New : Texture2D;
var BackupSplatmap: boolean;

 function OnWizardUpdate(){
        helpString = "'New' Splatmap will OverWrite the 'Splatmap' \nDrag the Texture to here:";
        isValid = (Splatmap != null)  (New != null);
    }
	
function OnWizardCreate () {
   if (BackupSplatmap){
		Backup ();
   } 
   
   	if (New.format != TextureFormat.ARGB32  New.format != TextureFormat.RGB24) {
		EditorUtility.DisplayDialog("Wrong format", "Splatmap must be in ARGB 32 bit (RGB 24 bit for Lightmap) format", "Cancel"); 
		return;
	}
	
	var w = New.width;
	if (Mathf.ClosestPowerOfTwo(w) != w) {
		EditorUtility.DisplayDialog("Wrong size", "Splatmap width and height must be a power of two", "Cancel"); 
		return;	
	}  
   Splatmap.Resize (New.width, New.height, New.format, true);
   pixels = New.GetPixels ();
   Splatmap.SetPixels (pixels);
   Splatmap.Apply(); 
}

    @MenuItem("CUSTOM/Replace Splatmap...")//, false, 4)
    static function Replace (){
        ScriptableWizard.DisplayWizard(
            "ReplaceSplatmap", ReplaceSplatmap, "Replace");
    }
}

function Backup () {
	filename = Splatmap.name;
	var bytes = Splatmap.EncodeToPNG();
	File.WriteAllBytes(Application.dataPath + "/../"+filename +"_Backup.png", bytes);
	EditorUtility.DisplayDialog("Texture Backup Saved!", "Backup of "+"'"+filename+"'"+" saved in Current Project Folder: " + filename+ "_Backup.png", "OK");	
}

If not, does anyone have a script like this?

Try typing this at the top of your script before declaring your variables :

//JS
var NameOfYourScript : MonoBehaviour ;

//C#
public class NameOfYourScript : MonoBehaviour ;

Now i have the Error "expecting EOF, found “ReplaceSplatmat”

Ok i guess i was talking nonsense :X

That’s completely wrong; there’s nothing wrong with the script. There is class declaration in Unityscript, and the import System.IO is required. (Well, not required, but it beats qualifying every instance.)

That’s not Unityscript syntax at all (you don’t use “var” to declare classes and you don’t use “:” for extends). Also you would not extend MonoBehaviour for this; the script is extending ScriptableWizard.

That actual problem is that the script is not supposed to extend MonoBehaviour and you wouldn’t attach it to objects. It’s an editor script.

–Eric