require( "scripts/style.lua" );

function QueueDisplayDialog( t )
 f = function() DisplayDialog(t) end; 
 QueueFunction(f);
end 

function QueueReadFile( t )
 f = function() ReadFile(t) end; 
 QueueFunction(f);
end 


function BlockAllBut( t )
	 if (t == "praise") then
		BlockDadActionButton(true);
		BlockMomActionButton(true);
		BlockPraise(false);
		BlockCorrect (true);
	 end
	 
	 if (t == "correct") then
	 	BlockDadActionButton(true);
		BlockMomActionButton(true);
		BlockPraise(true);
		BlockCorrect(false);
	 end
	  
	 if (t == "dad") then
	 	BlockDadActionButton(false);
		BlockMomActionButton(true);
		BlockPraise(true);
		BlockCorrect (true);
	 end
	  
	 if (t == "mom") then
	 	BlockDadActionButton(true);
		BlockMomActionButton(false);
		BlockPraise(true);
		BlockCorrect (true);
	 end
	 
	 if (t == "none") then
	 	BlockDadActionButton(true);
		BlockMomActionButton(true);
		BlockPraise(true);
		BlockCorrect (true);
	 end
	 
	 if (t == "all") then
	 	BlockDadActionButton(false);
		BlockMomActionButton(false);
		BlockPraise(false);
		BlockCorrect (false);
	 end
end 



function LoadTutorialChapter()
	if GetDay() == 1 and GetFamily() == 1 then
		return "level1chapter1"
	elseif GetDay() == 2 and GetFamily() == 1 then
		return "level2chapter1"
	elseif GetDay() == 3 and GetFamily() == 1 then
		return "level3chapter1"
	elseif GetDay() == 4 and GetFamily() == 1 then
		return "level4chapter1"
	elseif GetDay() == 5 and GetFamily() == 1 then
		return "level5chapter1"
	elseif GetDay() == 6 and GetFamily() == 1 then
		return "level6chapter1"
	elseif GetDay() == 7 and GetFamily() == 1 then
		return "level7chapter1"
	elseif GetDay() == 1 and GetFamily() == 2 then
		return "level1family2chapter1"
	elseif GetDay() == 2 and GetFamily() == 2 then
		return "level2family2chapter1"	
	elseif GetDay() == 1 and GetFamily() == 3 then
		return "level1family3chapter1"
	elseif GetDay() == 2 and GetFamily() == 3 then
		return "level2family3chapter1"	
	else
		return "finalchapter"
	end
end







level1chapter1 = {
	name = "level1chapter1",
	start = function()
				SetUseNormalIdles(false);
				StartTutorialChapter();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				BlockAllBut( "none" );
			end,
	condition = function()
					if (GetIdleType("mom") == 2) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				PauseGameTutorial();
				SetCameraPosition(0,0);
				SetArrowVisible(true);
				SetArrowPosition(900+55,350-97);
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+55-554,350-97+375);
				PauseScroll();
				BlockAllBut( "correct" );
				DrawTutorialWindow("scripts/tutorial/tutorial3.lua");
				Yield();
			end,
	next = "level1chapter2";
}

level1chapter2 = {
	name = "level1chapter2",
	start = function()
				SetAllLocked(true);
				ResetButtonPressed();
				ResetActionParent();
			end,
	condition = function()
					if(GetButtonPressed() == 1) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
				SetArrowVisible(false);
				BlockAllBut( "all" );
				SetArrowClickVisible(false);
				--SetArrowClickPosition(900+55,350-97);
				DrawTutorialWindow("scripts/tutorial/tutorial4.lua");
				Yield();
			end,
	next = "level1chapter3";
}

