# (C) JFDee 2016 # # Use with any TCL interpreter (google ActiveTcl or freewrap/freewish) # # Put this and the data file (view_correction.txt) in the "FSX" folder and run it # from there. # The data file is a 1:1 select/copy/paste from flibberflops' forum post to a simple # text file (e.g. using Windows' "notepad"). Only correction was for the "Trike" # where the "eyepoint" parameter name was missing # # All original files will be copied to *.bak at the first run and read for every # following run; that means you can run this script as often as you like, e.g. after # editing the data file. if {![file exists view_correction.txt]} {exit} console show set rc [open view_correction.txt r] set buf [read $rc] close $rc set viewlist [regexp -inline -all -- {Filelocation:.+?World Scale} $buf] foreach view $viewlist { if {![regexp {Filelocation:(.+)CFG File} $view d path]} {continue} set path [string trim $path] set upath [regsub -all {\\} $path {/}] regexp {FSX/(.+)} $upath d path if {![regexp {eyepoint *=.*?\n} $view eyeline]} {continue} set eyeline [string trim $eyeline] if [regexp {(.+)/[^/]*\.cfg$} $path d dir] { set path $dir } if {![file isdirectory $path]} {continue} set config $path/aircraft.cfg if {![file exists $config]} { set config $path/sim.cfg if {![file exists $config]} {continue} } if {![file exists $config.bak]} { file copy $config $config.bak } puts "Editing $config" set rc [open $config.bak r] set buf [read $rc] close $rc set wc [open $config w] puts $wc "; View/Eyepoint edited by script for FlyInside VR" foreach line [split $buf \n] { if [regexp {^ *eyepoint *=} $line] { puts $wc $eyeline } else { puts $wc $line } } close $wc } exit