1
0
Fork 0

Fix exit-time, step-time tags, and make the <wait> tag only apply to the

first iteration of any step.  Fix for issue #417
This commit is contained in:
Stuart Buchanan 2012-07-14 20:20:21 +01:00
parent 313f4796fb
commit 359a8ce414
2 changed files with 36 additions and 17 deletions

View file

@ -7,6 +7,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
</description>
<audio-dir>Aircraft/c172p/Tutorials/startup</audio-dir>
<timeofday>morning</timeofday>
<presets>
<airport-id>KLVK</airport-id>
<on-ground>1</on-ground>
@ -58,28 +59,31 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Welcome to Livermore Municipal Airport. In this lesson we'll go through the pre-startup checks and start the aircraft.</message>
<wait>10</wait>
</step>
<step>
<message>Before we start up, we need to brief what we'll do in case of an engine fire on startup. As
this isn't our aircraft, and we're fully insured, we'll simply open the door and run away.</message>
<wait>10</wait>
</step>
<step>
<message>Next, we check our seatbelts, and seat adjustments. Cessnas can get worn seat rails that
sometimes cause the seat to slip backwards, often just as you take off, so make sure it is secure.</message>
<wait>10</wait>
</step>
<step>
<message>The fuel selector is set to BOTH, the Mixture control is fully rich, and the carb heat is off. </message>
<message>The fuel selector is set to BOTH, the Mixture control is fully rich, and the carb heat is off.</message>
<view>
<heading-offset-deg>347.2</heading-offset-deg>
<pitch-offset-deg>-21.8</pitch-offset-deg>
<heading-offset-deg>344.0</heading-offset-deg>
<pitch-offset-deg>-48.7</pitch-offset-deg>
<roll-offset-deg>0.0</roll-offset-deg>
<x-offset-m>-0.2</x-offset-m>
<y-offset-m>0.3</y-offset-m>
<z-offset-m>0.4</z-offset-m>
<field-of-view>55.0</field-of-view>
<y-offset-m>0.235</y-offset-m>
<z-offset-m>0.36</z-offset-m>
<field-of-view>37.0</field-of-view>
</view>
</step>
@ -138,6 +142,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Now, we'll check no-one is about to walk into our propeller.</message>
<wait>2</wait>
<view>
<heading-offset-deg>44.0</heading-offset-deg>
<pitch-offset-deg>-15.7</pitch-offset-deg>
@ -151,6 +156,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Looks clear.</message>
<wait>2</wait>
<view>
<heading-offset-deg>296.6</heading-offset-deg>
<pitch-offset-deg>-10.4</pitch-offset-deg>
@ -183,6 +189,10 @@ This tutorial will take you through the pre-startup checklist and starting the C
<property>/sim/panel-hotspots</property>
<value>true</value>
</set>
<set>
<property>/sim/model/hide-yoke</property>
<value>true</value>
</set>
<error>
<message>Click the middle hotspot three times, so both magnetos are on and the key
is set to BOTH.</message>
@ -262,6 +272,10 @@ This tutorial will take you through the pre-startup checklist and starting the C
<property>/sim/panel-hotspots</property>
<value>false</value>
</set>
<set>
<property>/sim/model/hide-yoke</property>
<value>false</value>
</set>
<error>
<message>You can release the starter motor now - the engine is running</message>
<condition>

View file

@ -2,8 +2,8 @@
# ---------------------------------------------------------------------------------------
var step_interval = 0.0; # time between tutorial steps (default is set below)
var exit_interval = 0.0; # time between fulfillment of a step and the start of the next step (default is set below)
var step_interval = 0; # time between tutorial steps (default is set below)
var exit_interval = 0; # time between fulfillment of a step and the start of the next step (default is set below)
var loop_id = 0;
var tutorialN = nil;
@ -67,8 +67,8 @@ var startTutorial = func {
last_step_time = time_elapsedN.getValue();
steps = tutorialN.getChildren("step");
step_interval = read_double(tutorialN, "step-time", 5.0); # time between tutorial steps
exit_interval = read_double(tutorialN, "exit-time", 1.0); # time between fulfillment of steps
step_interval = read_int(tutorialN, "step-time", 5); # time between tutorial steps
exit_interval = read_int(tutorialN, "exit-time", 1); # time between fulfillment of steps
run_nasal(tutorialN);
set_models(tutorialN.getNode("models"));
@ -133,9 +133,12 @@ var stopTutorial = func {
# - Otherwise display the instructions for the step.
#
var step_tutorial = func(id) {
# Check to ensure that this is the currently running tutorial.
id == loop_id or return;
var continue_after = func(n, dflt) {
settimer(func { step_tutorial(id) }, read_double(n, "wait", dflt));
var continue_after = func(n, w) {
settimer(func { step_tutorial(id) }, w);
}
# <end>
@ -159,7 +162,10 @@ var step_tutorial = func(id) {
step_countN.setIntValue(step_iter_count = 0);
do_group(step, "Tutorial step " ~ current_step);
return continue_after(step, step_interval);
# A <wait> tag affects only the initial entry to the step
var w = read_int(step, "wait", step_interval);
return continue_after(step, w);
}
step_countN.setIntValue(step_iter_count += 1);
@ -197,7 +203,7 @@ var step_tutorial = func(id) {
step_start_time = time_elapsedN.getValue();
do_group(step, "Tutorial step " ~ current_step);
}
return continue_after(exit, step_interval);
return continue_after(exit, exit_interval);
}
do_group(exit);
@ -221,12 +227,11 @@ var do_group = func(node, default_msg = nil) {
run_nasal(node);
}
var read_double = func(node, child, default) {
var read_int = func(node, child, default) {
var c = node.getNode(child);
if (c == nil)
return default;
c = c.getValue();
c = int(c.getValue());
return c != nil ? c : default;
}