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

  1. // ============================================================================
  2. // TUTORIAL 1
  3. // 
  4. // The script implements tutorial nr 1.
  5. //
  6. // Topic :
  7. //     - Basic navigation
  8. //    - Building basic production
  9. // ============================================================================
  10.  
  11. // ============================================================================
  12. // VARIABLES
  13. // ============================================================================
  14.  
  15. [VARIABLES]
  16.  
  17.     // Parameter variables.
  18.     ReturnState$
  19.     FirstTutorialTextID
  20.     LastTutorialTextID
  21.     TutorialTextID
  22.  
  23.     // Global variables.
  24.     LastBuildingTime
  25.     LastEvaluationTime
  26.     Shop_X
  27.     Shop_Y
  28.     ShopID
  29.     Farm_X
  30.     Farm_Y
  31.     FarmID
  32.     StoragePlace_X
  33.     StoragePlace_Y
  34.     StoragePlaceID
  35.  
  36.     // Local temporary variables.
  37.     Local_i
  38.     Local_j
  39.     temp
  40.  
  41.  
  42. // ============================================================================
  43. // INIT
  44. // ============================================================================
  45. [STATE Load]
  46.  
  47.     LoadGame("missions\\00_00_Tutorial 1_1900.ig2")
  48.     LoadMissionConfig("missions\\00_00_Tutorial 1_1900.mis")
  49.     SetOutputMode(2)
  50.     SetMsgFilter(65535)
  51.     StartCommandFiltering()
  52.     ControlBar.SetDisable(871)
  53.     DialogControl.SetDisable(22)
  54.     Time.SetPace(1)
  55.     SetState("Explain_Scrolling")
  56.  
  57.  
  58. // ============================================================================
  59. // EXPLANATION : RECALL NEWS
  60. // ============================================================================
  61. [STATE Explain_News]
  62.     TutorialTextID = 203
  63.     ReturnState = 'Wait_for_news_list'
  64.     SetState("Show_tutorial_text")
  65.  
  66. [STATE Wait_for_news_list]
  67.     IF NewsDialog.IsOpen() == 1
  68.     THEN
  69.         SetState("Wait_for_news_close")
  70.     END
  71.  
  72. [STATE Wait_for_news_close]
  73.     IF NewsDialog.IsOpen() == 0
  74.     THEN
  75.         SetState("Start_build_shop")
  76.     END
  77.  
  78.  
  79. // ============================================================================
  80. // EXPLANATION : BASIC NAVIGATION
  81. // ============================================================================
  82. [STATE Explain_Scrolling]
  83.     FirstTutorialTextID = 200
  84.     LastTutorialTextID  = 201
  85.     ReturnState = 'Wait_Scroll'
  86.     SetState("Show_tutorial_text_serie")
  87.  
  88. [STATE Wait_Scroll]
  89.     IF IsEnterState
  90.     THEN
  91.         Local_i = GetMapOriginY()
  92.         Local_j = GetMapOriginX()
  93.     ELSE
  94.         IF Local_i <> GetMapOriginY() OR
  95.             Local_j <> GetMapOriginX()
  96.         THEN
  97.             SetState("Wait_Not_Scroll")
  98.         END
  99.     END
  100.  
  101. [STATE Wait_Not_Scroll]
  102.     IF IsEnterState
  103.     THEN
  104.         temp = Time.ms
  105.         Local_i = GetMapOriginY()
  106.         Local_j = GetMapOriginX()
  107.     ELSE
  108.         IF Local_i <> GetMapOriginY() OR
  109.             Local_j <> GetMapOriginX()
  110.         THEN
  111.             // Still scrolling ...
  112.             Local_i = GetMapOriginY()
  113.             Local_j = GetMapOriginX()
  114.             temp = Time.ms
  115.         ELSE
  116.             IF temp + 200 < Time.ms
  117.             THEN
  118.                 SetState("Explain_Minimap")
  119.             END
  120.         END
  121.     END
  122.  
  123. [STATE Explain_Zoom]
  124.     TutorialTextID    = 260
  125.     ReturnState        = 'Explain_Minimap'
  126.     SetState("Show_tutorial_text")
  127.  
  128. [STATE Explain_Minimap]
  129.     TutorialTextID    = 202
  130.     ReturnState        = 'Wait_for_Minimap'
  131.     SetState("Show_tutorial_text")
  132.  
  133. [STATE Wait_for_Minimap]
  134.     IF IsDialogOpen("MiniMap_S_Dlg.uif") OR
  135.         IsDialogOpen("MiniMap_L_Dlg.uif")
  136.     THEN 
  137.         SetState("Explain_News")
  138.     END
  139.  
  140.  
  141. // ============================================================================
  142. // EXPLANATION : HOW TO BUILD
  143. // ============================================================================
  144. [STATE Explain_how_to_build]
  145.     CenterUserViewTo(68, 83)
  146.     FirstTutorialTextID        = 205
  147.     LastTutorialTextID        = 207
  148.     ReturnState        = 'Start_build_shop'
  149.     SetState("Show_tutorial_text_serie")
  150.  
  151.  
  152. // ============================================================================
  153. // EXPLANATION : BUILD SHOP
  154. // ============================================================================
  155. [STATE Start_build_shop]
  156.     CenterUserViewTo(68, 83)
  157.     FirstTutorialTextID        = 205
  158.     LastTutorialTextID        = 207
  159.     ReturnState        = 'Wait_build_menu'
  160.     SetState("Show_tutorial_text_serie")
  161.  
  162. [STATE Explain_categories]
  163.     IF BuildDialog.IsOpen()
  164.     THEN 
  165.         FirstTutorialTextID        = 206
  166.         LastTutorialTextID        = 207
  167.         ReturnState        = 'Wait_shop_placing'
  168.         SetState("Show_tutorial_text_serie")
  169.     END
  170.  
  171. [STATE Wait_build_menu]
  172.  
  173.     IF BuildDialog.IsOpen()
  174.     THEN 
  175.         IF BuildDialog.GetPanelID() <> 3
  176.         THEN
  177.             FirstTutorialTextID        = 208
  178.             LastTutorialTextID        = 209
  179.             ReturnState        = 'Wait_shop_panel'
  180.             SetState("Show_tutorial_text_serie")
  181.         ELSE
  182.             SetState("Wait_shop_panel")
  183.         END
  184.     END
  185.  
  186. [STATE Wait_shop_panel]
  187.  
  188.     IF BuildDialog.GetPanelID() == 3
  189.     THEN
  190.         ClearCommandQueue()
  191.  
  192.         FirstTutorialTextID        = 210
  193.         LastTutorialTextID        = 213
  194.         ReturnState        = 'Wait_shop_placing'
  195.         SetState("Show_tutorial_text_serie")
  196.     ELSE    
  197.         IF BuildDialog.IsOpen() == 0
  198.         THEN             
  199.             SetState("Start_build_shop")
  200.         END
  201.     END
  202.  
  203. [STATE Wait_shop_selection]
  204.  
  205.     IF BuildDialog.GetSelectionID() == 7
  206.     THEN 
  207.         ClearCommandQueue()
  208.         FirstTutorialTextID        = 209
  209.         LastTutorialTextID        = 211
  210.         ReturnState        = 'Wait_shop_placing'
  211.         SetState("Show_tutorial_text_serie")
  212.  
  213.     ELSE
  214.         IF BuildDialog.IsOpen() == 0                
  215.         THEN             
  216.             SetState("Start_build_shop")
  217.         ELSE
  218.             IF BuildDialog.GetPanelID() <> 3                
  219.             THEN             
  220.                 FirstTutorialTextID        = 206
  221.                 LastTutorialTextID        = 207
  222.                 ReturnState        = 'Wait_shop_panel'
  223.                 SetState("Show_tutorial_text_serie")
  224.             END
  225.         END
  226.     END
  227.  
  228. [STATE Wait_shop_placing]
  229.  
  230.     // Is there a queued command ? 
  231.     IF GetCommandQueueLength() > 0
  232.     THEN
  233.         IF NextCommand.GetType() == 8 AND
  234.             NextCommand.GetInternType() == 7
  235.         THEN    
  236.             SetState("Verify_shop_location")
  237.         ELSE
  238.             NextCommand.Cancel()
  239.             ClearCommandQueue()
  240.             TutorialTextID    = 207
  241.             ReturnState        = 'Wait_shop_placing'
  242.             SetState("Show_tutorial_text")
  243.         END
  244.     ELSE
  245.         // Is the build menu closed ? 
  246.         IF BuildDialog.IsOpen() == 0
  247.         THEN 
  248.             // Ask the user to open it.
  249.             SetState("Start_build_shop")
  250.         ELSE
  251.             IF BuildDialog.GetPanelID() <> 3
  252.             THEN
  253.                 TutorialTextID        = 209
  254.                 ReturnState        = 'Wait_shop_panel'
  255.                 SetState("Show_tutorial_text")
  256.             END
  257.         END
  258.     END
  259.  
  260. [STATE Verify_shop_location]
  261.     
  262.     // Fetch the building coordinates.
  263.     Shop_X = NextCommand.GetX()
  264.     Shop_Y = NextCommand.GetY()
  265.  
  266.     // Is it near enough ?
  267.     IF abs(Shop_X - 69) < 10 AND 
  268.         abs(Shop_Y - 86) < 10
  269.     THEN
  270.         NextCommand.Run()
  271.         ShopID = User.GetLastBuildingBuilt()
  272.         ClearCommandQueue()
  273.         SetState("Start_build_storage_place")
  274.     ELSE
  275.         NextCommand.Cancel()
  276.         ClearCommandQueue()
  277.         TutorialTextID    = 104
  278.         ReturnState        = 'Wait_shop_placing'
  279.         SetState("Show_tutorial_text")
  280.     END
  281.  
  282.  
  283. // ============================================================================
  284. // EXPLANATION : BUILD STORAGE PLACE
  285. // ============================================================================
  286.  
  287. [STATE Start_build_storage_place]
  288.     FirstTutorialTextID        = 216
  289.     LastTutorialTextID        = 218
  290.     ReturnState        = 'Wait_storage_place_placement'
  291.     SetState("Show_tutorial_text_serie")
  292.  
  293. [STATE Wait_storage_place_selection]
  294.  
  295.     IF BuildDialog.IsOpen() == 1
  296.     THEN 
  297.         IF BuildDialog.GetPanelID() == 2
  298.         THEN
  299.             IF BuildDialog.GetSelectionID() == 1
  300.             THEN
  301.                 ClearCommandQueue() 
  302.                 TutorialTextID    = 223
  303.                 ReturnState        = 'Wait_storage_place_placement'
  304.                 SetState("Show_tutorial_text")
  305.             END
  306.         END
  307.     END
  308.  
  309. [STATE Wait_storage_place_placement]
  310.  
  311.     // Is there a queued command ? 
  312.     IF GetCommandQueueLength() > 0
  313.     THEN
  314.         IF NextCommand.GetType() == 7
  315.         THEN    
  316.             SetState("Verify_Storage_place_location")
  317.         ELSE
  318.             NextCommand.Cancel()
  319.             ClearCommandQueue()
  320.             SetState("Start_build_storage_place")
  321.         END
  322.     END
  323.  
  324. [STATE Verify_Storage_place_location]
  325.     // Check are both farm and shop highlighted
  326.     IF IsHighlighted(ShopID)
  327.     THEN
  328.         NextCommand.Run()
  329.         StoragePlaceID = User.GetLastBuildingBuilt()
  330.         ClearCommandQueue()
  331.         SetState("Start_build_hen_farm")
  332.     ELSE
  333.         NextCommand.Cancel()
  334.         ClearCommandQueue()
  335.         TutorialTextID    = 218
  336.         ReturnState        = 'Wait_storage_place_placement'
  337.         SetState("Show_tutorial_text")
  338.     END
  339.  
  340.  
  341.  
  342. // ============================================================================
  343. // EXPLANATION : BUILD HEN FARM
  344. // ============================================================================
  345.  
  346. [STATE Start_build_hen_farm]
  347.  
  348.     TutorialTextID    = 221
  349.     ReturnState        = 'Wait_farm_selection'
  350.     SetState("Show_tutorial_text")
  351.  
  352. [STATE Wait_farm_selection]
  353.  
  354.     ClearCommandQueue()
  355.  
  356.     IF BuildDialog.IsOpen() == 1
  357.     THEN 
  358.         IF BuildDialog.GetPanelID() == 1
  359.         THEN
  360.             IF BuildDialog.GetSelectionID() == 6
  361.             THEN
  362.                 TutorialTextID    = 224
  363.                 ReturnState        = 'Wait_farm_placement'
  364.                 SetState("Show_tutorial_text")
  365.             END
  366.         END
  367.     END
  368.  
  369. [STATE Wait_farm_placement]
  370.     
  371.     // Is there a queued command ? 
  372.     IF GetCommandQueueLength() > 0
  373.     THEN
  374.         IF NextCommand.GetType() == 4
  375.         THEN    
  376.             SetState("Verify_farm_location")
  377.         ELSE
  378.             NextCommand.Cancel()
  379.             ClearCommandQueue()
  380.             TutorialTextID    = 122
  381.             ReturnState        = 'Wait_farm_placement'
  382.             SetState("Show_tutorial_text")
  383.         END
  384.     ELSE
  385.         IF BuildDialog.IsOpen() == 0
  386.         THEN 
  387.             SetState("Start_build_hen_farm")
  388.         ELSE
  389.             IF BuildDialog.GetPanelID() <> 1
  390.             THEN
  391.                 SetState("Start_build_hen_farm")
  392.             ELSE
  393.                 IF BuildDialog.GetSelectionID() <> 6
  394.                 THEN
  395.                     SetState("Start_build_hen_farm")                   
  396.                 END
  397.             END
  398.         END
  399.     END
  400.  
  401. [STATE Verify_farm_location]
  402.     
  403.     // Fetch the building coordinates.
  404.     Farm_X = NextCommand.GetX()
  405.     Farm_Y = NextCommand.GetY()
  406.  
  407.     // Is it near enough ?
  408.     IF IsHighlighted(StoragePlaceID)
  409.     THEN
  410.         NextCommand.Run()
  411.         FarmID = User.GetLastBuildingBuilt()
  412.         ClearCommandQueue()
  413.         SetState("Start_set_production")
  414.     ELSE
  415.         NextCommand.Cancel()
  416.         ClearCommandQueue()
  417.         TutorialTextID    = 224
  418.         ReturnState        = 'Wait_farm_placement'
  419.         SetState("Show_tutorial_text")
  420.     END
  421.  
  422.  
  423. // ============================================================================
  424. // EXPLANATION : SET PRODUCTION
  425. // ============================================================================
  426.  
  427. [STATE Closing_build_menu]
  428.  
  429.     ClearCommandQueue()
  430.     TutorialTextID    = 227
  431.     ReturnState        = 'Wait_for_menu_closing'
  432.     SetState("Show_tutorial_text")
  433.  
  434. [STATE Wait_for_menu_closing]
  435.     
  436.     IF BuildDialog.IsOpen() == 0
  437.     THEN
  438.         SetState("Start_set_production")
  439.     END
  440.  
  441. [STATE Start_set_production]
  442.     FirstTutorialTextID        = 230
  443.     LastTutorialTextID        = 231
  444.     ReturnState        = 'Wait_for_production_menu'
  445.     SetState("Show_tutorial_text_serie")
  446.  
  447. [STATE Wait_for_production_menu]
  448.     
  449.     IF ProductionDialog.IsOpen() == 1
  450.     THEN
  451.         TutorialTextID    = 234
  452.         ReturnState        = 'Wait_for_product_selection'
  453.         SetState("Show_tutorial_text")
  454.     END
  455.  
  456. [STATE Wait_for_product_selection]
  457.  
  458.     IF ProductionDialog.GetProduct() == 18
  459.     THEN
  460.         TutorialTextID    = 237
  461.         ReturnState        = 'Wait_for_load'
  462.         SetState("Show_tutorial_text")
  463.     END
  464.  
  465.     IF ProductionDialog.IsOpen() == 0
  466.     THEN
  467.         SetState("Start_set_production")
  468.     END
  469.  
  470.  
  471. [STATE Wait_for_load]
  472.     IF ProductionDialog.GetLoad() == 50
  473.     THEN
  474.         ClearCommandQueue()
  475.         TutorialTextID = 240
  476.         ReturnState        = 'Wait_for_set_production'
  477.         SetState("Show_tutorial_text")
  478.     END
  479.  
  480.     IF ProductionDialog.IsOpen() == 0
  481.     THEN
  482.         SetState("Start_set_production")
  483.     END
  484.  
  485.  
  486. [STATE Wait_for_set_production]
  487.  
  488.     // Is there a queued command ? 
  489.     IF GetCommandQueueLength() > 0
  490.     THEN
  491.         IF NextCommand.GetType() == 14
  492.         THEN    
  493.             SetState("Verify_farm_production")
  494.         ELSE
  495.             NextCommand.Cancel()
  496.             ClearCommandQueue()
  497.             TutorialTextID    = 142
  498.             ReturnState        = 'Wait_for_production_menu'
  499.             SetState("Show_tutorial_text")
  500.         END
  501.     ELSE
  502.         IF ProductionDialog.IsOpen() == 0
  503.         THEN
  504.             SetState("Start_set_production")
  505.         END
  506.     END
  507.     
  508. [STATE Verify_farm_production]
  509.     
  510.     // Is it eggs ?
  511.     IF NextCommand.GetInternType() == 18 AND
  512.         NextCommand.GetInternType2() == 0.50
  513.     THEN
  514.         NextCommand.Run()
  515.         ClearCommandQueue()
  516.         SetState("Wait_month_change")
  517.     ELSE
  518.         NextCommand.Cancel()
  519.         ClearCommandQueue()
  520.         SetState("Start_set_production")
  521.     END
  522.  
  523.  
  524. // ============================================================================
  525. // EXPLANATION : SHOP DIALOG
  526. // ============================================================================
  527. [STATE Wait_month_change]
  528.     IF IsEnterState
  529.     THEN
  530.         ControlBar.SetDisable(1023)
  531.         Time.SetPace(10)
  532.     END
  533.     
  534.     IF User.GetIncome() > 0
  535.     THEN
  536.         ControlBar.SetDisable(871)
  537.         Time.SetPace(0.25)
  538.         SetState("Start_explain_shop_dlg")
  539.     END
  540.  
  541. [STATE Start_explain_shop_dlg]
  542.  
  543.     FirstTutorialTextID        = 243
  544.     LastTutorialTextID        = 245
  545.     ReturnState        = 'Wait_for_shop_dlg'
  546.     SetState("Show_tutorial_text_serie")
  547.  
  548. [STATE Wait_for_shop_dlg]
  549.     
  550.     IF ShopDialog.IsOpen() == 1
  551.     THEN
  552.         TutorialTextID    = 248
  553.         ReturnState        = 'Wait_for_eggs'
  554.         SetState("Show_tutorial_text")
  555.     END
  556.  
  557. [STATE Wait_for_eggs]
  558.     
  559.     IF ShopDialog.IsOpen() == 0
  560.     THEN
  561.         SetState("Start_explain_shop_dlg")
  562.     END
  563.  
  564.     IF ShopDialog.GetProduct() == 18
  565.     THEN
  566.         FirstTutorialTextID        = 251
  567.         LastTutorialTextID        = 252
  568.         ReturnState        = 'Wait_for_demand_supply'
  569.         SetState("Show_tutorial_text_serie")
  570.     END
  571.  
  572. [STATE Wait_for_demand_supply]
  573.  
  574.     IF ShopDialog.IsOpen() == 0
  575.     THEN
  576.         SetState("Start_explain_shop_dlg")
  577.     END
  578.  
  579.     IF ShopDialog.GetButtonPressed() == 2
  580.     THEN
  581.         SetState("Explain_mission_goal")
  582.     END
  583.  
  584. [STATE Wait_for_product_profit]    
  585.  
  586.     IF ShopDialog.IsOpen() == 0
  587.     THEN
  588.         SetState("Start_explain_shop_dlg")
  589.     END
  590.  
  591.     IF ShopDialog.GetProduct() <> 18
  592.     THEN
  593.          TutorialTextID    = 231
  594.         ReturnState        = 'Wait_for_eggs'
  595.         SetState("Show_tutorial_text")       
  596.     END
  597.  
  598.     IF ShopDialog.GetButtonPressed() == 1
  599.     THEN
  600.         TutorialTextID    = 234
  601.         ReturnState        = 'Wait_for_product_sales'
  602.         SetState("Show_tutorial_text")
  603.     END
  604.  
  605. [STATE Wait_for_product_sales]    
  606.  
  607.     IF ShopDialog.IsOpen() == 0
  608.     THEN
  609.         SetState("Start_explain_shop_dlg")
  610.     END
  611.  
  612.     IF ShopDialog.GetProduct() <> 18
  613.     THEN
  614.          TutorialTextID    = 231
  615.         ReturnState        = 'Wait_for_eggs'
  616.         SetState("Show_tutorial_text")       
  617.     END
  618.  
  619.     IF ShopDialog.GetButtonPressed() == 0
  620.     THEN
  621.         TutorialTextID    = 235
  622.         ReturnState        = 'Go_back_to_demandsupply'
  623.         SetState("Show_tutorial_text")
  624.     END
  625.  
  626. [STATE Go_back_to_demandsupply]    
  627.  
  628.     IF ShopDialog.IsOpen() == 0
  629.     THEN
  630.         SetState("Start_explain_shop_dlg")
  631.     END
  632.  
  633.     IF ShopDialog.GetProduct() <> 18
  634.     THEN
  635.          TutorialTextID    = 231
  636.         ReturnState        = 'Wait_for_eggs'
  637.         SetState("Show_tutorial_text")       
  638.     END
  639.  
  640.     IF ShopDialog.GetButtonPressed() == 2
  641.     THEN
  642.         TutorialTextID    = 236
  643.         ReturnState        = 'Change_price_to_60'
  644.         SetState("Show_tutorial_text")
  645.     END
  646.  
  647. [STATE Change_price_to_60]    
  648.  
  649.     IF ShopDialog.IsOpen() == 0
  650.     THEN
  651.         SetState("Start_explain_shop_dlg")
  652.     END
  653.  
  654.     IF ShopDialog.GetProduct() <> 18
  655.     THEN
  656.          TutorialTextID    = 231
  657.         ReturnState        = 'Wait_for_eggs'
  658.         SetState("Show_tutorial_text")       
  659.     END
  660.  
  661.     IF ShopDialog.GetPrice() == 0.60
  662.     THEN
  663.         TutorialTextID    = 237
  664.         ReturnState        = 'Wait_for_dialog_accept'
  665.         SetState("Show_tutorial_text")
  666.     END
  667.  
  668. [STATE Wait_for_dialog_accept]
  669.  
  670.     // Is there a queued command ? 
  671.     IF GetCommandQueueLength() > 0
  672.     THEN
  673.         IF NextCommand.GetType() == 33
  674.             AND ChangeStore.GetPrice(18) == 0.60
  675.         THEN    
  676.             NextCommand.Run()
  677.             ClearCommandQueue()
  678.             SetState("Wait_month_change_2")
  679.         ELSE
  680.             NextCommand.Cancel()
  681.             ClearCommandQueue()
  682.             SetState("Start_explain_shop_dlg")
  683.         END
  684.     ELSE
  685.         IF ShopDialog.IsOpen() == 0
  686.         THEN
  687.             SetState("Start_explain_shop_dlg")
  688.         END
  689.     END
  690.  
  691. [STATE Wait_month_change_2]
  692.     IF IsEnterState
  693.     THEN
  694.         temp = Time.Month
  695.         Time.SetPace(10)
  696.     END
  697.     
  698.     IF temp <> Time.Month
  699.     THEN
  700.         Time.SetPace(1)
  701.         SetState("Start_explain_shop_dlg_2")
  702.     END
  703.  
  704. [STATE Start_explain_shop_dlg_2]
  705.  
  706.     TutorialTextID    = 215
  707.     ReturnState        = 'Wait_for_shop_dlg_2'
  708.     SetState("Show_tutorial_text")
  709.  
  710. [STATE Wait_for_shop_dlg_2]
  711.     
  712.     IF ShopDialog.IsOpen() == 1
  713.     THEN
  714.         SetState("Explain_mission_goal")
  715.     END
  716.  
  717. [STATE Wait_for_product_profit_2]    
  718.  
  719.     IF ShopDialog.IsOpen() == 0
  720.     THEN
  721.         SetState("Start_explain_shop_dlg_2")
  722.     END
  723.  
  724.     IF ShopDialog.GetButtonPressed() == 1
  725.     THEN
  726.         TutorialTextID    = 240
  727.         ReturnState        = 'Wait_for_product_sales_2'
  728.         SetState("Show_tutorial_text")
  729.     END
  730.  
  731. [STATE Wait_for_product_sales_2]    
  732.  
  733.     IF ShopDialog.IsOpen() == 0
  734.     THEN
  735.         SetState("Start_explain_shop_dlg_2")
  736.     END
  737.  
  738.     IF ShopDialog.GetButtonPressed() == 0
  739.     THEN
  740.         TutorialTextID    = 241
  741.         ReturnState        = 'Change_price_to_100'
  742.         SetState("Show_tutorial_text")
  743.     END
  744.  
  745. [STATE Change_price_to_100]    
  746.  
  747.     IF ShopDialog.IsOpen() == 0
  748.     THEN
  749.         SetState("Start_explain_shop_dlg_2")
  750.     END
  751.  
  752.     IF ShopDialog.GetPrice() == 1.0
  753.     THEN
  754.         TutorialTextID    = 242
  755.         ReturnState        = 'Wait_for_dialog_accept_2'
  756.         SetState("Show_tutorial_text")
  757.     END
  758.  
  759. [STATE Wait_for_dialog_accept_2]
  760.  
  761.     // Is there a queued command ? 
  762.     IF GetCommandQueueLength() > 0
  763.     THEN
  764.         IF NextCommand.GetType() == 33
  765.         THEN    
  766.             NextCommand.Run()
  767.             ClearCommandQueue()
  768.             SetState("Explain_mission_goal")
  769.         ELSE
  770.             NextCommand.Cancel()
  771.             ClearCommandQueue()
  772.             TutorialTextID    = 242
  773.             ReturnState        = 'Wait_for_dialog_accept_2'
  774.             SetState("Show_tutorial_text")
  775.         END
  776.     ELSE
  777.         IF ShopDialog.IsOpen() == 0
  778.         THEN
  779.             SetState("Start_explain_shop_dlg_2")
  780.         END
  781.     END
  782.  
  783.  
  784. // ============================================================================
  785. // EXPLANATION : MISSION GOAL
  786. // ============================================================================
  787.  
  788. [STATE Explain_mission_goal]
  789.     Time.SetPace(1)
  790.     FirstTutorialTextID        = 254
  791.     LastTutorialTextID        = 255
  792.     ReturnState        = 'End'
  793.     SetState("Show_tutorial_text_serie")
  794.  
  795.  
  796.  
  797. // ============================================================================
  798. // EXPLANATION : VCOND DIALOG
  799. // ============================================================================
  800. [STATE Explain_vcond]
  801.     TutorialTextID    = 252
  802.     ReturnState        = 'Wait_for_vcond_open'
  803.     SetState("Show_tutorial_text")
  804.  
  805. [STATE Wait_for_vcond_open]
  806.     IF IsDialogOpen("UIF_missiongoal.uif") == 1
  807.     THEN
  808.         TutorialTextID    = 253
  809.         ReturnState        = 'Wait_for_vcond_close'
  810.         SetState("Show_tutorial_text")
  811.     END
  812.  
  813. [STATE Wait_for_vcond_close]    
  814.     IF IsDialogOpen("UIF_missiongoal.uif") == 0
  815.     THEN
  816.         TutorialTextID    = 254
  817.         ReturnState        = 'End'
  818.         SetState("Show_tutorial_text")
  819.     END
  820.  
  821. [STATE End]
  822.  
  823.     IF IsEnterState
  824.     THEN
  825.         StopCommandFiltering()
  826.     END
  827.  
  828.     // Otherwise do nothing ... 
  829.  
  830.  
  831.  
  832.  
  833. // ============================================================================
  834. // HELPER STATES
  835. // 
  836. // Here are some states, which are used to do repetitive tasks.
  837. // ============================================================================
  838. //-----------------------------------------------------------------------------
  839. // Show_tutorial_text
  840. // - Opens tutorial text
  841. // - Waits until it is closed
  842. // - Returns to the return state
  843. // ----------------------------------------------------------------------------
  844. [STATE Show_tutorial_text]
  845.  
  846.     IF IsEnterState
  847.     THEN
  848.         TutorialText.Show(TutorialTextID)
  849.     ELSE
  850.         IF TutorialText.IsOpen() == 0
  851.         THEN 
  852.             SetState(ReturnState)
  853.         END
  854.     END
  855.  
  856. //-----------------------------------------------------------------------------
  857. // Show_tutorial_text_serie
  858. // - Shows a serie of tutorial texts from FirstTutorialTextID to LastTutorialTextID
  859. // ----------------------------------------------------------------------------
  860. [STATE Show_tutorial_text_serie]
  861.  
  862.     IF IsEnterState
  863.     THEN
  864.         Local_i = FirstTutorialTextID
  865.         TutorialText.Show(FirstTutorialTextID)
  866.     ELSE
  867.         IF TutorialText.IsOpen() == 0
  868.         THEN 
  869.             Local_i = Local_i + 1
  870.             
  871.             IF Local_i > LastTutorialTextID
  872.             THEN
  873.                 SetState(ReturnState)
  874.             ELSE
  875.                 TutorialText.Show(Local_i)
  876.             END
  877.         END
  878.     END
  879.