Tutorials: Difference between revisions

Jump to navigation Jump to search
m
Link to special directory articles
No edit summary
m (Link to special directory articles)
Line 18: Line 18:
The tutorial system itself was largely developed by Stuart.
The tutorial system itself was largely developed by Stuart.


In recent FGDATA, the Nasal "tutorial" module has become a so called "Nasal sub module", which means that the "tutorial.nas" module now resides in its own sub folder inside $FG_ROOT/Nasal: http://gitorious.org/fg/fgdata/trees/master/Nasal/tutorial.
In recent FGDATA, the Nasal "tutorial" module has become a so called "Nasal sub module", which means that the "tutorial.nas" module now resides in its own sub folder inside [[$FG_ROOT]]/Nasal: http://gitorious.org/fg/fgdata/trees/master/Nasal/tutorial.


Support for Nasal sub modules was added by ThorstenB. Modules loaded as Nasal sub modules do automatically support reloading, because they are loaded via a listener.
Support for Nasal sub modules was added by ThorstenB. Modules loaded as Nasal sub modules do automatically support reloading, because they are loaded via a listener.
Line 31: Line 31:


tutorial.nas module is loaded via a listener ("/nasal/tutorial/loaded").
tutorial.nas module is loaded via a listener ("/nasal/tutorial/loaded").
See line 28-37 of tutorial.nas in $FG_ROOT/Nasal/tutorial to see how this is done.
See line 28-37 of tutorial.nas in [[$FG_ROOT]]/Nasal/tutorial to see how this is done.


Before you can actually reload a tutorial, you must first of all STOP it.
Before you can actually reload a tutorial, you must first of all STOP it.
Please see line 112-122 of tutorial.nas in $FG_ROOT/Nasal/tutorial.
Please see line 112-122 of tutorial.nas in [[$FG_ROOT]]/Nasal/tutorial.


Once you have stopped all running tutorials, you can reload the corresponding tutorial.
Once you have stopped all running tutorials, you can reload the corresponding tutorial.
Please see line 477-480 of tutorial.nas in $FG_ROOT/Nasal/tutorial to see how this is done.
Please see line 477-480 of tutorial.nas in [[$FG_ROOT]]/Nasal/tutorial to see how this is done.


Basically, you should be able to come up with your own "reload" function by combining the stop() and the load() functions and adding a new "reload" function to tutorial.nas:
Basically, you should be able to come up with your own "reload" function by combining the stop() and the load() functions and adding a new "reload" function to tutorial.nas:
Line 44: Line 44:
</syntaxhighlight>
</syntaxhighlight>


Also, see line 450-463 of tutorial.nas in $FG_ROOT/Nasal/tutorial to see how the namespace is initialized.
Also, see line 450-463 of tutorial.nas in [[$FG_ROOT]]/Nasal/tutorial to see how the namespace is initialized.
For additional information on namespace, I suggest to have a look at: [[Namespaces and Methods]]
For additional information on namespace, I suggest to have a look at: [[Namespaces and Methods]]


Line 145: Line 145:
               <condition>
               <condition>
                   ...                    optional, but one should be there to make sense
                   ...                    optional, but one should be there to make sense
               </condition>                          see $FG_ROOT/Docs/README.conditions
               </condition>                          see [[$FG_ROOT]]/Docs/README.conditions


               <nasal>
               <nasal>
Line 155: Line 155:


           <exit>                      optional; defines when to leave this <step>
           <exit>                      optional; defines when to leave this <step>
               <condition>                      see $FG_ROOT/Docs/README.conditions
               <condition>                      see [[$FG_ROOT]]/Docs/README.conditions
                   ...
                   ...
               </condition>
               </condition>
Line 208: Line 208:


=== Models ===
=== Models ===
This loads models into the scenery. It can be used to place, for example, a helicopter landing pad at an airport where normally none is, so that the tutorial can train landing. The layout is the following, with <path> being relative to $FG_ROOT:
This loads models into the scenery. It can be used to place, for example, a helicopter landing pad at an airport where normally none is, so that the tutorial can train landing. The layout is the following, with <path> being relative to [[$FG_ROOT]]:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 412: Line 412:


=== Condition ===
=== Condition ===
These are explained in detail in $FG_ROOT/Docs/README.conditions. Here's just one example:
These are explained in detail in [[$FG_ROOT]]/Docs/README.conditions. Here's just one example:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">

Navigation menu