level1chapter3 = {
	name = "level1chapter3",
	start = function()
				SetUnlockedObjectName("momsleeping");
			end,
	condition = function()
					--if (GetCursor() == 1 and GetLastParentSelected() == "mom") then
					if (GetObjectState("momsleeping") ~= "idle") then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				KillTutorialWindow();
				Yield();				
				SetArrowVisible(true);
				SetArrowPosition(581, 681);
				QueueDisplayDialog({"scripts/tutorial/tutorial5.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetArrowVisible(false);
				QueueDisplayDialog({"scripts/tutorial/tutorial6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial7.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				--SetUseNormalIdles(true);
			end,
	next = "level1chapter4";
}
---END
level1chapter4 = {
	name = "level1chapter4",
	start = function()
				SetAllLocked(false);
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				EndTutorialChapter();
				ResetActionParent();
				Yield();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}









level2chapter1 = {
	name = "level2chapter1",
	start = function()
				SetUseNormalIdles(false);
				SetAllLocked(true);
				StartTutorialChapter();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_pos_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_pos_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				BlockAllBut( "none" );
			end,
	condition = function()
					if (GetIdleType("dad") == 1) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				PauseGameTutorial();
				PauseScroll();
				SetCameraPosition(800+139,800-55);
				QueueDisplayDialog({"scripts/tutorial/tutorial_pos_3.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				PauseGameTutorial();
				SetArrowVisible(true);
				SetArrowPosition(900+55-422,350-97+76);
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+55-554-80,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_pos_4.lua");
				Yield();
			end,
	next = "level2chapter2";
}

level2chapter2 = {
	name = "level2chapter2",
	start = function()
				BlockAllBut( "praise" );
				ResetButtonPressed();
			end,
	condition = function()
					if(GetButtonPressed() == 0) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
				SetArrowVisible(false);
				--SetArrowClickPosition(900+55,350-97);
				SetArrowClickPosition(533+50,76+400);
				DrawTutorialWindow("scripts/tutorial/tutorial_pos_5.lua");
				Yield();
			end,
	next = "level2chapter3";
}

level2chapter3 = {
	name = "level2chapter3",
	start = function()
				ResetLastParentSelected("dad");
				SetAllLocked(false);
			end,
	condition = function()
					--if (GetCursor() == 0 and GetLastParentSelected() == "dad") then
					if(isPraised("dad")) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_pos_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_pos_7.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				--SetUseNormalIdles(true);
			end,
	next = "level2chapter4";
}
---END
level2chapter4 = {
	name = "level2chapter4",
	start = function()
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				BlockAllBut( "all" );
				EndTutorialChapter();
				ResetActionParent();
				Yield();				
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}














level3chapter1 = {
	name = "level3chapter1",
	start = function()
				SetAllLocked(true);
				StartTutorialChapter();
				BlockAllBut( "none" );
				SetUseNormalIdles(false);
				ResetButtonPressed();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_act_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetCameraPosition(800,800);
				PauseScroll();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80,350-97+375);
				QueueDisplayDialog({"scripts/tutorial/tutorial_act_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				DrawTutorialWindow("scripts/tutorial/tutorial_act_3.lua");
				BlockAllBut( "dad" );
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 2) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
			end,
	next = "level3chapter2";
}

level3chapter2 = {
	name = "level3chapter2",
	start = function()
				DrawTutorialWindow("scripts/tutorial/tutorial_act_4.lua");
				Yield();
				SetActionParent("dad");
				SetUnlockedObjectName("camapai");
				SetCameraPosition(800+200,250);
				SetArrowClickPosition(820-100,300+100);
			end,
	condition = function()
					if(GetNumbersTasks("dad") == 1) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowClickVisible(false);	
				KillTutorialWindow();
			end,
	next = "level3chapter3";
}

level3chapter3 = {
	name = "level3chapter3",
	start = function()				
				--ResetNumberObjectsCleaned("dad");				
				ResumeGameTutorial();
			end,
	condition = function()
					--Waiting for dad clean the bed
					--if(GetNumberObjectsCleaned("dad") >= 1) then
					if(GetObjectState("camapai") == "clean") then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				SetAllLocked(false);
				SetArrowVisible(false);
				Yield();
				end,
	next = "level3chapter4";
}

level3chapter4 = {
	name = "level3chapter4",
	start = function()				
				ResetLastParentSelected();
				BlockAllBut( "mom" );
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_act_5.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80+82-20,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_act_5_2.lua");
				Yield();
				SetActionParent("mom");
				ResetButtonPressed();
			end,
	condition = function()
					--Click on mom to select her
					if(GetButtonPressed() == 3) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				ResumeScroll();
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level3chapter5";
}

level3chapter5 = {
	name = "level3chapter5",
	start = function()
				DrawTutorialWindow("scripts/tutorial/tutorial_act_6.lua");
				PauseGameTutorial();
				Yield();
			end,
	condition = function()
					--waiting for order mom to clean 3 objects
					if (GetNumbersTasks("mom") >= 3) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level3chapter6";
}

level3chapter6 = {
	name = "level3chapter6",
	start = function()
				ResumeGameTutorial();
				ResetNumberObjectsCleaned("mom");
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_act_7.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					--waiting for mom clean 3 objects
					if (GetNumberObjectsCleaned("mom") >= 3) then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_act_8.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				ResetActionParent("dad");
			end,
	next = "level3chapter7";
}
---END
level3chapter7 = {
	name = "level3chapter7",
	start = function()
				SetUseNormalIdles(true);
				BlockAllBut( "all" );
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				EndTutorialChapter();
				Yield();
				ResetActionParent();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}









level4chapter1 = {
	name = "level4chapter1",
	start = function()
				LockDisciplineMeter(true);
				StartTutorialChapter();
				BlockAllBut( "none" );
				SetAllLocked(true);
				SetUseNormalIdles(false);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetObjectState("jumpingsquare") == "dirty") then
						PauseGameTutorial();
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetCameraPosition(800+139+95,800-55);
				SetArrowVisible(true);
				SetArrowPosition(900+55-422+306-95+93,350-97+76-10);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				--ResumeGameTutorial();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80+82-20,350-97+375);
				PauseScroll();
				Yield();
			end,
	next = "level4chapter2";
}

level4chapter2 = {
	name = "level4chapter2",
	start = function()				
				ResetLastParentSelected();
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_3.lua");
				Yield();
				BlockAllBut( "mom" );
				SetActionParent("mom");
				ResetButtonPressed();
			end,
	condition = function()
					--SelectMom
					if (GetButtonPressed() == 3) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowVisible(false);
				SetArrowClickPosition(900+55-422+306-95+93+81,350-97+76-10+71);
				KillTutorialWindow();				
			end,
	next = "level4chapter3a";
}

level4chapter3a = {
	name = "level4chapter3a",
	start = function()
				SetUnlockedObjectName("jumpingsquare");
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_4.lua");
				Yield();
			end,
	condition = function()
					--SelectMom
					if (GetNumbersTasks("mom") >= 1) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowClickVisible(false);
				ResumeGameTutorial()				
			end,
	next = "level4chapter3";
}

level4chapter3 = {
	name = "level4chapter3",
	start = function()
			end,
	condition = function()
					--Waiting for mom start bad discipline
					if(GetObjectState("momdiscipline1") == "bad") then
						return true;
					else
						return false;
					end					
				end,
	finish = function()
				SetArrowVisible(true);
				SetArrowPosition(900+55-422+306-95+93-127,350-97+76-10-33);
				PauseGameTutorial();
				KillTutorialWindow();
				Yield();
			end,
	next = "level4chapter4";
}

level4chapter4 = {
	name = "level4chapter4",
	start = function()
				SetUnlockedObjectName("momdiscipline1");
				ResetButtonPressed();
				BlockAllBut( "correct" );
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_5.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+55-554,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_7.lua");
				Yield();
			end,
	condition = function()
					--Click on correct button
					if(GetButtonPressed() == 1) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level4chapter5";
}

level4chapter5 = {
	name = "level4chapter5",
	start = function()
				SetArrowVisible(false);
				SetArrowClickPosition(900+55-554+385,350-97+375-252);
				ResetLastParentSelected();
				ResetActionParent();
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_8.lua");
				Yield();
			end,
	condition = function()
					--waiting for correct mom
					--if (GetCursor() == 1 and GetLastParentSelected() == "mom") then
					if (isCorrected("mom")) then
						return true;
					else
						return false;
					end			
				end,
	finish = function()
				SetArrowClickVisible(false);
				SetDisciplineMeter("mom", 100);
				ResumeGameTutorial();
				KillTutorialWindow();
				Yield();
			end,
	next = "level4chapter6";
}

level4chapter6 = {
	name = "level4chapter6",
	start = function()
				ResetNumberObjectsCleaned();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_9.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					--Waiting for kid start drawing on wall
					if(GetObjectState("drawingsquare1") == "dirty") then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetCameraPosition(800+139+95+300,800-55);
				SetArrowVisible(true);
				SetArrowPosition(900+55-422+306-95+93-127+83,350-97+76-10-33+92);
				SetActionParent("mom");
				PauseGameTutorial();
				BlockAllBut( "mom" );
			end,
	next = "level4chapter7a";
}

level4chapter7a = {
	name = "level4chapter7a",
	start = function()
				SetActionParent("mom");
				SetUnlockedObjectName("drawingsquare1");			
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_10.lua");
				Yield();
			end,
	condition = function()
					--SelectMom
					if (GetNumbersTasks("mom") >= 1) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowVisible(false);
				ResetActionParent();
				KillTutorialWindow();
				ResumeGameTutorial();		
			end,
	next = "level4chapter7";
}

level4chapter7 = {
	name = "level4chapter7",
	start = function()
			end,
	condition = function()
					--Waiting for mom start good discipline
					if(GetObjectState("momdiscipline2") == "good") then
						return true;
					else
						return false;
					end			
				end,
	finish = function()
				SetArrowVisible(true);
				BlockAllBut( "praise" );
				SetArrowPosition(900+55-554-80+495-66,350-97+375-193-79);
				PauseGameTutorial();
				Yield();
			end,
	next = "level4chapter8";
}

level4chapter8 = {
	name = "level4chapter8",
	start = function()
				ResetButtonPressed();
				SetUnlockedObjectName("momdiscipline2");
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_11.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+55-554-80,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_12.lua");
				Yield();
			end,
	condition = function()
					--Click on praise button
					if(GetButtonPressed() == 0) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level4chapter9";
}

level4chapter9 = {
	name = "level4chapter9",
	start = function()
				SetArrowClickPosition(900+55-554-80+495,350-97+375-193);
				ResetLastParentSelected();
				DrawTutorialWindow("scripts/tutorial/tutorial_discipline_13.lua");
				Yield();
			end,
	condition = function()
					--waiting for correct mom
					--if (GetCursor() == 0 and GetLastParentSelected() == "mom") then
					if (isPraised("mom")) then
						return true;
					else
						return false;
					end			
				end,
	finish = function()
				SetArrowClickVisible(false);
				--ResumeGameTutorial();
				KillTutorialWindow();
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_discipline_14.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				--ResumeGameTutorial();
			end,
	next = "level4chapter10";
}
---END
level4chapter10 = {
	name = "level4chapter10",
	start = function()
				LockDisciplineMeter(false);
				ResetDisciplineMeter();
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				SetAllLocked(false);
				ResetActionParent("mom");
				BlockAllBut( "all" );
				EndTutorialChapter();
				Yield();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}








level5chapter1 = {
	name = "level5chapter1",
	start = function()
				PauseScroll();
				SetAllLocked(true);
				BlockAllBut( "none" );
				StartTutorialChapter();
				SetUseNormalIdles(false);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_changediaper_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();				
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetObjectState("fallonfloor1") == "dirty") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetCameraPosition(597,774);
				SetArrowVisible(true);
				SetArrowPosition(900+55-422+306-95+93+68,350-97+76-10+11);
			end,
	next = "level5chapter2";
}

level5chapter2 = {
	name = "level5chapter2",
	start = function()
				ResetButtonPressed();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_changediaper_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80+82-20,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_changediaper_3.lua");
				BlockAllBut( "mom" );
				SetActionParent("mom");
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 3) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level5chapter3";
}

level5chapter3 = {
	name = "level5chapter3",
	start = function()
				SetArrowVisible(false);
				SetArrowClickPosition(900+100-80+82-20-21,350-97+375-188);
				SetUnlockedObjectName("fallonfloor1");
				DrawTutorialWindow("scripts/tutorial/tutorial_changediaper_4.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("fallonfloor1") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level5chapter5";
}

level5chapter5 = {
	name = "level5chapter5",
	start = function()
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_changediaper_5.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetObjectState("diapersquare3") == "dirty") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()				
				SetCameraPosition(597,874);
				SetArrowVisible(true);
				SetArrowPosition(801,294);
				KillTutorialWindow();
				Yield();
			end,
	next = "level5chapter6";
}

level5chapter6 = {
	name = "level5chapter6",
	start = function()
				SetUnlockedObjectName("diapersquare3");
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_changediaper_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_changediaper_7.lua");
				BlockAllBut( "dad" );
				SetActionParent("dad");
				Yield();
			end,
	condition = function()
					if(GetObjectState("diapersquare3") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowVisible(false);
				SetCameraPosition(897,874);
				KillTutorialWindow();
				Yield();
			end,
	next = "level5chapter7";
}

level5chapter7 = {
	name = "level5chapter7",
	start = function()
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80+82-20-21-89,350-97+375-188-94);
				SetUnlockedObjectName("trocador");
				DrawTutorialWindow("scripts/tutorial/tutorial_changediaper_8.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("trocador") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				--SetCameraPosition(797,874);
				SetArrowClickPosition(900+100-80+82-20-21-431,350-97+375-188-291);
				KillTutorialWindow();
				Yield();
			end,
	next = "level5chapter8";
}

level5chapter8 = {
	name = "level5chapter8",
	start = function()
				SetUnlockedObjectName("lixeira");
				DrawTutorialWindow("scripts/tutorial/tutorial_changediaper_9.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("lixeira") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_changediaper_10.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	next = "level5chapter9";
}
---END
level5chapter9 = {
	name = "level5chapter9",
	start = function()
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				SetAllLocked(false);
				EndTutorialChapter();
				BlockAllBut( "all" );
				ResetActionParent();
				Yield();
				ResetActionParent();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}











level7chapter1 = {
	name = "level7chapter1",
	start = function()
				PauseScroll();
				SetAllLocked(true);
				StartTutorialChapter();
				SetUseNormalIdles(false);
				ResetLastParentSelected();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_toys_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_toys_2.lua");
				Yield();
				ResetButtonPressed();
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80,350-97+375);
				BlockAllBut( "dad" );
			end,
	condition = function()
					if(GetButtonPressed() == 2) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowClickVisible(false);
				BlockAllBut( "none" );
				KillTutorialWindow();
				Yield();
			end,
	next = "level7chapter2";
}

level7chapter2 = {
	name = "level7chapter2",
	start = function()
				SetActionParent("dad");
				SetUnlockedObjectName("toy1");
				PauseGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_toys_3.lua");
				Yield();
				SetArrowVisible(true);
				SetArrowPosition(436,469);
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetNumberOfHoldingItems("dad") > 0) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level7chapter3";
}

level7chapter3 = {
	name = "level7chapter3",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("brinquedos1");
				SetUnlockedObjectName("brinquedos2");
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_toys_4.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetArrowVisible(true);
				SetArrowPosition(448+477,506-183);
				DrawTutorialWindow("scripts/tutorial/tutorial_toys_5.lua");
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetNumberOfHoldingItems("dad") == 0) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level7chapter4";
}


level7chapter4 = {
	name = "level7chapter4",
	start = function()
				BlockAllBut( "mom" );
				SetAllLocked(true);
				SetActionParent("mom");
				SetUnlockedObjectName("toy3");
				SetUnlockedObjectName("toy4");
				SetUnlockedObjectName("toy5");
				SetUnlockedObjectName("toy6");
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_toys_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetCameraPosition(600, 980);
				DrawTutorialWindow("scripts/tutorial/tutorial_toys_7.lua");
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetNumberOfHoldingItems("mom") == 4) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level7chapter5";
}

