====== Scripts > HF_clip ====== ^ Description | A script to clip heightifled pixels that are above or below a certain elevation, and set them to another given elevation. | ^ Author | Aaron | ^ Created | 2017/08/17 | ^ Requires | L3DT v15+ | ^ Download | {{:scripts:hf_clip.zs|hf_clip.zs}} | ===== Script contents ===== // // Title | HF_clip // Purpose | A script to force heightfield pixels above or below a certain level // | to be set to another level // Author | Aaron Torpy // Date | 17 Aug 2017 hvar hHF set hHF assert > "Error: Cannot get heightfield" assert "Error: Heightfield is not initialised" // ask for clipping mode combosel CS combosel.Init &CS "Clip above|Clip below" "Clip above" 0 if > return -1 endif // check clipping mode, and ask for clipping altitudes float ClipThreshold float ClipTarget set ClipThreshold 0 set ClipTarget 0 int ClipMode set ClipMode 0 string CurSel set CurSel if set ClipMode 0 elseif set ClipMode 1 else echo "HF_clip script error:\r\n - unknown clipping mode" return -1 endif //echo // debugging if > return -1 endif set ClipTarget ClipThreshold if > return -1 endif // store a backup if > echo "HF_clip script error:\r\n - cannot store backup point for heightfield" //return -1 endif // clip the heightfield if if > echo "HF_clip script error:\r\n - cannot clip max altitude layer of heightfield" return -1 endif endif if if > echo "HF_clip script error:\r\n - cannot clip min altitude layer of heightfield" return -1 endif endif // redraw heightfield view.ShowMap "HF" MessageBox "Clipping complete!" 0x40 return 0