--- Imports diary from an external file. There are different types that must be defined. (diary, background, controls, pageNumbers, notification, image, text, narration). Each of the section's arguements are the same as the functions described in this documentation.
-- Refer to DiarySetup.lua file for a sample script.
-- @tparam string fileName Name of file in the script folder without extension to import the diary from.
functionCustomDiary.ImportDiary(fileName)
ifnotType.IsString(fileName)then
TEN.Util.PrintLog("'fileName' is in an incorrect format. Expected a string type in function 'CustomDiary.ImportDiary' for the diary system.",Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid object slot. Please use a pickup object slot in the range PICKUP_ITEM1 (596) to PICKUP_ITEM 16 (611) or DIARY_ITEM (986). Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectIdBg slot. Please use a sprite slot. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.spriteIdBg)then
TEN.Util.PrintLog("'spriteIdBg' is not a number. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.colorBg)then
TEN.Util.PrintLog("'colorBg' is not in a Color format. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.pos)then
TEN.Util.PrintLog("'pos' is not a Vec2. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.rot)then
TEN.Util.PrintLog("'rot' is not a number. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.scale)then
TEN.Util.PrintLog("'scale' is not a Vec2. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alpha' is not a number or not within range (0-255). Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageSound' is not a valid number. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'exitSound' is not a valid number. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pagesToUnlock' is not a valid page number. Error in template data for diary entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectIdBg slot. Please use a sprite slot. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.spriteIdBg)then
TEN.Util.PrintLog("'spriteIdBg' is not a number. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.colorBg)then
TEN.Util.PrintLog("'colorBg' is not in a Color format. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.pos)then
TEN.Util.PrintLog("'pos' is not a Vec2. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.rot)then
TEN.Util.PrintLog("'rot' is not a number. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.scale)then
TEN.Util.PrintLog("'scale' is not a Vec2. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type. Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alpha' is not a number or not within range (0-255). Error in template data for background entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageNoType' is not a a valid option (1 or 2). Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.prefix)then
TEN.Util.PrintLog("'prefix' is not a a string. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.separator)then
TEN.Util.PrintLog("'separator' is not a a string. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.textPos)then
TEN.Util.PrintLog("'textPos' is not a a Vec2. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsTable(entry.textOptions)then
TEN.Util.PrintLog("'textOptions' is not a table. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
else
for_,datainpairs(entry.textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
end
end
ifnotType.IsNumber(entry.textScale)then
TEN.Util.PrintLog("'textScale' is not a number. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.textColor)then
TEN.Util.PrintLog("'textColor' is not in a Color format. Error in template data for page numbers entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
importDiary:CustomizePageNumbers(
entry.pageNoType,
entry.prefix,
entry.separator,
entry.textPos,
entry.textOptions,
entry.textScale,
entry.textColor
)
elseifentry.type=="controls"then
ifnotType.IsString(entry.string1)then
TEN.Util.PrintLog("'string1' is not a string. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.string2)then
TEN.Util.PrintLog("'string2' is not a string. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.string3)then
TEN.Util.PrintLog("'string3' is not a string. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.string4)then
TEN.Util.PrintLog("'string4' is not a string. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.separator)then
TEN.Util.PrintLog("'separator' is not a string. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.textPos)then
TEN.Util.PrintLog("'textPos' is not a Vec2. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsTable(entry.textOptions)then
TEN.Util.PrintLog("'textOptions' is not a table. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
else
for_,datainpairs(entry.textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
end
end
ifnotType.IsNumber(entry.textScale)then
TEN.Util.PrintLog("'textScale' is not a number. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.textColor)then
TEN.Util.PrintLog("'textColor' is not in a Color format. Error in template data for controls entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'notificationTime' is not a valid number. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectId slot. Please use a sprite slot. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.spriteId)then
TEN.Util.PrintLog("'spriteId' is not a number. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.color)then
TEN.Util.PrintLog("'color' is not in a Color format. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.pos)then
TEN.Util.PrintLog("'pos' is not a Vec2. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.rot)then
TEN.Util.PrintLog("'rot' is not a number. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.scale)then
TEN.Util.PrintLog("'scale' is not a Vec2. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'notificationSound' is not a valid number. Error in template data for notification entry. Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageIndex' is not a valid page number. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectId slot. Please use a sprite slot. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.spriteId)then
TEN.Util.PrintLog("'spriteId' is not a number. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.color)then
TEN.Util.PrintLog("'color' is not in a Color format. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.pos)then
TEN.Util.PrintLog("'pos' is not a Vec2. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsNumber(entry.rot)then
TEN.Util.PrintLog("'rot' is not a number. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.scale)then
TEN.Util.PrintLog("'scale' is not a Vec2. Error in template data for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type for image entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageIndex' is not a valid page number. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.text)then
TEN.Util.PrintLog("'text' is not a string. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsVec2(entry.textPos)then
TEN.Util.PrintLog("'textPos' is not a a Vec2. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsTable(entry.textOptions)then
TEN.Util.PrintLog("'textOptions' is not a table. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
else
for_,datainpairs(entry.textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
end
end
ifnotType.IsNumber(entry.textScale)then
TEN.Util.PrintLog("'textScale' is not a number. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsColor(entry.textColor)then
TEN.Util.PrintLog("'textColor' is not in a Color format. Error in template data for text entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageIndex' is not a valid page number. Error in template data for narration entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
ifnotType.IsString(entry.trackName)then
TEN.Util.PrintLog("'trackName' is not a string. Error in template data for narration entry for page: "..tostring(entry.pageIndex)..". Import Stopped for file: "..tostring(fileName),Util.LogLevel.WARNING)
return
end
importDiary:AddNarration(
entry.pageIndex,
entry.trackName
)
elseifentry.type=="diary"then
-- Skip this entry as diary is already imported. This comment is needed to avouid the error of Unknown type for diary.
else
TEN.Util.PrintLog("Unknown entry type: "..tostring(entry.type).." in file: "..tostring(fileName),Util.LogLevel.WARNING)
end
end
--Unlock the pages as per the template
importDiary:UnlockPages(unlockCount,false)
print("External diary from file: "..tostring(fileName).." imported")
end
--- Creates a diary with extensive configuration options.
-- Parameters:
-- @tparam Objects.ObjID object The pickup object that will be used to create the diary. The diary can be created using PICKUP_ITEMX (596-611) or DIARY_ITEM (986). Access the diary by selecting the item in the inventory.
-- @tparam Objects.ObjID objectIdBg Object ID for the diary's sprite.
-- @tparam int spriteIdBg SpriteID from the specified object for the diary's sprite.
TEN.Util.PrintLog("Error: Invalid object slot for diary creation. Please use a pickup object slot PICKUP_ITEM1 (596) to PICKUP_ITEM 16 (611) or DIARY_ITEM (986).",Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectIdBg slot. Please use a sprite slot. Expected a sprite slot in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
TEN.Util.PrintLog("'spriteIdBg' is in an incorrect format. Expected a number type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
TEN.Util.PrintLog("'colorBg' is in an incorrect format. Expected a Color type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
return
end
GameVars.Engine.Diaries[dataName].ColorBg=colorBg
ifnotType.IsVec2(pos)then
TEN.Util.PrintLog("'posBg' is in an incorrect format. Expected a Vec2 type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
return
end
GameVars.Engine.Diaries[dataName].Pos=pos
ifnotType.IsNumber(rot)then
TEN.Util.PrintLog("'rot' is in an incorrect format. Expected a number type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
return
end
GameVars.Engine.Diaries[dataName].Rot=rot
ifnotType.IsVec2(scale)then
TEN.Util.PrintLog("'scale' is in an incorrect format. Expected a Vec2 type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alpha is in an incorrect format. Expected a number (0-255) type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
return
end
GameVars.Engine.Diaries[dataName].Alpha=alpha
ifnotType.IsNumber(pageSound)orpageSound<=0then
TEN.Util.PrintLog("'pageSound' is in an incorrect format. Expected a number type in function 'CustomDiary.Create' for the diary system.",Util.LogLevel.WARNING)
TEN.Util.PrintLog("'exitSound' is in an incorrect format. Expected a number type in function 'CustomDiary.Create' for the diary system:.",Util.LogLevel.WARNING)
print("CustomDiary Constructed for CustomDiary: "..dataName)
returnsetmetatable(self,CustomDiary)
end
--- The function retrieves a diary by its unique object. This function is useful when you need to access or manipulate a diary that has already been created .
-- @tparam Objects.ObjID object The pickup object that was used to create the diary (596-611,986).
-- @treturn CustomDiary The diary created using the object.
CustomDiary.Get=function(object)
localdataName=object.."_diarydata"
ifGameVars.Engine.Diaries[dataName]then
localself={Name=dataName}
returnsetmetatable(self,CustomDiary)
else
TEN.Util.PrintLog("Diary does not exist for object: "..tostring(object),Util.LogLevel.WARNING)
end
end
--- The function removes a custom diary and its associated data from the system. It ensures that the diary is no longer tracked or accessible in the LevelVars.Engine.Diaries.
-- Please call this once a diary has served its purpose. It helps reduce the savegame size.
-- @tparam Objects.ObjID object The pickup object that was used to create the diary (596-611,986).
CustomDiary.Delete=function(object)
localdataName=object.."_diarydata"
ifGameVars.Engine.Diaries[dataName]then
GameVars.Engine.Diaries[dataName]=nil
end
end
--- The function adds the callback to enable diaries in levels. This needs to be added to every level preferably in the LevelFuncs.OnStart.
-- @bool value True enables the diaries to be activated. False would disable the diaries.
TEN.Util.PrintLog("Diary system stopped.",Util.LogLevel.INFO)
end
end
else
TEN.Util.PrintLog("'value' is in an incorrect format. Expected a bool type in function 'CustomDiary.Status' for the diary system",Util.LogLevel.WARNING)
end
end
--- The function checks whether the specified diary is currently visible.
-- @treturn bool true if the diary is visible and false if it is not.
functionCustomDiary:IsVisible()
ifGameVars.Engine.Diaries[self.Name]then
returnGameVars.Engine.Diaries[self.Name].Visible
end
end
--- The function displays the specified diary. Can be used to call the diary directly using volume or classic triggers.
-- @tparam int pageIndex The page number at which diary should be opened.
TEN.Util.PrintLog("'pageIndex' is in an incorrect format or not a valid page number. Expected a number type in function 'showDiary' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageIndex' is in an incorrect format or not a valid page number. Expected a number type in function 'unlockPages' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
ifnotType.IsBoolean(notification)then
TEN.Util.PrintLog("'notification' is in an incorrect format. Expected a bool type in function 'unlockPages' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pageIndex' is in an incorrect format or not a valid page number. Expected a number type in function 'clearPage' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Page Cleared: "..tostring(pageIndex).." for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
end
end
--- Adds a text entry to the specified page for the diary.
-- @tparam int pageIndex page number to add the text entry to.
-- @tparam string text Text entry to be added to the page.
-- @tparam Vec2 textPos X,Y position of the text.
-- @tparam Strings.DisplayStringOption textOptions alignment and effects for the text. Default: None. Please note text is automatically aligned to the LEFT
-- @tparam number textScale Scale factor for the text.
TEN.Util.PrintLog("'text' is in an incorrect format. Expected a string type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
textEntry.text=text
ifnotType.IsVec2(textPos)then
TEN.Util.PrintLog("'textPos' is in an incorrect format. Expected a Vec2 type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
textEntry.textPos=textPos
ifnotType.IsTable(textOptions)then
TEN.Util.PrintLog("'textOptions' is in an incorrect format. Expected a table type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
for_,datainpairs(textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
end
textEntry.textOptions=textOptions
ifnotType.IsNumber(textScale)then
TEN.Util.PrintLog("'textScale' is in an incorrect format. Expected a number type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
textEntry.textScale=textScale
ifnotType.IsColor(textColor)then
TEN.Util.PrintLog("'textColor' is in an incorrect format. Expected a Color type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
print("Text entry added to page: "..tostring(pageIndex).." for the diary system: "..tostring(self.Name))
else
TEN.Util.PrintLog("'pageIndex' is in an incorrect format. Expected a number type in function 'addTextEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
end
end
--- Adds an image entry to the specified page for the diary.
-- @tparam int pageIndex page number to add the image entry to.
-- @tparam Objects.ObjID objectId Object ID for the image entry sprite.
-- @tparam number spriteId SpriteID from the specified object for the image entry.
-- @tparam Color color Color of image entry.
-- @tparam Vec2 pos X,Y position of the image entry in screen percent (0-100).
-- @tparam number rot rotation of the image entry (0-360).
-- @tparam Vec2 scale X,Y Scaling factor for the image entry.
-- @tparam View.AlignMode alignMode Alignment for the image entry.
-- @tparam View.ScaleMode scaleMode Scaling for the image entry.
-- @tparam Effects.BlendID blendMode Blending modes for the image entry.
TEN.Util.PrintLog("Invalid objectId slot. Please use a sprite slot. Expected a sprite slot in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
imageEntry.objectId=objectId
ifnotType.IsNumber(spriteId)then
TEN.Util.PrintLog("'spriteId' is in an incorrect format. Expected a number type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
imageEntry.spriteId=spriteId
ifnotType.IsColor(color)then
TEN.Util.PrintLog("'color' is in an incorrect format. Expected a Color type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
imageEntry.color=color
ifnotType.IsVec2(pos)then
TEN.Util.PrintLog("'pos' is in an incorrect format. Expected a Vec2 type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
imageEntry.pos=pos
ifnotType.IsNumber(rot)then
TEN.Util.PrintLog("'rot' is in an incorrect format. Expected a number type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
imageEntry.rot=rot
ifnotType.IsVec2(scale)then
TEN.Util.PrintLog("'scale' is in an incorrect format. Expected a Vec2 type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
print("Image entry added to page: "..tostring(pageIndex).." for the diary system: "..tostring(self.Name))
else
TEN.Util.PrintLog("'pageIndex' is in an incorrect format. Expected a number type in function 'addImageEntry' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
end
end
--- Add a narration track in the voice channel to the page. Track is played with the draw button.
-- @tparam int pageIndex page number to add the narration track to.
-- @tparam string trackName of track (without file extension) to play.
print("Narration added to page: "..tostring(pageIndex).." for the diary system: "..tostring(self.Name))
else
TEN.Util.PrintLog("'trackName' is in an incorrect format. Expected a string type in function 'addNarration' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
else
TEN.Util.PrintLog("'pageIndex' is in an incorrect format. Expected a number type in function 'addNarration' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
end
end
--- Remove the narration track from the page of the specified diary.
-- @tparam int pageIndex page number to remove the narration track from.
TEN.Util.PrintLog("'pageIndex' is in an incorrect format or not a valid page number. Expected a number type in function 'removeNarration' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectId slot. Please use a sprite slot. Expected a sprite slot in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'spriteId' is in an incorrect format. Expected a number type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'color' is in an incorrect format. Expected a Color type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pos' is in an incorrect format. Expected a Vec2 type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'rot' is in an incorrect format. Expected a number type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scale' is in an incorrect format. Expected a Vec2 type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type in function 'AddBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type in function 'addBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alpha is in an incorrect format. Expected a number (0-255) type in function 'addBackground' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'notificationTime' is in an incorrect format. Expected a number type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("Invalid objectId slot. Please use a sprite slot. Expected a sprite slot in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'spriteId' is in an incorrect format. Expected a number type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'color' is in an incorrect format. Expected a Color type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'pos' is in an incorrect format. Expected a Vec2 type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'rot' is in an incorrect format. Expected a number type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scale' is in an incorrect format. Expected a Vec2 type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'alignMode' is not a valid View.AlignMode type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'scaleMode' is not a valid View.ScaleMode type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'blendMode' is not a valid Effects.BlendID type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'notificationSound' is in an incorrect format. Expected a number type in function 'customizeNotification' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
print("Notifications cleared for the diary system: "..tostring(self.Name))
end
end
--- Customizes the page numbers for the diary.
-- @tparam int pageNoType Specifies the format for page numbers (1 or 2). 1: Displays only the current page number. 2: Formats the page number as: [Prefix][CurrentPage][Separator][UnlockedPages].
-- @tparam string prefix Prefix to be added for type 2 of page numbers.
-- @tparam string separator Separator to be added for type 2 of page numbers.
-- @tparam Vec2 textPos X,Y position of the page numbers.
-- @tparam Strings.DisplayStringOption textOptions alignment and effects for the text. Default: None. Please note text is automatically aligned to the LEFT
-- @tparam number textScale Scale factor for the page numbers.
-- @tparam Color textColor Color of the page numbers.
TEN.Util.PrintLog("'prefix' is in an incorrect format. Expected a string type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'separator' is in an incorrect format. Expected a string type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'textPos' is in an incorrect format. Expected a Vec2 type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
ifnotType.IsTable(textOptions)then
TEN.Util.PrintLog("'textOptions' is in an incorrect format. Expected a table type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
else
for_,datainpairs(textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'textScale' is in an incorrect format. Expected a number type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'textColor' is in an incorrect format. Expected a Color type in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
end
else
TEN.Util.PrintLog("'pageNoType' is in an incorrect format. Expected a number type (1 or 2) in function 'customizePageNumbers' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
print("Page Numbers updated for the diary system: "..tostring(self.Name))
end
--- Clears settings for the page numbers for the specified diary.
print("Page Numbers cleared for the diary system: "..tostring(self.Name))
end
end
--- Customizes the controls text for the diary.
-- @tparam Vec2 textPos X,Y position of the controls text.
-- @tparam Strings.DisplayStringOption textOptions alignment and effects for the text. Default: None. Please note text is automatically aligned to the LEFT.
-- @tparam number textScale Scale factor for the controls.
-- @tparam Color textColor Color of the page controls.
TEN.Util.PrintLog("'textPos' is in an incorrect format. Expected a Vec2 type in function 'customizeControls' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
ifnotType.IsTable(textOptions)then
TEN.Util.PrintLog("'textOptions' is in an incorrect format. Expected a table type in function 'customizeControls' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
else
for_,datainpairs(textOptions)do
iftype(data)~="number"ordata<0ordata>3then
TEN.Util.PrintLog("Data in 'textOptions' table is not a valid Strings.DisplayStringOption type in function 'customizeControls' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'textScale' is in an incorrect format. Expected a number type in function 'customizeControls' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'textColor' is in an incorrect format. Expected a Color type in function 'customizeControls' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
return
end
GameVars.Engine.Diaries[self.Name].Controls.text1="Space: Play Voice Note"
TEN.Util.PrintLog("'string1' is in an incorrect format. Expected a string type in function 'customizeControlsText' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'string2' is in an incorrect format. Expected a string type in function 'customizeControlsText' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'string3' is in an incorrect format. Expected a string type in function 'customizeControlsText' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'string4' is in an incorrect format. Expected a string type in function 'customizeControlsText' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)
TEN.Util.PrintLog("'separator' is in an incorrect format. Expected a string type in function 'customizeControlsText' for the diary system: "..tostring(self.Name),Util.LogLevel.WARNING)