---END
level7chapter5 = {
	name = "level7chapter5",
	start = function()
				SetAllLocked(true);
				SetActionParent("mom");
				SetUnlockedObjectName("brinquedos1");
				SetUnlockedObjectName("brinquedos2");
				PauseGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_toys_8.lua");
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetNumberOfHoldingItems("mom") <= 0) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				ResumeScroll();
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_toys_9.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_toys_10.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				ResetActionParent();
				SetAllLocked(false);
				SetUseNormalIdles(true);
				EndTutorialChapter();
				BlockAllBut( "all" );
			end,
	next = false;
}










level1family2chapter1 = {
	name = "level1family2chapter1",
	start = function()
		DebugOut("Chapter1 SAGETS!!!!");	
				SetAllLocked(true);
				StartTutorialChapter();
				PauseGameTutorial();
				SetUseNormalIdles(false);
				ResetButtonPressed();
				QueueDisplayDialog({"scripts/tutorial/tutorial_nap_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_nap_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetUnlockedObjectName("asksleep2");
				SetActionParent("dad");
				BlockAllBut( "dad" );
				ResumeGameTutorial();
			end,
	condition = function()
					if(GetObjectState("asksleep2") == "dirty") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				PauseScroll();
				SetArrowVisible(true);
				SetArrowPosition(740,304);
				KillTutorialWindow();
				Yield();
			end,
	next = "level1family2chapter2";
}


level1family2chapter2 = {
	name = "level1family2chapter2",
	start = function()
				SetCameraPosition(200,800);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_nap_3.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_nap_4.lua");
				Yield();
				SetUnlockedObjectName("asksleep2");
			end,
	condition = function()
					if(GetObjectState("asksleep2") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowVisible(false);
				SetArrowClickVisible(true);
				SetArrowClickPosition(700,380);
				KillTutorialWindow();
				Yield();
			end,
	next = "level1family2chapter3";
}

---END			
level1family2chapter3 = {
	name = "level1family2chapter3",
	start = function()
				SetUnlockedObjectName("berco2");
				SetCameraPosition(200,1300);
				DrawTutorialWindow("scripts/tutorial/tutorial_nap_5.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("berco2") == "cleaning") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				SetArrowClickVisible(false);
				ResumeScroll();
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_nap_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				SetAllLocked(false);
				SetUseNormalIdles(true);
				ResetActionParent();
				EndTutorialChapter();
				BlockAllBut( "all" );
			end,
	next = false;
}









--[[
1--Janela de OK
Eating dinner together is a good habit for families to have. Let’s learn how to instruct the parents to complete a
successful dinner time. 

##############MEAL TIME COMEÇA
--]]
level6chapter1 = {
	name = "level6chapter1",
	start = function()
				SetAllLocked(true);
				StartTutorialChapter();
				BlockAllBut( "none" );
				SetUseNormalIdles(false);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_dinnertime_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	condition = function()
					if(BreakSignEventOccured("meal")) then
						return true;
					else
						return false;
					end	
				end,
	finish = function()				
			end,
	next = "level6chapter2";
}

--[[
2--Janela de next
When the dinner time icon appears, it means its time to get dinner ready. First you need to set the table. 

3--Janela esperando mãe pegar pratos
Use a white cursor to select Mom and then click on the kitchen cabinets so she can collect the dishes. 

#############Mãe pega os pratos
--]]

level6chapter2 = {
	name = "level6chapter2",
	start = function()
				SetAllLocked(true);
				SetActionParent("mom");
				SetUnlockedObjectName("dispensa");
				SetCameraPosition(0,700);
				PauseScroll();
				BlockAllBut( "mom" );
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_dinnertime_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				SetArrowVisible(true);
				SetArrowClickVisible(true);
				SetArrowPosition(320,350);
				SetArrowClickPosition(900+100-80+82-20,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_3.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("dispensa") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				SetArrowClickVisible(false);
				Yield();
			end,
	next = "level6chapter3";
}

--[[
4--Janela esperando mãe colocar a mesa
Now she has the dishes in her hands. Click on the table to set it for dinner. 

##############Mãe põe a mesa
--]]

level6chapter3 = {
	name = "level6chapter3",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("mesajantar1");
				SetArrowPosition(480,450);
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_4.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesajantar1") == "with_plates") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter4";
}

--[[
5--Janela esperando pegar a comida
Great! The next step is to actually cook dinner. Click on the refrigerator to get the food out.

#############MÃE PEGA COMIDA NA GELADEIRA
--]]
level6chapter4 = {
	name = "level6chapter4",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("geladeira");
				SetCameraPosition(0,650);
				SetArrowPosition(414,334);
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_5.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("geladeira") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()		
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter5";
}

--[[
6--Janela esperando cozinhar
Now click on the stove to cook dinner. You have to wait a few seconds for it to be ready, so be patient! 

#############FOGÃO TERMINA DE COZINHAR
--]]

level6chapter5 = {
	name = "level6chapter5",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("fogao1");
				SetCameraPosition(600,750);
				SetArrowPosition(654,334);
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_6.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("fogao1") == "dirty") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
			end,
	next = "level6chapter6";
}

level6chapter6 = {
	name = "level6chapter6",
	start = function()
			end,
	condition = function()
					if(GetObjectState("fogao1") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				SetArrowPosition(469,404);
				Yield();
			end,
	next = "level6chapter8";
}


--[[
7--Janela esperando pegar a comida do fogão
Now that dinner is ready, click on the food to pick it up. 

#############UM DOS PAIS PEGA A COMIDA DO FOGÃO
--]]

level6chapter7 = {
	name = "level6chapter7",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("fogao2");
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_7.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("fogao1") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				SetArrowPosition(469,404);
				Yield();
			end,
	next = "level6chapter8";
}


--[[
8--Janela esperando mãe colocar a comida na mesa e sentar
Now deliver it to the table by clicking on it. 

###########MÃE COLOCA A COMIDA NA MESA E SENTA
--]]
level6chapter8 = {
	name = "level6chapter8",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("mesajantar2");
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_8.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesajantar2") == "with_dirty_plates") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter9";
}

--[[
9--Janela de next
Dinner is ready and everyone is hungry, but where is Dad? 

10--Janela esperando pai sentar na mesa também
Use a white cursor to select Dad and tell him to go sit down at the dinner table. 

###########PAI SENTA NA MESA
--]]
level6chapter9 = {
	name = "level6chapter9",
	start = function()
				SetAllLocked(true);
				SetActionParent("dad");
				SetUnlockedObjectName("mesajantar3");
				SetArrowVisible(false);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_dinnertime_9.lua", nanny = ""..GetCurrentNanny()});			
				Yield();
				ResumeGameTutorial();
				SetArrowVisible(true);
				SetArrowPosition(469,404);
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80,350-97+375);
				BlockAllBut( "dad" );
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_10.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesajantar3") == "cleaning") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter10";
}

--[[
11--Janela esperando dinner time acabar
Dig in everyone! It’s family dinner time. 

############DINNER TIME TERMINA
--]]
level6chapter10 = {
	name = "level6chapter10",
	start = function()
				SetArrowClickVisible(false);
				SetArrowVisible(false);
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_11.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesajantar3") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter11";
}

--[[
12--Janela de next
Now that dinner is over, someone needs to wash those dishes. Since Mom cooked the meal, it’s only fair that Dad cleans up, right? 

13--Janela esperando pai pegar os pratos sujos
Use a white cursor to select Dad and then click on the table to collect the dishes. 

###########PAI PEGA PRATOS SUJOS DA MESA
--]]
level6chapter11 = {
	name = "level6chapter11",
	start = function()
				SetAllLocked(true);
				SetUnlockedObjectName("mesajantar4");
				SetArrowClickVisible(true);
				SetArrowClickPosition(900+100-80,350-97+375);
				SetArrowVisible(true);
				SetArrowPosition(469,404);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_dinnertime_12.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_13.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesajantar4") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level6chapter12";
}

--[[
14--Janela esperando pai lavar a louça
Now click on the sink to have Dad wash them. 

################PAI TERMINA DE LAVARA LOUÇA

15--Janela de OK
Excellent! Now that you know how to make dinner, it will be part of your goals for the day. Pay attention to your goals
every day to know what to do next! 
--]]

level6chapter12 = {
	name = "level6chapter12",
	start = function()
				SetCameraPosition(0,700);
				SetArrowVisible(true);
				SetArrowPosition(602,355);
				SetAllLocked(true);
				SetUnlockedObjectName("pia");
				DrawTutorialWindow("scripts/tutorial/tutorial_dinnertime_14.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("pia") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_dinnertime_15.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	next = "level6chapter13";
}
---END
level6chapter13 = {
	name = "level6chapter13",
	start = function()
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				SetAllLocked(false);
				BlockAllBut( "all" );
				SetArrowVisible(false);
				SetArrowClickVisible(false);
				EndTutorialChapter();
				ResetActionParent();
				Yield();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}



--[[
1--Janela de next
Buck, just like all school-aged children, needs to set aside time to study. 

2--Janela esperando o start do study time
Study time will be indicated by a clock like the one you see for dinner time. 

################SCHOOL AGED SENTA NO SOFA  PEDINDO PARA ESTUDAR
--]]
level2family2chapter1 = {
	name = "level2family2chapter1",
	start = function()
				BlockAllBut( "none" );
				PauseScroll();
				SetCameraPosition(0,0);
				SetAllLocked(true);
				StartTutorialChapter();
				SetUseNormalIdles(false);
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_studytime_1.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_studytime_2.lua");
				Yield();
			end,
	condition = function()
					if(BreakSignEventOccured("study")) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				BlockAllBut( "dad" );
				SetActionParent("dad");
				SetArrowVisible(true);
				SetArrowPosition(550,400);
				KillTutorialWindow();
				Yield();
			end,
	next = "level2family2chapter2";
}
--[[
3--Janela de next
When the clock goes off, your school-aged child will sit on the couch and wait for Mom or Dad to come get him.

4--Janela esperando schoolaged sentar na escrivaninha
Click on Dad with a white cursor and then click on Buck to send him to his study time. 

##############SCHOOL AGED SENTA NA ESCRIVANINHA
--]]
level2family2chapter2 = {
	name = "level2family2chapter2",
	start = function()
				SetUnlockedObjectName("schoolagedsit");
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_studytime_3.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
				DrawTutorialWindow("scripts/tutorial/tutorial_studytime_4.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("estante1") == "dirty") then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetCameraPosition(0,900);
				SetArrowVisible(false);
				SetArrowClickVisible(true);
				SetArrowClickPosition(341,436);
				KillTutorialWindow();
				Yield();
			end,
	next = "level2family2chapter3";
}

--[[
5--Janela esperando pai pegar os livros
Your children can’t study without their books, so click on the bookshelf to pick them up. 

############PAI PEGA OS LIVROS
--]]

level2family2chapter3 = {
	name = "level2family2chapter3",
	start = function()
				SetUnlockedObjectName("estante1");
				DrawTutorialWindow("scripts/tutorial/tutorial_studytime_5.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("estante1") == "without_books") then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowClickPosition(403,531);
				KillTutorialWindow();
				Yield();
			end,
	next = "level2family2chapter4";
}

--[[
6--Janela esperando pai colocar os livros na escrivaninha
Good! Now click on the desk to give Buck his books so he can study. 

############PAI COLOCA LIVROS NA MESA

7--Janela de OK
Once the child is done studying, the books need to be put away. Click on the books to have Dad pick them up and then on the bookshelf to put them away. 
--]]

level2family2chapter4 = {
	name = "level2family2chapter4",
	start = function()
				SetUnlockedObjectName("escrivaninha");
				DrawTutorialWindow("scripts/tutorial/tutorial_studytime_6.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("escrivaninha") == "cleaning") then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_studytime_7.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	next = "level2family2chapter5";
}
---END
level2family2chapter5 = {
	name = "level2family2chapter5",
	start = function()
				BlockAllBut( "all" );
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				SetAllLocked(false);
				EndTutorialChapter();
				Yield();
				ResetActionParent();
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}














level2family3chapter1 = {
	name = "level2family3chapter1",
	start = function()
				BlockAllBut( "none" );
				SetUseNormalIdles(false);
				StartTutorialChapter();
				SetAllLocked(true);
				SetCameraPosition(0,600);
				PauseScroll();
				DrawTutorialWindow("scripts/tutorial/tutorial_familytime_1.lua");
				Yield();
			end,
	condition = function()
					if(BreakSignEventOccured("family")) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_familytime_2.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				QueueDisplayDialog({"scripts/tutorial/tutorial_familytime_3.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	next = "level2family3chapter2a";
}


level2family3chapter2a = {
	name = "level2family3chapter2a",
	start = function()
				BlockAllBut( "mom" );
				SetArrowClickVisible(true);
				SetArrowClickPosition(977, 626);
				DrawTutorialWindow("scripts/tutorial/tutorial_familytime_4.lua");
				ResetButtonPressed();
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 3) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				BlockAllBut( "none" );
			end,
	next = "level2family3chapter2b";
}

level2family3chapter2b = {
	name = "level2family3chapter2b",
	start = function()
				SetActionParent("mom");
				SetUnlockedObjectName("familytime");
				SetArrowClickPosition(598, 444);
				Yield();
			end,
	condition = function()
					if(GetNumbersTasks("mom") >= 1) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				--SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
			end,
	next = "level2family3chapter3a";
}



level2family3chapter3a = {
	name = "level2family3chapter3a",
	start = function()
				BlockAllBut( "dad" );
				ResetButtonPressed();
				SetArrowClickPosition(900+100-80,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_familytime_5.lua");
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 2) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				BlockAllBut( "none" );
				Yield();
			end,
	next = "level2family3chapter3b";
}
---END
level2family3chapter3b = {
	name = "level2family3chapter3b",
	start = function()
				SetActionParent("dad");
				SetArrowClickPosition(598, 444);
				Yield();
			end,
	condition = function()
					if(GetNumbersTasks("dad") >= 1) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_familytime_6.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				SetUseNormalIdles(true);
				EndTutorialChapter();
				SetAllLocked(false);
				ResumeGameTutorial();
				ResumeScroll();
				BlockAllBut( "all" );
				ResetActionParent();
				EndTutorialChapter();
			end,
	next = false;
}










--[[
1--Janela esperando barbecue time aparecer
Not every meal needs to be at the dinner table. Sometimes it’s fun to have a picnic and eat outside. 

#############BARBECUE TIME COMEÇA
--]]
level1family3chapter1 = {
	name = "level1family3chapter1",
	start = function()
				BlockAllBut( "none" );
				SetAllLocked(true);
				StartTutorialChapter();
				SetUseNormalIdles(false);				
				SetCameraPosition(0, 750);
				SetArrowVisible(true);
				SetArrowPosition(291,338);
								PauseScroll();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_barbecuetime_1.lua", nanny = ""..GetCurrentNanny()});									
				Yield();
				ResumeGameTutorial();				
			end,
	condition = function()
					if(BreakSignEventOccured("barbecue")) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				SetArrowVisible(false);
				KillTutorialWindow();
				Yield();
				SetCameraPosition(870, 600);
			end,
	next = "level1family3chapter2a";
}


--[[
2--Janela esperando mãe colocara a mesa de fora
Just like dinner time, someone needs to set the table. Click on Mom with a white cursor and then click on the kitchen cabinets
to set the table. 

###############MESA DE FORA POSTA
--]]
level1family3chapter2a = {
	name = "level1family3chapter2a",
	start = function()
				BlockAllBut( "mom" );
				SetArrowClickVisible(true);
				SetArrowClickPosition(977, 626);
				DrawTutorialWindow("scripts/tutorial/tutorial_barbecuetime_2.lua");
				ResetButtonPressed();
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 3) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				BlockAllBut( "none" );
			end,
	next = "level1family3chapter2b";
}

level1family3chapter2b = {
	name = "level1family3chapter2b",
	start = function()
				SetArrowClickPosition(907, 351);
				SetActionParent("mom");
				SetUnlockedObjectName("dispensa");
				Yield();
			end,
	condition = function()
					if(GetObjectState("dispensa") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				Yield();
			end,
	next = "level1family3chapter2c";
}

level1family3chapter2c = {
	name = "level1family3chapter2c",
	start = function()
				SetCameraPosition(0, 750);
				SetArrowClickPosition(329, 463);
				SetActionParent("mom");
				SetUnlockedObjectName("mesafora1");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesafora1") == "with_plates") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
			end,
	next = "level1family3chapter3a";
}

--[[
3--Janela esperando pai pegar a comida na geladeira
Good! Now click on Dad with a white cursor and then click on the refrigerator to get some food. 

##############PAI PEGA A COMIDA NA GELADEIRA
--]]
level1family3chapter3a = {
	name = "level1family3chapter3a",
	start = function()
				SetCameraPosition(1050, 600);
				BlockAllBut( "dad" );
				ResetButtonPressed();
				SetArrowClickPosition(900+100-80,350-97+375);
				DrawTutorialWindow("scripts/tutorial/tutorial_barbecuetime_3.lua");
				Yield();
			end,
	condition = function()
					if(GetButtonPressed() == 2) then
						return true;
					else
						return false;
					end
				end,
	finish = function()
				BlockAllBut( "none" );
				Yield();
			end,
	next = "level1family3chapter3b";
}

level1family3chapter3b = {
	name = "level1family3chapter3b",
	start = function()				
				SetAllLocked(true);
				SetActionParent("dad");
				SetUnlockedObjectName("geladeira");		
				SetArrowClickPosition(873,424);				
			end,
	condition = function()
					if(GetObjectState("geladeira") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()		
				KillTutorialWindow();
				Yield();
			end,
	next = "level1family3chapter4";
}

--[[
4--Janela esperando a comida ficar pronta
Now that Dad has the food, click on the grill to cook the food over an open flame!

##############COMIDA FICA PRONTA
--]]

level1family3chapter4 = {
	name = "level1family3chapter4",
	start = function()
				SetCameraPosition(0, 750);
				SetArrowClickPosition(250,389);
				SetUnlockedObjectName("churrasqueira1");
				DrawTutorialWindow("scripts/tutorial/tutorial_barbecuetime_4.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("churrasqueira1") == "dirty") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				
			end,
	next = "level1family3chapter5";
}

level1family3chapter5 = {
	name = "level1family3chapter5",
	start = function()
			end,
	condition = function()
					if(GetObjectState("churrasqueira1") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()	
				SetArrowClickVisible(false);
				KillTutorialWindow();
				Yield();
				SetUnlockedObjectName("churrasqueira2");
			end,
	next = "level1family3chapter6";
}

--[[
5--Janela esperando pai sentar a mesa
The food is ready. Now click on the grill to collect it and then click on the table to feed everyone. 

############PAI SENTA NA MESA
--]]
level1family3chapter6 = {
	name = "level1family3chapter6",
	start = function()
				SetUnlockedObjectName("mesafora2");
				DrawTutorialWindow("scripts/tutorial/tutorial_barbecuetime_5.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesafora2") == "with_dirty_plates") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				SetActionParent("mom");
				BlockAllBut( "mom" );
				Yield();
			end,
	next = "level1family3chapter7";
}

--[[
6--Janela esperando mãe sentar
Whoops! Don’t forget to tell Mom to join the family for the meal! 

##############BARBECUE TIME TERMINA

7--Janela de ok
Great! It’s so nice outside today, you can expect the family to want to eat outside, so check your goals when the level starts! 
--]]

level1family3chapter7 = {
	name = "level1family3chapter7",
	start = function()
				SetUnlockedObjectName("mesafora3");
				DrawTutorialWindow("scripts/tutorial/tutorial_barbecuetime_6.lua");
				Yield();
			end,
	condition = function()
					if(GetObjectState("mesafora3") == "clean") then
						return true;
					else
						return false;
					end	
				end,
	finish = function()
				KillTutorialWindow();
				Yield();
				PauseGameTutorial();
				QueueDisplayDialog({"scripts/tutorial/tutorial_barbecuetime_7.lua", nanny = ""..GetCurrentNanny()});
				Yield();
				ResumeGameTutorial();
			end,
	next = "level1family3chapter8";
}
---END
level1family3chapter8 = {
	name = "level1family3chapter8",
	start = function()
				SetUseNormalIdles(true);
				ResumeGameTutorial();
				ResumeScroll();
				KillTutorialWindow();
				SetAllLocked(false);
				BlockAllBut( "all" );
				EndTutorialChapter();
				ResetActionParent();
				Yield();
				
			end,
	condition = function()			
				end,
	finish = function()
			end,
	next = false;
}








finalchapter = {
	name = "finalchapter",
	start = function()
			end,
	condition = function()
				end,
	finish = function()				
			end,
	next = false;
}

function TaskScript()
	local finishDayTutorial;
	local currentDay = GetDay();
	local currentTask;
	while(true) do
		if(LoadTutorialChapter() ~= "finalchapter") then
			PauseGameTutorial();
			QueueDisplayDialog({"scripts/tutorialconfirm.lua", nanny = ""..GetCurrentNanny()});
			Yield();
			ResumeGameTutorial();
			if(GetTutorialState() == 1) then
				currentTask = _G[LoadTutorialChapter()];
				finishDayTutorial = false;
				while(finishDayTutorial == false) do
					currentTask.start();
					while(currentTask.condition() == false) do
						Yield();
					end
					currentTask.finish();
					if(currentTask.next == false) then
						finishDayTutorial = true;
					else
						currentTask = _G[currentTask.next];
					end
				end
			end
			while(currentDay == GetDay()) do
				Yield();
			end
			currentDay = GetDay();
		else
			SetTutorial(0);
		end
		Yield();
	end
end

return TaskScript;
