A demo as in a pre-recorded playback flight? Or you are flying "live" and during the flight you want to be able to change the time-warp factor by a different scale than the default x10 steps?
If it's a pre-recorded flight (a scenario that you run from the Playbacks folder), you can easily set the time-warp to any factor you want, by editing the Flights\(Name of your scenario)\system.dat file with a text editor (notepad). All you need to do is to insert lines like this:
The first number is the time-stamp (simulation time) that an event occurs.
The TACC means set the time acceleration and the last number is the factor that you want to change it to. The example above will set the time-warp to x2 from simtime 0.01 to simtime 3600 (realtime = 1800.01 seconds)
If it's a live flight, you can use a lua script to do the same. If you want the whole flight to run at x2 it's pretty easy.
Code:
t=oapi.get_simtime()
while t < 3600 do
oapi.set_tacc(2)
t=oapi.get_simtime()
proc.skip()
if t > 3600 then
oapi.set_tacc(1)
end
end
This will set the timewarp to x2 for the first 3600 seconds of the simulation. (Realtime = 1800 seconds) and then go back to x1.
Unfortunately lua doesn't understand keypresses, so if you want to vary the time-warp you'll need to preset some events that will trigger the change. The trigger can be pretty much anything you want. For example:
Code:
v = vessel.get_focusinterface()
t=oapi.get_simtime()
while t < 3600 do
t=oapi.get_simtime()
alt = v:get_altitude()
if alt > 100 and alt < 10000 then
tacc==2
else
tacc=1
end
oapi.set_tacc(tacc)
proc.skip()
if t > 3600 then
oapi.set_tacc(1)
end
end
This will set the timewarp to x2 while the focus vessel is between 100 meters and 10000 meters in altitude and x1 if it's not within that range or the simtime exceeds 3600 seconds . Like I said the trigger -or triggers- can be pretty much anything you want.