====== Scripts > Calculate gradient ====== ^ Description | Calculate the gradient map of the heightfield. | ^ Author | [[user>Aaron]] | ^ Created | 2012/03/19 06:20 | ^ Requires | L3DT v12.03 | ^ Download | {{:scripts:HF_CalcGradient.zs|HF_CalcGradient.zs}} | ===== Script contents ===== hvar pHF set pHF assert pHF "Error: cannot get heightfield!" assert "Error: heightfield not initialised!" hvar hOutput set hOutput if hOutput L3DTio_Backup.BackupMap "HF_Grad" "HF_CalcGrad" 0 "view.ShowMap \"HF_Grad\"" map.Free hOutput else set hOutput endif if > echo "HF_CalcGrad.zs error - call to 'calc.HF.CalcGrad' failed" return -1 endif map.SetFlag hOutput 1 true // ready map.SetFlag hOutput 5 true // modified view.ShowMap "HF_Grad" return 0