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 >
Wrap
Text File
|
2002-05-29
|
24KB
|
931 lines
// ============================================================================
// TUTORIAL 2
//
// The script implements tutorial nr 2.
//
// Topic :
// - Building complex production
// - Playing with production parameters
// ============================================================================
// ============================================================================
// VARIABLES
// ============================================================================
[VARIABLES]
// Parameter variables.
ReturnState$
FirstTutorialTextID
LastTutorialTextID
TutorialTextID
// Helper variables.
Local_i
// Building IDs
Storage1ID
Storage2ID
Storage3ID
Storage4ID
Station1ID
Station2ID
Station3ID
Station4ID
Station5ID
Station6ID
// ============================================================================
// INIT
// ============================================================================
[STATE Load]
LoadGame("missions\\00_02_Tutorial 3_1900.ig2")
LoadMissionConfig("missions\\00_02_Tutorial 3_1900.mis")
SetOutputMode(2)
SetMsgFilter(65535)
StartCommandFiltering()
ControlBar.SetDisable(871)
DialogControl.SetDisable(16)
Storage1ID = 252
Storage2ID = 108
Time.SetPace(1)
SetState("Intro")
// ============================================================================
// INTRO
// ============================================================================
[STATE Intro]
FirstTutorialTextID = 500
LastTutorialTextID = 501
ReturnState = 'BuildStation1'
SetState("Show_tutorial_text_serie")
// ============================================================================
// BuildStation1
// ============================================================================
[STATE BuildStation1]
TutorialTextID = 503
ReturnState = 'WaitForStation1'
SetState("Show_tutorial_text")
[STATE WaitForStation1]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 3
THEN
SetState("VerifyStation1Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildStation1")
END
END
[STATE VerifyStation1Location]
IF IsHighlighted(Storage1ID)
THEN
NextCommand.Run()
Station1ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("BuildStation2")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForStation1'
SetState("Show_tutorial_text")
END
// ============================================================================
// BuildStation2
// ============================================================================
[STATE BuildStation2]
TutorialTextID = 506
ReturnState = 'WaitForStation2'
SetState("Show_tutorial_text")
[STATE WaitForStation2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 3
THEN
SetState("VerifyStation2Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildStation2")
END
END
[STATE VerifyStation2Location]
IF IsHighlighted(Storage2ID)
THEN
NextCommand.Run()
Station2ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("ConnectStations")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForStation2'
SetState("Show_tutorial_text")
END
// ============================================================================
// ConnectStations
// ============================================================================
[STATE ConnectStations]
TutorialTextID = 509
ReturnState = 'WaitForConnecting'
SetState("Show_tutorial_text")
[STATE WaitForInsertRoute]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 6 AND
NextCommand.GetInternType() == 1
THEN
NextCommand.Run()
SetState("WaitForConnecting")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("ConnectStations")
END
END
[STATE WaitForConnecting]
IF AreConnected(Station1ID, Station2ID) > 0
THEN
SetState("AddRepairPlace")
ELSE
SetState("WaitForInsertRoute")
END
// ============================================================================
// AddRepairPlace
// ============================================================================
[STATE AddRepairPlace]
TutorialTextID = 512
ReturnState = 'WaitForRepairPlace'
SetState("Show_tutorial_text")
[STATE WaitForRepairPlace]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 43
THEN
NextCommand.Run()
SetState("CloseBuildingDlg")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("ConnectStations")
END
END
// ============================================================================
// Close building dialog.
// ============================================================================
[STATE CloseBuildingDlg]
TutorialTextID = 515
ReturnState = 'WaitForBuildClose'
SetState("Show_tutorial_text")
[STATE WaitForBuildClose]
IF BuildDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
END
// ============================================================================
// BuyTrain
// ============================================================================
[STATE BuyTrain]
TutorialTextID = 518
ReturnState = 'WaitForBuyTrainDlg'
SetState("Show_tutorial_text")
[STATE WaitForBuyClose]
ClearCommandQueue()
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("WaitForBuyTrainDlg")
END
[STATE WaitForBuyTrainDlg]
IF BuyVehicleDialog.IsOpen() == 1
THEN
IF BuyVehicleDialog.GetStation() == Station1ID
THEN
TutorialTextID = 521
ReturnState = 'WaitForAccept'
SetState("Show_tutorial_text")
ELSE
TutorialTextID = 603
ReturnState = 'WaitForBuyClose'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAccept]
IF IsEnterState
THEN
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() <> 10
THEN
ClearCommandQueue()
END
END
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 10
THEN
NextCommand.Run()
SetState("PreSchedule")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyTrain")
END
ELSE
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
END
END
// ============================================================================
// Schedule
// ============================================================================
[STATE PreSchedule]
IF ScheduleDialog.IsOpen() == 1
THEN
SetState("Schedule")
END
[STATE Schedule]
FirstTutorialTextID = 524
LastTutorialTextID = 525
ReturnState = 'WaitForFill'
SetState("Show_tutorial_text_serie")
[STATE WaitForFill]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
ELSE
IF ScheduleDialog.IsFilled(0, 39, 4) == 1
THEN
TutorialTextID = 527
ReturnState = 'WaitForWaitUntilFull'
SetState("Show_tutorial_text")
END
END
[STATE WaitForWaitUntilFull]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
ELSE
IF ScheduleDialog.GetWaitUntilFull(0) == 1
THEN
TutorialTextID = 530
ReturnState = 'WaitForOtherStation'
SetState("Show_tutorial_text")
END
END
[STATE WaitForOtherStation]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
ELSE
IF ScheduleDialog.GetNrStations() == 2
THEN
TutorialTextID = 531
ReturnState = 'WaitForAcceptDialog'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAcceptDialog]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 15
THEN
NextCommand.Run()
SetState("MissionGoal")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyTrain")
END
ELSE
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyTrain")
END
END
// ============================================================================
// BuildHarbour1
// ============================================================================
[STATE BuildHarbour1]
TutorialTextID = 533
ReturnState = 'WaitForHarbour1'
SetState("Show_tutorial_text")
[STATE WaitForHarbour1]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 2
THEN
SetState("VerifyHarbour1Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildHarbour1")
END
END
[STATE VerifyHarbour1Location]
IF IsHighlighted(Storage2ID)
THEN
NextCommand.Run()
Station3ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("BuildHarbour2")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForHarbour1'
SetState("Show_tutorial_text")
END
// ============================================================================
// BuildHarbour2
// ============================================================================
[STATE BuildHarbour2]
TutorialTextID = 536
ReturnState = 'WaitForHarbour2'
SetState("Show_tutorial_text")
[STATE WaitForHarbour2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 2
THEN
SetState("VerifyHarbour2Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildHarbour2")
END
END
[STATE VerifyHarbour2Location]
IF IsHighlighted(Storage3ID)
THEN
NextCommand.Run()
Station4ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("CloseBuildingDlg_2")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForHarbour2'
SetState("Show_tutorial_text")
END
// ============================================================================
// Close building dialog.
// ============================================================================
[STATE CloseBuildingDlg_2]
TutorialTextID = 530
ReturnState = 'WaitForBuildClose_2'
SetState("Show_tutorial_text")
[STATE WaitForBuildClose_2]
IF BuildDialog.IsOpen() == 0
THEN
SetState("BuyShip")
END
// ============================================================================
// BuyShip
// ============================================================================
[STATE BuyShip]
TutorialTextID = 539
ReturnState = 'WaitForBuyShipDlg'
SetState("Show_tutorial_text")
[STATE WaitForBuyClose_2]
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("WaitForBuyShipDlg")
END
[STATE WaitForBuyShipDlg]
IF BuyVehicleDialog.IsOpen() == 1
THEN
IF BuyVehicleDialog.GetStation() == Station3ID
THEN
TutorialTextID = 542
ReturnState = 'WaitForAccept_2'
SetState("Show_tutorial_text")
ELSE
TutorialTextID = 603
ReturnState = 'WaitForBuyClose_2'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAccept_2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 10
THEN
NextCommand.Run()
SetState("Schedule_2")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyShip")
END
ELSE
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("BuyShip")
END
END
// ============================================================================
// Schedule
// ============================================================================
[STATE Schedule_2]
TutorialTextID = 545
ReturnState = 'WaitForFill_2'
SetState("Show_tutorial_text")
[STATE WaitForFill_2]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyShip")
ELSE
IF ScheduleDialog.IsFilled(0, 39, 12) == 1
THEN
TutorialTextID = 548
ReturnState = 'WaitForWaitUntilFull_2'
SetState("Show_tutorial_text")
END
END
[STATE WaitForWaitUntilFull_2]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyShip")
ELSE
IF ScheduleDialog.GetWaitUntilFull(0) == 1
THEN
TutorialTextID = 551
ReturnState = 'WaitForOtherStation_2'
SetState("Show_tutorial_text")
END
END
[STATE WaitForOtherStation_2]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyShip")
ELSE
IF ScheduleDialog.GetNrStations() == 2
THEN
TutorialTextID = 554
ReturnState = 'WaitForAcceptDialog_2'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAcceptDialog_2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 15
THEN
NextCommand.Run()
SetState("BuildTerminal1")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyShip")
END
ELSE
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyShip")
END
END
// ============================================================================
// BuildTerminal1
// ============================================================================
[STATE BuildTerminal1]
TutorialTextID = 557
ReturnState = 'WaitForTerminal1'
SetState("Show_tutorial_text")
[STATE WaitForTerminal1]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 15
THEN
SetState("VerifyTerminal1Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildTerminal1")
END
END
[STATE VerifyTerminal1Location]
IF IsHighlighted(Storage3ID)
THEN
NextCommand.Run()
Station5ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("BuildTerminal2")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForTerminal1'
SetState("Show_tutorial_text")
END
// ============================================================================
// BuildStation2
// ============================================================================
[STATE BuildTerminal2]
TutorialTextID = 560
ReturnState = 'WaitForTerminal2'
SetState("Show_tutorial_text")
[STATE WaitForTerminal2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 9 AND
NextCommand.GetInternType() == 15
THEN
SetState("VerifyTerminal2Location")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuildTerminal2")
END
END
[STATE VerifyTerminal2Location]
IF IsHighlighted(Storage4ID)
THEN
NextCommand.Run()
Station6ID = User.GetLastBuildingBuilt()
ClearCommandQueue()
SetState("ConnectStations_2")
ELSE
TutorialTextID = 600
ReturnState = 'WaitForStation2'
SetState("Show_tutorial_text")
END
// ============================================================================
// ConnectStations
// ============================================================================
[STATE ConnectStations_2]
IF AreConnected(Station5ID, Station6ID) > 0
THEN
SetState("CloseBuildingDlg_3")
ELSE
TutorialTextID = 563
ReturnState = 'WaitForConnecting_2'
SetState("Show_tutorial_text")
END
[STATE WaitForInsertRoute_2]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 6 AND
NextCommand.GetInternType() == 4
THEN
NextCommand.Run()
SetState("WaitForConnecting_2")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("ConnectStations_2")
END
END
[STATE WaitForConnecting_2]
IF AreConnected(Station5ID, Station6ID) > 0
THEN
SetState("CloseBuildingDlg_3")
ELSE
SetState("WaitForInsertRoute_2")
END
// ============================================================================
// Close building dialog.
// ============================================================================
[STATE CloseBuildingDlg_3]
TutorialTextID = 530
ReturnState = 'WaitForBuildClose_3'
SetState("Show_tutorial_text")
[STATE WaitForBuildClose_3]
IF BuildDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
END
// ============================================================================
// BuyTrain
// ============================================================================
[STATE BuyLorry]
TutorialTextID = 566
ReturnState = 'WaitForBuyLorryDlg'
SetState("Show_tutorial_text")
[STATE WaitForBuyClose_3]
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("WaitForBuyLorryDlg")
END
[STATE WaitForBuyLorryDlg]
IF BuyVehicleDialog.IsOpen() == 1
THEN
IF BuyVehicleDialog.GetStation() == Station5ID
THEN
TutorialTextID = 569
ReturnState = 'WaitForAccept_3'
SetState("Show_tutorial_text")
ELSE
TutorialTextID = 603
ReturnState = 'WaitForBuyClose_3'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAccept_3]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 10
THEN
NextCommand.Run()
SetState("Schedule_3")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyLorry")
END
ELSE
IF BuyVehicleDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
END
END
// ============================================================================
// Schedule
// ============================================================================
[STATE Schedule_3]
TutorialTextID = 572
ReturnState = 'WaitForFill_3'
SetState("Show_tutorial_text")
[STATE WaitForFill_3]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
ELSE
IF ScheduleDialog.IsFilled(0, 39, 1) == 1
THEN
TutorialTextID = 575
ReturnState = 'WaitForWaitUntilFull_3'
SetState("Show_tutorial_text")
END
END
[STATE WaitForWaitUntilFull_3]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
ELSE
IF ScheduleDialog.GetWaitUntilFull(0) == 1
THEN
TutorialTextID = 578
ReturnState = 'WaitForOtherStation_3'
SetState("Show_tutorial_text")
END
END
[STATE WaitForOtherStation_3]
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
ELSE
IF ScheduleDialog.GetNrStations() == 2
THEN
TutorialTextID = 581
ReturnState = 'WaitForAcceptDialog_3'
SetState("Show_tutorial_text")
END
END
[STATE WaitForAcceptDialog_3]
IF IsEnterState
THEN
ClearCommandQueue()
END
// Is there a queued command ?
IF GetCommandQueueLength() > 0
THEN
IF NextCommand.GetType() == 15
THEN
NextCommand.Run()
SetState("MissionGoal")
ELSE
NextCommand.Cancel()
ClearCommandQueue()
SetState("BuyLorry")
END
ELSE
IF ScheduleDialog.IsOpen() == 0
THEN
SetState("BuyLorry")
END
END
// ============================================================================
// MISSION GOAL
// ============================================================================
[STATE MissionGoal]
FirstTutorialTextID = 533
LastTutorialTextID = 534
ReturnState = 'End'
SetState("Show_tutorial_text_serie")
// ============================================================================
// END
// ============================================================================
[STATE End]
IF IsEnterState
THEN
StopCommandFiltering()
END
// Otherwise do nothing ...
// ============================================================================
// HELPER STATES
//
// Here are some states, which are used to do repetitive tasks.
// ============================================================================
//-----------------------------------------------------------------------------
// Show_tutorial_text
// - Opens tutorial text
// - Waits until it is closed
// - Returns to the return state
// ----------------------------------------------------------------------------
[STATE Show_tutorial_text]
IF IsEnterState
THEN
TutorialText.Show(TutorialTextID)
ELSE
IF TutorialText.IsOpen() == 0
THEN
SetState(ReturnState)
END
END
//-----------------------------------------------------------------------------
// Show_tutorial_text_serie
// - Shows a serie of tutorial texts from FirstTutorialTextID to LastTutorialTextID
// ----------------------------------------------------------------------------
[STATE Show_tutorial_text_serie]
IF IsEnterState
THEN
Local_i = FirstTutorialTextID
TutorialText.Show(FirstTutorialTextID)
ELSE
IF TutorialText.IsOpen() == 0
THEN
Local_i = Local_i + 1
IF Local_i > LastTutorialTextID
THEN
SetState(ReturnState)
ELSE
TutorialText.Show(Local_i)
END
END
END