Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto:Timers and properties

From FlightGear wiki
Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.


A timer that unpauses FlightGear 30 seconds after it starts, and then exits the simulator after a set number of seconds. It unpauses the simulator by setting these two properties:

  • /sim/freeze/master=0
  • /sim/freeze/clock=0
## $FG_HOME/Nasal/timedExit.nas

# the time for FG to run
var interval_sec = 30.00;

# afterwards, this timer will be triggered
var resume_sec = 20.00;

var unpause = func(){
  print("unpause() called!");
  var properties = [ 
    { name: "/sim/freeze/master", value: 0 },
    { name: "/sim/freeze/clock", value: 0 },

  foreach(var prop; properties){
    print("Setting '", prop.name, "' to ", prop.value);
    setprop(prop.name, prop.value);

  # start a new timer
  print("Exit timer registered");
  var exitTimer = maketimer(resume_sec, terminate_callback);
  exitTimer.singleShot = 1;

var terminate_callback = func(){
  print("Terminating FG");

# http://wiki.flightgear.org/Nasal_library#maketimer.28.29_.282.11.2B.29
var myTimer = maketimer(interval_sec, unpause);
myTimer.singleShot = 1;

print("UnpauseTimer registered!");