home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 January / Gamestar_58_2004-01_dvd.iso / setup1.cab / _00_02_Tutorial_3_1900.txt < prev    next >
Text File  |  2002-05-29  |  24KB  |  931 lines

  1. // ============================================================================
  2. // TUTORIAL 2
  3. // 
  4. // The script implements tutorial nr 2.
  5. //
  6. // Topic :
  7. //     - Building complex production
  8. //  - Playing with production parameters
  9. // ============================================================================
  10.  
  11. // ============================================================================
  12. // VARIABLES
  13. // ============================================================================
  14.     
  15. [VARIABLES]
  16.     
  17.     // Parameter variables.
  18.     ReturnState$
  19.     FirstTutorialTextID
  20.     LastTutorialTextID
  21.     TutorialTextID
  22.  
  23.     // Helper variables.
  24.     Local_i
  25.  
  26.     // Building IDs
  27.     Storage1ID
  28.     Storage2ID
  29.     Storage3ID
  30.     Storage4ID
  31.     Station1ID
  32.     Station2ID
  33.     Station3ID
  34.     Station4ID
  35.     Station5ID
  36.     Station6ID
  37.  
  38. // ============================================================================
  39. // INIT
  40. // ============================================================================
  41. [STATE Load]
  42.  
  43.     LoadGame("missions\\00_02_Tutorial 3_1900.ig2")
  44.     LoadMissionConfig("missions\\00_02_Tutorial 3_1900.mis")
  45.     SetOutputMode(2)
  46.     SetMsgFilter(65535)
  47.     StartCommandFiltering()
  48.     ControlBar.SetDisable(871)
  49.     DialogControl.SetDisable(16)
  50.     Storage1ID = 252
  51.     Storage2ID = 108
  52.     Time.SetPace(1)
  53.     SetState("Intro")
  54.  
  55. // ============================================================================
  56. // INTRO
  57. // ============================================================================
  58. [STATE Intro]
  59.  
  60.  
  61.     FirstTutorialTextID = 500
  62.     LastTutorialTextID  = 501
  63.     ReturnState = 'BuildStation1'
  64.     SetState("Show_tutorial_text_serie")
  65.  
  66.  
  67. // ============================================================================
  68. // BuildStation1
  69. // ============================================================================
  70. [STATE BuildStation1]    
  71.     TutorialTextID = 503
  72.     ReturnState = 'WaitForStation1'
  73.     SetState("Show_tutorial_text")
  74.  
  75. [STATE WaitForStation1]    
  76.     IF IsEnterState
  77.     THEN
  78.         ClearCommandQueue()
  79.     END
  80.  
  81.     // Is there a queued command ? 
  82.     IF GetCommandQueueLength() > 0
  83.     THEN
  84.         IF NextCommand.GetType() == 9 AND
  85.             NextCommand.GetInternType() == 3
  86.         THEN    
  87.             SetState("VerifyStation1Location")
  88.         ELSE
  89.             NextCommand.Cancel()
  90.             ClearCommandQueue()
  91.             SetState("BuildStation1")
  92.         END
  93.     END
  94.  
  95. [STATE VerifyStation1Location]
  96.     IF IsHighlighted(Storage1ID)
  97.     THEN
  98.         NextCommand.Run()
  99.         Station1ID = User.GetLastBuildingBuilt()
  100.         ClearCommandQueue()
  101.         SetState("BuildStation2")
  102.     ELSE
  103.         TutorialTextID = 600
  104.         ReturnState = 'WaitForStation1'
  105.         SetState("Show_tutorial_text")
  106.     END
  107.  
  108. // ============================================================================
  109. // BuildStation2
  110. // ============================================================================
  111. [STATE BuildStation2]    
  112.     TutorialTextID = 506
  113.     ReturnState = 'WaitForStation2'
  114.     SetState("Show_tutorial_text")
  115.  
  116. [STATE WaitForStation2]    
  117.     IF IsEnterState
  118.     THEN
  119.         ClearCommandQueue()
  120.     END
  121.  
  122.     // Is there a queued command ? 
  123.     IF GetCommandQueueLength() > 0
  124.     THEN
  125.         IF NextCommand.GetType() == 9 AND
  126.             NextCommand.GetInternType() == 3
  127.         THEN    
  128.             SetState("VerifyStation2Location")
  129.         ELSE
  130.             NextCommand.Cancel()
  131.             ClearCommandQueue()
  132.             SetState("BuildStation2")
  133.         END
  134.     END
  135.  
  136. [STATE VerifyStation2Location]
  137.     IF IsHighlighted(Storage2ID)
  138.     THEN
  139.         NextCommand.Run()
  140.         Station2ID = User.GetLastBuildingBuilt()
  141.         ClearCommandQueue()
  142.         SetState("ConnectStations")
  143.     ELSE
  144.         TutorialTextID = 600
  145.         ReturnState = 'WaitForStation2'
  146.         SetState("Show_tutorial_text")
  147.     END
  148.  
  149. // ============================================================================
  150. // ConnectStations
  151. // ============================================================================
  152. [STATE ConnectStations]    
  153.     TutorialTextID = 509
  154.     ReturnState = 'WaitForConnecting'
  155.     SetState("Show_tutorial_text")
  156.  
  157. [STATE WaitForInsertRoute]
  158.     IF IsEnterState
  159.     THEN
  160.         ClearCommandQueue()
  161.     END
  162.  
  163.     // Is there a queued command ? 
  164.     IF GetCommandQueueLength() > 0
  165.     THEN
  166.         IF NextCommand.GetType() == 6 AND
  167.             NextCommand.GetInternType() == 1
  168.         THEN    
  169.             NextCommand.Run()
  170.             SetState("WaitForConnecting")
  171.         ELSE
  172.             NextCommand.Cancel()
  173.             ClearCommandQueue()
  174.             SetState("ConnectStations")
  175.         END
  176.     END
  177.  
  178. [STATE WaitForConnecting]
  179.     IF AreConnected(Station1ID, Station2ID) > 0
  180.     THEN
  181.         SetState("AddRepairPlace")
  182.     ELSE
  183.         SetState("WaitForInsertRoute")
  184.     END
  185.  
  186. // ============================================================================
  187. // AddRepairPlace
  188. // ============================================================================
  189. [STATE AddRepairPlace]    
  190.     TutorialTextID = 512
  191.     ReturnState = 'WaitForRepairPlace'
  192.     SetState("Show_tutorial_text")
  193.  
  194. [STATE WaitForRepairPlace]
  195.     IF IsEnterState
  196.     THEN
  197.         ClearCommandQueue()
  198.     END
  199.  
  200.     // Is there a queued command ? 
  201.     IF GetCommandQueueLength() > 0
  202.     THEN
  203.         IF NextCommand.GetType() == 43 
  204.         THEN    
  205.             NextCommand.Run()
  206.             SetState("CloseBuildingDlg")
  207.         ELSE
  208.             NextCommand.Cancel()
  209.             ClearCommandQueue()
  210.             SetState("ConnectStations")
  211.         END
  212.     END
  213.  
  214.  
  215. // ============================================================================
  216. // Close building dialog.
  217. // ============================================================================
  218. [STATE CloseBuildingDlg]
  219.     TutorialTextID = 515
  220.     ReturnState = 'WaitForBuildClose'
  221.     SetState("Show_tutorial_text")
  222.  
  223. [STATE WaitForBuildClose]
  224.     IF BuildDialog.IsOpen() == 0
  225.     THEN
  226.         SetState("BuyTrain")
  227.     END
  228.  
  229. // ============================================================================
  230. // BuyTrain
  231. // ============================================================================
  232. [STATE BuyTrain]    
  233.     TutorialTextID = 518
  234.     ReturnState = 'WaitForBuyTrainDlg'
  235.     SetState("Show_tutorial_text")
  236.  
  237. [STATE WaitForBuyClose]
  238.     ClearCommandQueue()
  239.     IF BuyVehicleDialog.IsOpen() == 0
  240.     THEN
  241.         SetState("WaitForBuyTrainDlg")
  242.     END
  243.  
  244. [STATE WaitForBuyTrainDlg] 
  245.     IF BuyVehicleDialog.IsOpen() == 1
  246.     THEN
  247.         IF BuyVehicleDialog.GetStation() == Station1ID
  248.         THEN
  249.             TutorialTextID = 521
  250.             ReturnState = 'WaitForAccept'
  251.             SetState("Show_tutorial_text")
  252.         ELSE
  253.             TutorialTextID = 603
  254.             ReturnState = 'WaitForBuyClose'
  255.             SetState("Show_tutorial_text")
  256.         END
  257.     END
  258.  
  259. [STATE WaitForAccept]
  260.     IF IsEnterState
  261.     THEN
  262.         IF GetCommandQueueLength() > 0
  263.         THEN
  264.             IF NextCommand.GetType() <> 10
  265.             THEN    
  266.                 ClearCommandQueue()
  267.             END
  268.         END
  269.     END
  270.  
  271.     // Is there a queued command ? 
  272.     IF GetCommandQueueLength() > 0
  273.     THEN
  274.         IF NextCommand.GetType() == 10
  275.         THEN    
  276.             NextCommand.Run()
  277.             SetState("PreSchedule")
  278.         ELSE
  279.             NextCommand.Cancel()
  280.             ClearCommandQueue()
  281.             SetState("BuyTrain")
  282.         END
  283.     ELSE
  284.         IF BuyVehicleDialog.IsOpen() == 0
  285.         THEN
  286.             SetState("BuyTrain")
  287.         END
  288.     END
  289.  
  290.  
  291. // ============================================================================
  292. // Schedule
  293. // ============================================================================
  294. [STATE PreSchedule]    
  295.     IF ScheduleDialog.IsOpen() == 1
  296.     THEN
  297.         SetState("Schedule")
  298.     END
  299.  
  300. [STATE Schedule]
  301.     FirstTutorialTextID = 524
  302.     LastTutorialTextID  = 525
  303.     ReturnState = 'WaitForFill'
  304.     SetState("Show_tutorial_text_serie")
  305.  
  306. [STATE WaitForFill]
  307.     IF ScheduleDialog.IsOpen() == 0
  308.     THEN
  309.         SetState("BuyTrain")
  310.     ELSE
  311.         IF ScheduleDialog.IsFilled(0, 39, 4) == 1
  312.         THEN
  313.             TutorialTextID = 527
  314.             ReturnState = 'WaitForWaitUntilFull'
  315.             SetState("Show_tutorial_text")
  316.         END
  317.     END
  318.  
  319. [STATE WaitForWaitUntilFull]
  320.     IF ScheduleDialog.IsOpen() == 0
  321.     THEN
  322.         SetState("BuyTrain")
  323.     ELSE
  324.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  325.         THEN    
  326.             TutorialTextID = 530
  327.             ReturnState = 'WaitForOtherStation'
  328.             SetState("Show_tutorial_text")
  329.         END
  330.     END
  331.  
  332. [STATE WaitForOtherStation]
  333.     IF ScheduleDialog.IsOpen() == 0
  334.     THEN
  335.         SetState("BuyTrain")
  336.     ELSE
  337.         IF ScheduleDialog.GetNrStations() == 2
  338.         THEN
  339.             TutorialTextID = 531
  340.             ReturnState = 'WaitForAcceptDialog'
  341.             SetState("Show_tutorial_text")
  342.         END
  343.     END
  344.     
  345. [STATE WaitForAcceptDialog]
  346.     IF IsEnterState
  347.     THEN
  348.         ClearCommandQueue()
  349.     END
  350.  
  351.     // Is there a queued command ? 
  352.     IF GetCommandQueueLength() > 0
  353.     THEN
  354.         IF NextCommand.GetType() == 15
  355.         THEN    
  356.             NextCommand.Run()
  357.             SetState("MissionGoal")
  358.         ELSE
  359.             NextCommand.Cancel()
  360.             ClearCommandQueue()
  361.             SetState("BuyTrain")
  362.         END
  363.     ELSE
  364.         IF ScheduleDialog.IsOpen() == 0
  365.         THEN
  366.             SetState("BuyTrain")
  367.         END
  368.     END
  369.  
  370. // ============================================================================
  371. // BuildHarbour1
  372. // ============================================================================
  373. [STATE BuildHarbour1]    
  374.     TutorialTextID = 533
  375.     ReturnState = 'WaitForHarbour1'
  376.     SetState("Show_tutorial_text")
  377.  
  378. [STATE WaitForHarbour1]    
  379.     IF IsEnterState
  380.     THEN
  381.         ClearCommandQueue()
  382.     END
  383.  
  384.     // Is there a queued command ? 
  385.     IF GetCommandQueueLength() > 0
  386.     THEN
  387.         IF NextCommand.GetType() == 9 AND
  388.             NextCommand.GetInternType() == 2
  389.         THEN    
  390.             SetState("VerifyHarbour1Location")
  391.         ELSE
  392.             NextCommand.Cancel()
  393.             ClearCommandQueue()
  394.             SetState("BuildHarbour1")
  395.         END
  396.     END
  397.  
  398. [STATE VerifyHarbour1Location]
  399.     IF IsHighlighted(Storage2ID)
  400.     THEN
  401.         NextCommand.Run()
  402.         Station3ID = User.GetLastBuildingBuilt()
  403.         ClearCommandQueue()
  404.         SetState("BuildHarbour2")
  405.     ELSE
  406.         TutorialTextID = 600
  407.         ReturnState = 'WaitForHarbour1'
  408.         SetState("Show_tutorial_text")
  409.     END
  410.  
  411. // ============================================================================
  412. // BuildHarbour2
  413. // ============================================================================
  414. [STATE BuildHarbour2]    
  415.     TutorialTextID = 536
  416.     ReturnState = 'WaitForHarbour2'
  417.     SetState("Show_tutorial_text")
  418.  
  419. [STATE WaitForHarbour2]    
  420.     IF IsEnterState
  421.     THEN
  422.         ClearCommandQueue()
  423.     END
  424.  
  425.     // Is there a queued command ? 
  426.     IF GetCommandQueueLength() > 0
  427.     THEN
  428.         IF NextCommand.GetType() == 9 AND
  429.             NextCommand.GetInternType() == 2
  430.         THEN    
  431.             SetState("VerifyHarbour2Location")
  432.         ELSE
  433.             NextCommand.Cancel()
  434.             ClearCommandQueue()
  435.             SetState("BuildHarbour2")
  436.         END
  437.     END
  438.  
  439. [STATE VerifyHarbour2Location]
  440.     IF IsHighlighted(Storage3ID)
  441.     THEN
  442.         NextCommand.Run()
  443.         Station4ID = User.GetLastBuildingBuilt()
  444.         ClearCommandQueue()
  445.         SetState("CloseBuildingDlg_2")
  446.     ELSE
  447.         TutorialTextID = 600
  448.         ReturnState = 'WaitForHarbour2'
  449.         SetState("Show_tutorial_text")
  450.     END
  451.  
  452. // ============================================================================
  453. // Close building dialog.
  454. // ============================================================================
  455. [STATE CloseBuildingDlg_2]
  456.     TutorialTextID = 530
  457.     ReturnState = 'WaitForBuildClose_2'
  458.     SetState("Show_tutorial_text")
  459.  
  460. [STATE WaitForBuildClose_2]
  461.     IF BuildDialog.IsOpen() == 0
  462.     THEN
  463.         SetState("BuyShip")
  464.     END
  465.  
  466. // ============================================================================
  467. // BuyShip
  468. // ============================================================================
  469. [STATE BuyShip]    
  470.     TutorialTextID = 539
  471.     ReturnState = 'WaitForBuyShipDlg'
  472.     SetState("Show_tutorial_text")
  473.  
  474. [STATE WaitForBuyClose_2]
  475.     IF BuyVehicleDialog.IsOpen() == 0
  476.     THEN
  477.         SetState("WaitForBuyShipDlg")
  478.     END
  479.  
  480. [STATE WaitForBuyShipDlg] 
  481.     IF BuyVehicleDialog.IsOpen() == 1
  482.     THEN
  483.         IF BuyVehicleDialog.GetStation() == Station3ID
  484.         THEN
  485.             TutorialTextID = 542
  486.             ReturnState = 'WaitForAccept_2'
  487.             SetState("Show_tutorial_text")
  488.         ELSE
  489.             TutorialTextID = 603
  490.             ReturnState = 'WaitForBuyClose_2'
  491.             SetState("Show_tutorial_text")
  492.         END
  493.     END
  494.  
  495. [STATE WaitForAccept_2]
  496.     IF IsEnterState
  497.     THEN
  498.         ClearCommandQueue()
  499.     END
  500.  
  501.     // Is there a queued command ? 
  502.     IF GetCommandQueueLength() > 0
  503.     THEN
  504.         IF NextCommand.GetType() == 10
  505.         THEN    
  506.             NextCommand.Run()
  507.             SetState("Schedule_2")
  508.         ELSE
  509.             NextCommand.Cancel()
  510.             ClearCommandQueue()
  511.             SetState("BuyShip")
  512.         END
  513.     ELSE
  514.         IF BuyVehicleDialog.IsOpen() == 0
  515.         THEN
  516.             SetState("BuyShip")
  517.         END
  518.     END
  519.  
  520.  
  521. // ============================================================================
  522. // Schedule
  523. // ============================================================================
  524. [STATE Schedule_2]
  525.     TutorialTextID = 545
  526.     ReturnState = 'WaitForFill_2'
  527.     SetState("Show_tutorial_text")
  528.  
  529. [STATE WaitForFill_2]
  530.     IF ScheduleDialog.IsOpen() == 0
  531.     THEN
  532.         SetState("BuyShip")
  533.     ELSE
  534.         IF ScheduleDialog.IsFilled(0, 39, 12) == 1
  535.         THEN
  536.             TutorialTextID = 548
  537.             ReturnState = 'WaitForWaitUntilFull_2'
  538.             SetState("Show_tutorial_text")
  539.         END
  540.     END
  541.  
  542. [STATE WaitForWaitUntilFull_2]
  543.     IF ScheduleDialog.IsOpen() == 0
  544.     THEN
  545.         SetState("BuyShip")
  546.     ELSE
  547.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  548.         THEN    
  549.             TutorialTextID = 551
  550.             ReturnState = 'WaitForOtherStation_2'
  551.             SetState("Show_tutorial_text")
  552.         END
  553.     END
  554.  
  555. [STATE WaitForOtherStation_2]
  556.     IF ScheduleDialog.IsOpen() == 0
  557.     THEN
  558.         SetState("BuyShip")
  559.     ELSE
  560.         IF ScheduleDialog.GetNrStations() == 2
  561.         THEN
  562.             TutorialTextID = 554
  563.             ReturnState = 'WaitForAcceptDialog_2'
  564.             SetState("Show_tutorial_text")
  565.         END
  566.     END
  567.     
  568. [STATE WaitForAcceptDialog_2]
  569.     IF IsEnterState
  570.     THEN
  571.         ClearCommandQueue()
  572.     END
  573.  
  574.     // Is there a queued command ? 
  575.     IF GetCommandQueueLength() > 0
  576.     THEN
  577.         IF NextCommand.GetType() == 15
  578.         THEN    
  579.             NextCommand.Run()
  580.             SetState("BuildTerminal1")
  581.         ELSE
  582.             NextCommand.Cancel()
  583.             ClearCommandQueue()
  584.             SetState("BuyShip")
  585.         END
  586.     ELSE
  587.         IF ScheduleDialog.IsOpen() == 0
  588.         THEN
  589.             SetState("BuyShip")
  590.         END
  591.     END
  592.  
  593. // ============================================================================
  594. // BuildTerminal1
  595. // ============================================================================
  596. [STATE BuildTerminal1]    
  597.     TutorialTextID = 557
  598.     ReturnState = 'WaitForTerminal1'
  599.     SetState("Show_tutorial_text")
  600.  
  601. [STATE WaitForTerminal1]    
  602.     IF IsEnterState
  603.     THEN
  604.         ClearCommandQueue()
  605.     END
  606.  
  607.     // Is there a queued command ? 
  608.     IF GetCommandQueueLength() > 0
  609.     THEN
  610.         IF NextCommand.GetType() == 9 AND
  611.             NextCommand.GetInternType() == 15
  612.         THEN    
  613.             SetState("VerifyTerminal1Location")
  614.         ELSE
  615.             NextCommand.Cancel()
  616.             ClearCommandQueue()
  617.             SetState("BuildTerminal1")
  618.         END
  619.     END
  620.  
  621. [STATE VerifyTerminal1Location]
  622.     IF IsHighlighted(Storage3ID)
  623.     THEN
  624.         NextCommand.Run()
  625.         Station5ID = User.GetLastBuildingBuilt()
  626.         ClearCommandQueue()
  627.         SetState("BuildTerminal2")
  628.     ELSE
  629.         TutorialTextID = 600
  630.         ReturnState = 'WaitForTerminal1'
  631.         SetState("Show_tutorial_text")
  632.     END
  633.  
  634. // ============================================================================
  635. // BuildStation2
  636. // ============================================================================
  637. [STATE BuildTerminal2]    
  638.     TutorialTextID = 560
  639.     ReturnState = 'WaitForTerminal2'
  640.     SetState("Show_tutorial_text")
  641.  
  642. [STATE WaitForTerminal2]    
  643.     IF IsEnterState
  644.     THEN
  645.         ClearCommandQueue()
  646.     END
  647.  
  648.     // Is there a queued command ? 
  649.     IF GetCommandQueueLength() > 0
  650.     THEN
  651.         IF NextCommand.GetType() == 9 AND
  652.             NextCommand.GetInternType() == 15
  653.         THEN    
  654.             SetState("VerifyTerminal2Location")
  655.         ELSE
  656.             NextCommand.Cancel()
  657.             ClearCommandQueue()
  658.             SetState("BuildTerminal2")
  659.         END
  660.     END
  661.  
  662. [STATE VerifyTerminal2Location]
  663.     IF IsHighlighted(Storage4ID)
  664.     THEN
  665.         NextCommand.Run()
  666.         Station6ID = User.GetLastBuildingBuilt()
  667.         ClearCommandQueue()
  668.         SetState("ConnectStations_2")
  669.     ELSE
  670.         TutorialTextID = 600
  671.         ReturnState = 'WaitForStation2'
  672.         SetState("Show_tutorial_text")
  673.     END
  674.  
  675. // ============================================================================
  676. // ConnectStations
  677. // ============================================================================
  678. [STATE ConnectStations_2] 
  679.     IF AreConnected(Station5ID, Station6ID) > 0
  680.     THEN
  681.         SetState("CloseBuildingDlg_3")
  682.     ELSE
  683.         TutorialTextID = 563
  684.         ReturnState = 'WaitForConnecting_2'
  685.         SetState("Show_tutorial_text")
  686.     END
  687.  
  688. [STATE WaitForInsertRoute_2]
  689.     IF IsEnterState
  690.     THEN
  691.         ClearCommandQueue()
  692.     END
  693.  
  694.     // Is there a queued command ? 
  695.     IF GetCommandQueueLength() > 0
  696.     THEN
  697.         IF NextCommand.GetType() == 6 AND
  698.             NextCommand.GetInternType() == 4
  699.         THEN    
  700.             NextCommand.Run()
  701.             SetState("WaitForConnecting_2")
  702.         ELSE
  703.             NextCommand.Cancel()
  704.             ClearCommandQueue()
  705.             SetState("ConnectStations_2")
  706.         END
  707.     END
  708.  
  709. [STATE WaitForConnecting_2]
  710.     IF AreConnected(Station5ID, Station6ID) > 0
  711.     THEN
  712.         SetState("CloseBuildingDlg_3")
  713.     ELSE
  714.         SetState("WaitForInsertRoute_2")
  715.     END
  716.  
  717.  
  718. // ============================================================================
  719. // Close building dialog.
  720. // ============================================================================
  721. [STATE CloseBuildingDlg_3]
  722.     TutorialTextID = 530
  723.     ReturnState = 'WaitForBuildClose_3'
  724.     SetState("Show_tutorial_text")
  725.  
  726. [STATE WaitForBuildClose_3]
  727.     IF BuildDialog.IsOpen() == 0
  728.     THEN
  729.         SetState("BuyLorry")
  730.     END
  731.  
  732. // ============================================================================
  733. // BuyTrain
  734. // ============================================================================
  735. [STATE BuyLorry]    
  736.     TutorialTextID = 566
  737.     ReturnState = 'WaitForBuyLorryDlg'
  738.     SetState("Show_tutorial_text")
  739.  
  740. [STATE WaitForBuyClose_3]
  741.     IF BuyVehicleDialog.IsOpen() == 0
  742.     THEN
  743.         SetState("WaitForBuyLorryDlg")
  744.     END
  745.  
  746. [STATE WaitForBuyLorryDlg] 
  747.     IF BuyVehicleDialog.IsOpen() == 1
  748.     THEN
  749.         IF BuyVehicleDialog.GetStation() == Station5ID
  750.         THEN
  751.             TutorialTextID = 569
  752.             ReturnState = 'WaitForAccept_3'
  753.             SetState("Show_tutorial_text")
  754.         ELSE
  755.             TutorialTextID = 603
  756.             ReturnState = 'WaitForBuyClose_3'
  757.             SetState("Show_tutorial_text")
  758.         END
  759.     END
  760.  
  761. [STATE WaitForAccept_3]
  762.     IF IsEnterState
  763.     THEN
  764.         ClearCommandQueue()
  765.     END
  766.  
  767.     // Is there a queued command ? 
  768.     IF GetCommandQueueLength() > 0
  769.     THEN
  770.         IF NextCommand.GetType() == 10
  771.         THEN    
  772.             NextCommand.Run()
  773.             SetState("Schedule_3")
  774.         ELSE
  775.             NextCommand.Cancel()
  776.             ClearCommandQueue()
  777.             SetState("BuyLorry")
  778.         END
  779.     ELSE
  780.         IF BuyVehicleDialog.IsOpen() == 0
  781.         THEN
  782.             SetState("BuyLorry")
  783.         END
  784.     END
  785.  
  786.  
  787. // ============================================================================
  788. // Schedule
  789. // ============================================================================
  790. [STATE Schedule_3]
  791.     TutorialTextID = 572
  792.     ReturnState = 'WaitForFill_3'
  793.     SetState("Show_tutorial_text")
  794.  
  795. [STATE WaitForFill_3]
  796.     IF ScheduleDialog.IsOpen() == 0
  797.     THEN
  798.         SetState("BuyLorry")
  799.     ELSE
  800.         IF ScheduleDialog.IsFilled(0, 39, 1) == 1
  801.         THEN
  802.             TutorialTextID = 575
  803.             ReturnState = 'WaitForWaitUntilFull_3'
  804.             SetState("Show_tutorial_text")
  805.         END
  806.     END
  807.  
  808. [STATE WaitForWaitUntilFull_3]
  809.     IF ScheduleDialog.IsOpen() == 0
  810.     THEN
  811.         SetState("BuyLorry")
  812.     ELSE
  813.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  814.         THEN    
  815.             TutorialTextID = 578
  816.             ReturnState = 'WaitForOtherStation_3'
  817.             SetState("Show_tutorial_text")
  818.         END
  819.     END
  820.  
  821. [STATE WaitForOtherStation_3]
  822.     IF ScheduleDialog.IsOpen() == 0
  823.     THEN
  824.         SetState("BuyLorry")
  825.     ELSE
  826.         IF ScheduleDialog.GetNrStations() == 2
  827.         THEN
  828.             TutorialTextID = 581
  829.             ReturnState = 'WaitForAcceptDialog_3'
  830.             SetState("Show_tutorial_text")
  831.         END
  832.     END
  833.     
  834. [STATE WaitForAcceptDialog_3]
  835.     IF IsEnterState
  836.     THEN
  837.         ClearCommandQueue()
  838.     END
  839.  
  840.     // Is there a queued command ? 
  841.     IF GetCommandQueueLength() > 0
  842.     THEN
  843.         IF NextCommand.GetType() == 15
  844.         THEN    
  845.             NextCommand.Run()
  846.             SetState("MissionGoal")
  847.         ELSE
  848.             NextCommand.Cancel()
  849.             ClearCommandQueue()
  850.             SetState("BuyLorry")
  851.         END
  852.     ELSE
  853.         IF ScheduleDialog.IsOpen() == 0
  854.         THEN
  855.             SetState("BuyLorry")
  856.         END
  857.     END
  858.  
  859.  
  860. // ============================================================================
  861. // MISSION GOAL
  862. // ============================================================================
  863. [STATE MissionGoal]
  864.     FirstTutorialTextID = 533
  865.     LastTutorialTextID  = 534
  866.     ReturnState = 'End'
  867.     SetState("Show_tutorial_text_serie")
  868.  
  869.  
  870. // ============================================================================
  871. // END
  872. // ============================================================================
  873. [STATE End]
  874.  
  875.     IF IsEnterState
  876.     THEN
  877.         StopCommandFiltering()
  878.     END
  879.  
  880.     // Otherwise do nothing ... 
  881.  
  882.  
  883. // ============================================================================
  884. // HELPER STATES
  885. // 
  886. // Here are some states, which are used to do repetitive tasks.
  887. // ============================================================================
  888. //-----------------------------------------------------------------------------
  889. // Show_tutorial_text
  890. // - Opens tutorial text
  891. // - Waits until it is closed
  892. // - Returns to the return state
  893. // ----------------------------------------------------------------------------
  894. [STATE Show_tutorial_text]
  895.  
  896.     IF IsEnterState
  897.     THEN
  898.         TutorialText.Show(TutorialTextID)
  899.     ELSE
  900.         IF TutorialText.IsOpen() == 0
  901.         THEN 
  902.             SetState(ReturnState)
  903.         END
  904.     END
  905.  
  906. //-----------------------------------------------------------------------------
  907. // Show_tutorial_text_serie
  908. // - Shows a serie of tutorial texts from FirstTutorialTextID to LastTutorialTextID
  909. // ----------------------------------------------------------------------------
  910. [STATE Show_tutorial_text_serie]
  911.  
  912.     IF IsEnterState
  913.     THEN
  914.         Local_i = FirstTutorialTextID
  915.         TutorialText.Show(FirstTutorialTextID)
  916.     ELSE
  917.         IF TutorialText.IsOpen() == 0
  918.         THEN 
  919.             Local_i = Local_i + 1
  920.             
  921.             IF Local_i > LastTutorialTextID
  922.             THEN
  923.                 SetState(ReturnState)
  924.             ELSE
  925.                 TutorialText.Show(Local_i)
  926.             END
  927.         END
  928.     END
  929.  
  930.  
  931.