PromptHeading = ID_TUTORIAL_5_OFFSET + 1
g_currentprompt = 0;
g_counter = 0;
Tweaks.numyearsin24hours = 0;

-------------------------------------------------------------------------------------------------
-- INITIALISE_Level. Standard level event
-------------------------------------------------------------------------------------------------
function EVENTINITIALISE_Level()
	-- load the building and business file
	C_RunScript("scripts\\maps\\tempmap.lua");
	C_RunScript("scripts\\tutorial1\\initialpref.lua");

end;

-------------------------------------------------------------------------------------------------
-- Level. Standard level event.
-------------------------------------------------------------------------------------------------
function EVENT_Level()
	-- create an initial prompt
	C_TriggerEvent("BlockCam", 1, PACIFIC_AVENUE);

	Interface.DisableAllControls();
	Interface.DisableAll3DPicking();
	Interface.DisableCameraControl();
	-- create the initial prompt
	CreatePrompt(1);
end;

function CATCHEVENT_InterfacePromptDismiss(a)
	CreatePrompt(a);
end;

function CATCHEVENT_TutorialEvent(a)

   if g_currentprompt == 17 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_ACCEPT);
	end;

   if g_currentprompt == 16 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_CHANGE_DESIGN);
	end;

   if g_currentprompt == 15 then
		Interface.DismissPrompt();
--		Interface.DisableControl(TUT_BUILD_QUALITY_LOW);
--		Interface.DisableControl(TUT_BUILD_QUALITY_MED);
--		Interface.DisableControl(TUT_BUILD_QUALITY_HIGH);
	end;


   if g_currentprompt == 14 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_CHANGE_FLOOR);
	end;


   if g_currentprompt == 11 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

   if g_currentprompt == 10 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_SELECT_BACK_DRAG_TEXT);
		Interface.DisableControl(TUT_BUILD_SELECT_BACK_DRAG_BUTTON);
		Interface.DisableControl(TUT_BUILD_BACKREGION2);

	end;

   if g_currentprompt == 8 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

   if g_currentprompt == 7 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_SELECT_USE);
	end;

   if g_currentprompt == 6 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BUILD_SELECT_TYPE);
	end;
		
	if g_currentprompt == 5 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_GREENBUTTON_3);
	end;

	if g_currentprompt == 2 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_AERIAL_INFOBUTTON_3);
	end;


	if g_currentprompt == 1 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_TOGGLE_VIEW);
	end;

end;

function CATCHEVENT_Picked3D(a)

	if a == 1 and g_currentprompt == 3 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

end;

-- SR - Added new comments to make certain aspects a little clearer, this is not represented in the document but has been discussed with JL

-- prompt manager
function CreatePrompt(a)
	g_currentprompt = a;
	body = a+PromptHeading;

	if a == 1 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Okay, let's learn how to build. First you need to find out whether you can build on a block. Click on the 'Compass' icon to goto strategic view...", a+1);
		Interface.EnableControl(TUT_TOGGLE_VIEW);
		Interface.AddArrow( 534, 460 );
	elseif a == 2 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now click on the Building Rights button here...", a+1);
		Interface.EnableControl(TUT_AERIAL_INFOBUTTON_3);
		Interface.AddArrow( 100, 52 );
	elseif a == 3 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"For this tutorial we will be building on Pacific avenue, there are no rights for this block so we can build on it...lets go back to Block mode, double click on Pacific avenue...", a+1);
		Interface.PositionPrompt(0,100);
		Interface.AddArrow( 459, 173);
		Interface.EnableBlockPicking(PACIFIC_AVENUE);
	elseif a == 4 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"You can also find out whether you can build when in Block mode here...", a+1);
		Interface.AddArrow( 188, 104 );
	elseif a == 5 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Ok lets build a building, click the Build button here...", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_3);
		Interface.AddArrow( 30, 117 );
	elseif a == 6 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now you can choose to build a Retail or Residential building. Lets choose Retail...", a+1);
		Interface.EnableControl(TUT_BUILD_SELECT_TYPE);
		Interface.SetTutorialType(0);		
		Interface.AddArrow( 112, 66 );
	elseif a == 7 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now choose the use for your building.", a+1);
		Interface.EnableControl(TUT_BUILD_SELECT_USE);
	elseif a == 8 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now you can click and drag the area you want the building to cover. The building must touch at least one pavement and must not overlap any other buildings. When the area is white the store is good to build, when red it is not. Release the button when the area is white. ", a+1);
		Interface.EnableBlockPicking(PACIFIC_AVENUE);
		Interface.PositionPrompt(0,-140);
		Interface.AddArrow( 318, 220 );
	elseif a == 9 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"You could build this building now. Here is the cost and capacity.", a+1);
		Interface.EnableControl(TUT_BUILD_QUALITY_LOW);
		Interface.EnableControl(TUT_BUILD_QUALITY_MED);
		Interface.EnableControl(TUT_BUILD_QUALITY_HIGH);
		Interface.AddArrow( 155, 240 );
	elseif a == 10 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"If it were too expensive you could re-drag the area you want to cover by clicking back here. Try it. ", a+1);
		Interface.EnableControl(TUT_BUILD_SELECT_BACK_DRAG_TEXT);
		Interface.EnableControl(TUT_BUILD_SELECT_BACK_DRAG_BUTTON);
		Interface.EnableControl(TUT_BUILD_BACKREGION2);
		Interface.AddArrow( 131, 110 );
	elseif a == 11 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now you can drag another area.  ", a+1);
		Interface.EnableBlockPicking(PACIFIC_AVENUE);
		Interface.AddArrow( 318, 220 );
	elseif a == 12 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"Remember that you can also click on this area again to choose another use...", a+1);
		Interface.AddArrow( 129, 80 );
	elseif a == 13 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"or here to choose the type of building...Lets stick with what we have now and see what else we can change.", a+1);
		Interface.AddArrow( 129, 59 );
	elseif a == 14 then
		Interface.CreatePrompt(PromptHeading,body, a+1);--"On all buildings you can change the number of floors. Some buildings have only one floor level, however if you can choose the number of floors, watch how the price and capacity changes...", a+1);
		Interface.EnableControl(TUT_BUILD_CHANGE_FLOOR);
	
		Interface.AddArrow( 114, 141 );
	elseif a == 15 then
		Interface.CreatePrompt(PromptHeading,body, a+1);--"You can also change the quality of the building. High quality will appeal to the richer citizens, but it will cost more to build - see the price change when you select another quality level. ", a+1);
		Interface.AddArrow( 102, 170 );
	elseif a == 16 then
		Interface.CreatePrompt(PromptHeading,body, a+1);--"Finally, you can choose what your building should look like. Choose one of the styles if you wish... ", a+1);
		Interface.EnableControl(TUT_BUILD_CHANGE_DESIGN);
		Interface.AddArrow( 115, 197 );
	elseif a == 17 then
		Interface.CreateMessage(PromptHeading,body, a+1);--"Now you are ready to build. Check price one last time and hit the Accept button. Lets see how the building is constructed...", a+1);
		Interface.EnableControl(TUT_BUILD_ACCEPT);
		Interface.AddArrow( 100, 265 );
	elseif a == 18 then
		Interface.CreatePrompt(PromptHeading,body, a+1);--"Great. Now you know how to build! ", a+1);
	elseif a == 19 then
		Game.End(true);
	end;
end;
