Howto:Get a number of elevation offsets for a number of objects
Jump to navigation
Jump to search
- Backup your tile.
- Remove all needed objects from the tile.
- Write the name of the backup tile in the script.
- Save the script: $data/Nasal/objects.nas
- Start fgfs in a location on/near the tile.
- Run the script from the debug nasal console: objects.elev_get_offset()
- Get a brand new .stg output on your terminal with a new column showing elevation offsets at the end of each line.
- Save it somewhere.
- Restore the original tile file.
var path_file = "/home/alexis/fgfs/base/data-head/Scenery/Objects/w120n30/w118n35/1023849.stg.back"; var elev_get_offset = func { var raw_str = io.readfile(path_file); var raw_list = split("\n", raw_str); foreach(var l; raw_list) { var l_list = split(" ", l); if (size(l_list) == 6) { var terrain_elev = geo.elevation(l_list[3], l_list[2]); var object_elev = l_list[4]; var offset = sprintf("%.3f", (object_elev - terrain_elev)); print( l_list[0] ~" "~ l_list[1] ~" "~ l_list[2] ~" "~ l_list[3] ~" "~ l_list[4] ~" "~ l_list[5] ~" "~ offset); } else { print(); } } print(size(raw_list)); }