1.88 System .745 1.88.1 System.AddChatLogMessage .745 1.88.2 System.CommercePointlsClosed .746 1.88.3 System.CommercePointOpen .746 1.88.4 System.DrawText2dlnScene .748 1.88.5 System.EnableldleDisconnect .748 1.88.6 System.ExecTitle .749 1.88.7 System.GetChatLogMode .750 1.88.8 System.GetConsoleTestValue .750 1.88.9 System.GetExecTitleErrorCode .751 1.88.10 System.GetNatType .751 1.88.11 System.GetRegionsTerritory .752 1.88.12 System.GetScreenBottomRight.753 1.88.13 System.GetScreenTopLeft .753 1.88.14 System.GetUserValue .754 1.88.15 System.GetVideollploadResult .754 1.88.16 System.GetVideollploadStatus .755 1.88.17 System.GetVideollploadllrl .756 1.88.18 System.IsGameLaunchSessionActive.756 1.88.19 System.IsLookXInverted .757 1.88.20 System.IsLookYInverted .757 1.88.21 System. IsVideoSystemLocked .758 1.88.22 System.IsWideScreen .759 1.88.23 System.PostScore .759 1.88.24 System.ProfanityFilterText .760 1.88.25 System.SendNpMessage .760 1.88.26 System.SetChatLogMode .761 1.88.27 System.UploadVideo .761 1.88.28 System.VideoSystemLock.762 1.88.29 System.VideoSystemllnlock .763 1.88.30 System.WebBrowserlsClosed .764 1.88.31 System.WebBrowserOpen .764 1.88.32 System.WriteScriptedGameLaunchXML .765 System System.AddChatLogMessage Brief Adds a lua message in the chat log. Definition 1 System.AddChatLogMessage( string message, string nameOfSpeaker ) Arguments message - The message to add to the chat log.nameOfSpeaker - The name of the speaker (optional). Return Values None. Description Adds a lua message in the chat log. If the chat log is not visible when this function is called, it will activate and display the message. The message text will appear in a different color to the other messages (r = 0.4, g = 0.7, b = 1.0). Examples me = LocalPlayer.GetPerson() j System.AddChatLogMessage( 'Good morning ' .. Person.GetName( me ) ) See Also None System.CommercePointlsClosed Brief Returns true if the commerce point is closed and false if it is open (active). Definition ! boolean System.CommercePointlsClosed() Arguments None Return Values Returns true if the commerce point is closed and false if it is open (active). Description Returns true if the commerce point is closed and false if it is open (active). Examples if System.CommercePointlsClosed() == true then System.CommercePointOpen( myUrl ) | end See Also • System.CommercePointOpen System.CommercePointOpen Brief Opens a commerce point with the specified url. Definition number System.CommercePointOpen( string url, string rootNodeld = nil, string initNodeld = nil ) Arguments url - The url of the commerce point.rootNodeld - The "node id" of the commerce point xml element to treat as the "root node" of the commerce point.initNodeld - The "node id" of the commerce point xml element to treat as the "init node" of the commerce point. Return Values The result of the open request. Return values are: 1 - commerce point was opened -1 - commerce point is already running Description Opens a commerce point with the specified url. See the return result to see if it failed or succeeded. The URL for the commerce point requires the correct path - these are set up using a standard format as follows: SCENE_NAME/REGION_CODE/CP.xml where: SCENE_NAME is the name of the scene including the code on the end e.g. E_COMPA_DW1_5C2G_J5V XFORM_Lounge_2_9KEL_1 N8L SCEE_PureFire_Lobby_0R2J_766 REGION_CODE is the PSN/PMT region code (SCEE=E, SCEA=A, SCEJ=J, SCEAsia=H) CP_ShortNAME is a 'shortcode' that should be meaningful to you. 2_CFIAR_NUM is simply a two character number which can mean anything, and again should be meaningful you (e.g. a version number) When opening a commerce point on demand using the call, simply build the commerce point file path using the known information. For example: SCEA user opening a specific commerce point: XFORM_Lounge_2_9KEL_1N8L/A/CPAXFLOO.xml where the CP_ShortNAME="XFL" and 2_CHAR_NUM="00" SCEE user opening the same commerce point for their region: XFORM_Lounge_2_9KEL_1 N8L/E/CPEXFL00.xml If the rootNodeld parameter is specified, the "root node" will be set. If the root node is a element, then navigation of the commerce point will be restricted to the browser page corresponding to that element, all child pages, the item info page and the basket. If the root node is a or element, then navigation of the commerce point will be restricted to the item info page and basket. If the initNodeld parameter is specified, the "init node" will be set. If the init node is a element, then navigation of the commerce point will begin at the browser page corresponding to that element, if the init node is a or element, then navigation of the commerce point will begin at the item info page. Examples System.CommercePointOpen( 'XFORM_Lounge_2_9KEL_lN8L/E/CPEXFLOO.xml' ) System.CommercePointOpen( 'XFORM_Lounge_2_9KEL_lN8L/E/CPEXFLOO.xml', 'male headgear' ) System.CommercePointOpen( 'XFORM_Lounge_2_9KEL_lN8L/E/CPEXFLOO.xml', 'male headgear', 'big hat' ) System.CommercePointOpen( 'XFORM_Lounge_2_9KEL_lN8L/E/CPEXFLOO.xml', nil, 'big hat' ) See Also System. CommercePointlsClosed System.DrawText2dlnScene Brief Allow text to be displayed in 3D space. Definition System.DrawText2dInScene(string text, Vector4 position, Vector4 color, Text3dAlign alignment, number size, boolean isShadowed, Vector4 shadowColor, boolean isBold, boolean isAlwaysOnTop, boolean isFixedSize) Arguments text - the text to be displayed.position - the 3D position at which the text will appear.color - the color of the text to be displayed.alignment - the alignment of the text, in relation to the position given. This will be one of the following: • Text3dAlignment.TopLeft • Text3dAlignment.TopMiddle • Text3dAlignment.TopRight • Text3dAlignment.Left • Text3dAlignment. Center • Text3dAlignment. Right • Text3dAlignment.BottomLeft • Text3dAlignment.BottomMiddle • Text3dAlignment.BottomRight Default is 'Text3dAlignCenter'.size - the size of the text. Default is '1.O',isShadowed - whether the text should have a drop shadow. Default is ’false'.shadowColor - the colour of the shadow, if 'isShadowed' is set to true. Default is black, if no color is provided.isBold - whether the text is in bold font. Default is 'false'.isAlwaysOnTop - whether the text should adhere to 3D geometry obscuring it. Default is 'false'.isFixedSize - whether the text should resize depending on distance away from camera. Default is 'false'. Return Values Description Displays 2D text in 3D space, much like the avatar label user name. Examples System.DrawText2dInScene(text, position, color) See Also None System. EnableldleDisconnect Brief Sets whether the idle disconnect is allowed. Definition System.EnableldleDisconnect(boolean enable) Arguments enable - True to enable or false to disable. Return Values None. Description If set to false, the user will not be disconnected if idle for too long. This can be useful for disabling the auto-disconnect while the user is watching a full-length video for example. The idle disconnect defaults to enabled. Examples ! System.EnableldleDisconnect(false) See Also None System. ExecTitle Brief Launches an installed title. Definition number System.ExecTitle( string titleld, number param, string errorCallback ) Arguments titleld - The title ID of the title to launch.param - Integer value that will be passed through to the launched title.errorCallback - Callback function which will be invoked if the title fails to execute. Return Values 0 if title not available, 1 otherwise. Description Launches an installed title. The integer value that is passed through to the game can be queried using the execData parameter of cellGameGetBootGamelnfo. In the case where user confirmation is required before proceeding with ExecTitle, for example confirmation to leave a Game Launching session, 1 will be returned to indicate no errors so far and ExecTitle will only proceed if user confirms. If user cancels then the error callback will be invoked and this particular case should be handled. If the title fails to execute the callback will be invoked, within this callback use System.GetExecTitleErrorCode() to retreive the error code. Scripts that make use of this function must also include a game_launch_properties component in the object to allow PS Home to manage any potential system conflicts. Failure to comply will result in a Lua error being generated. Examples gameOptions = 10 if Gamelnfo.IsGamesListBusy() == false then System.ExecTitle( "XXXX12345", gameOptions, "MyLaunchErrorCB()" ) end See Also • Gamelnfo. IsGamesListBusy • Gamelnfo.SearchByTitleld • Gamelnfo.lsSearchFinished • Gamelnfo.GetSearchResults System.GetChatLogMode Brief Gets the current display mode of the Chat Log. Definition : ChatLogMode System.GetChatLogMode() Arguments None Return Values The current mode of the Chat Log. This will be one of the following: • ChatLogMode.Minimized • ChatLogMode.Maximized • ChatLogMode.Closed Description Returns whether the mode of the Chat Log is minimized (visible but not interactive), maximized (visible and interactive), or closed. Examples j if (System.GetChatLogMode() ~= ChatLogMode.Closed) then HideHud() j end See Also • System.SetChatLogMode System.GetConsoleTestValue Brief Gets the value of the specified test key Definition ! string System.GetConsoleTestValue() Arguments None Return Values Description Returns the value for a specified test key, which can be set (in the HDK and QA/test builds) by using the command 'SetConsoleTest' either manually through the debug console or through a hubstartup.txt file Examples [With 'SetConsoleTest MyKey,MyValue' included in hubstartup.txt] value = System.GetConsoleTestValue( 'MyKey' ) See Also None System.GetExecTitleErrorCode Brief Retrieves the error code set upon ExecTitle failure. Definition number System.GetExecTitleErrorCode() Arguments Return Values error code Description Retrieves the error code set upon ExecTitle failure. This function is only valid within the error callback specified as part of the System.ExecTitle() call. Error codes: 1 - unknown error 2 - parental level restricted 3 - exec title cancelled The script should use this opportunity to gracefully recover from the failure. Examples function LaunchTitle() System.ExecTitle( "XXXX12345", gameOptions, "MyLaunchErrorCB()" ) end function MyLaunchErrorCB() local errorCode = System.GetExecTitleErrorCode() — Insert script here to handle the error end See Also System.GetNatType Brief Gets the NAT type of the user. Definition int System.GetNatType() Arguments None Return Values The NAT type for the user, which will be either 1,2 or 3. Description The user's NAT type will depend on their network configuration. Users with NAT type 1 and 2 should not have any issues with PS Home functionality. Users on NAT type 3 may not be able to fully join RtGame sessions. Examples allowUserToHostRtGame = true if (System.GetNatType() == 3) then allowUserToHostRtGame = false — display OSD informing user of the issue end See Also None System.GetRegionsTerritory Brief Returns the territory of the specified region. Definition string System.GetRegionsTerritory( string region ) Arguments region - The region to get the territory for, e.g. ”en-GB". Return Values The territory of the specified region. Description Returns the territory of the specified region. Can be one of the following: "SCEE" (Europe) "SCEA" (North America) "SCEJ" (Japan) "SCEAsia" (Rest of Asia) Note: the default territory is set to SCEE - this means that if the region submitted is invalid then SCEE is returned. Examples currentRegion = LocalPlayer.GetCurrentRegion() print( 'My territory is ' .. System.GetRegionsTerritory( currentRegion ) ) See Also Local Player.GetCurrentRegion • LocalPlayer.GetHomeRegion • LocalPlayer.GetAccountRegion System.GetScreenBottomRight Brief Returns the x and y pixel values of the bottom right of the screen. Definition ! Vector4 System.GetScreenBottomRight() Arguments None Return Values A Vector4 containing the x and y pixel values of the bottom right of the screen. Description Returns a Vector4 containing the x and y pixel values of the bottom right of the screen. The value differs between widescreen and 4/3 mode. Examples 1 Renderer.DrawText2d( renderer, System.GetScreenBottomRight(), "Bottom right" ) See Also • System.IsWideScreen • System.GetScreenTopLeft System.GetScreenTopLeft Brief Returns the x and y pixel values of the top left of the screen. Definition ! Vector4 System.GetScreenTopLeft() Arguments None Return Values A Vector4 containing the x and y pixel values of the top left of the screen. Description Returns a Vector4 containing the x and y pixel values of the top left of the screen. The value differs between widescreen and 4/3 mode. Examples ! Renderer.DrawText2d( renderer, System.GetScreenTopLeft(), "Top left" ) See Also • System.IsWideScreen • System.GetScreenBottomRight System.GetUserValue Brief Gets a value for a specified system key Definition ! string System.GetUserValue(string key) Arguments key - Key to get Return Values Returns the key's value or NIL if none is set Description Gets a system option value. System keys are controlled by HPG, and relate to future systems. Examples See Also None System.GetVideollploadResult Brief Retrieve the result of the last video upload request. Definition ! Result System.GetVideoUploadResult() Arguments None Return Values One of the following result codes: VidUploadResult.Success - success VidllploadResult.ErrBusy - the upload utility was busy VidUploadResult.ErrNetwork - a network error occurred VidUploadResult.Errllnavailable - the upload service is currently unavailable VidUploadResult.ErrQuote - service limit on upload size was exceeded VidUploadResult.ErrMemory - out of memory VidUploadResult.ErrFile - unable to open specified file VidUploadResult.Errllnknown - other unspecified error Description Reports the current status of the video upload utility. Examples if ( System.GetVideoUploadResult() ~= VidUploadResult.Success ) then print('Upload failed') end See Also • System.UploadVideo • System.GetVideoUploadStatus • System.GetVideoUploadllrl System.GetVideoUploadStatus Brief Retrieve the status of the current video upload request, if any. Definition ! Status System.GetVideoUploadStatus() Arguments None Return Values One of the following status codes: VidUploadStatus.ldle - no current upload VidUploadStatus.Busy - upload utility is currently busy with another task and is unavailable VidUploadStatus.Uploading - currently uploading VidUploadStatus.Error - an error occurred during upload Description Reports the current status of the video upload utility. Examples while ( System.GetVideoUploadStatus() == VidUploadStatus.Uploading ) do coroutine.yield() end See Also System. UploadVideo • System.GetVideoUploadResult • System. GetVideollploadUrl System.GetVideollploadUrl Brief Retrieve the resulting URL of the last successfully uploaded video. Definition ! string System.GetVideoUploadUrl() Arguments None Return Values The URL as a string. Description Returns the URL of the uploaded video if upload succeeded, or an empty string if the upload failed. Examples ; print( 'Your video has been uploaded to ' .. System.GetVideoUploadUrl() ) See Also • System.UploadVideo • System.GetVideoUploadStatus • System.GetVideoUploadResult System.IsGameLaunchSessionActive Brief Query whether the local user is part of a game launch session. Definition ! boolean System.IsGameLaunchSessionActive() Arguments None Return Values True if the local user is part of a game launch session, or false otherwise. Description If the local user is part of a game launch session, a script may wish to prevent access to certain functionality. This function will indicate whether the user is joined to a game launch session. Examples ! if (not System.IsGameLaunchSessionActive()) then StartVideoRecording() | end See Also None System. IsLookXInverted Brief Returns the user setting for X axis look invert option. Definition ! boolean System.IsLookXInverted() Arguments None Return Values true if the user's settings in PS Home has the X axis look inverted and false otherwise. Description Returns true if the user's settings in PS Home has the X axis look inverted and false otherwise. Examples ! if ( System.IsLookXInverted() ) then angle = -angle | end See Also None System. IsLookYInverted Brief Returns the user setting for Y axis look invert option. Definition ! boolean System.IsLookYInverted() Arguments None Return Values true if the user's settings in PS Home has the Y axis look inverted and false otherwise. Description Returns true if the user's settings in PS Home has the Y axis look inverted and false otherwise. Examples if ( System.IsLookYInverted() ) then angle = -angle end See Also None System. IsVideoSystem Locked Brief Returns the status of the video system lock. Definition ! boolean System.IsVideoSystemLocked() Arguments None Return Values True if the lock is being used. Description This will check to see if any object currently has the video system locked. This function will not return true if the scene is using the video system - this is not considered a lock, only objects will lock the video system. Examples ! if ( not System.IsVideoSystemLocked() ) then if ( System.VideoSystemLock() ) then print("Video system locked!") else print("Oops, the scene is using the video system. Lock will never succeed.") end ! else print("Oops, another object holds the lock! Can try again later.") | end L_ See Also • System.VideoSystemLock • System.VideoSystemllnlock • Screen.Create System.IsWideScreen Brief Queries whether PS Home is running in widescreen mode or not. Definition ! boolean System.IsWideScreen() Arguments None Return Values true if PS Home is running in widescreen mode and false otherwise. Description Returns true if PS Home is running in widescreen mode and false otherwise. Examples 1 if System.IsWideScreen() then print( "You are in widescreen" ) | end See Also • System. GetScreenBottomRight • System.GetScreenTopLeft System.PostScore Brief Posts a score to the score service Definition ! System.PostScore( string guid, number score, table metadata = nil ) Arguments guid - A unique developer guid for external trackingscore - The users scoremetadata - An optional lua table containing metadata for this score Return Values Description This function will upload a users score value to the score service with optional metadata, ill be encoded in Json and if any errors occur parsing the data the score will be uploaded without it. Examples LoadLibrary( "System" ) local score = 100 local data = { track ="Track9", car="Car4", time="1:23:57" } System.PostScore( "8dd2eea4-fd37-48cl-9f90-d0cbl6ca307f", score, data ) See Also • Json. Decode System. ProfanityFilterText Brief Filters a string through the profanity filter. Definition string System.ProfanityFilterText( string unfilteredText ) Arguments unfilteredText - The string to be filtered for profanity. Return Values The string as filtered by the profanity filter. Description Filters a string through the profanity filter. To test if filtering happened, perform string equality test on original and returned text. Note that profanity filtering should be applied by the receiver of text (for display purposes) and not the sender. Examples ! displayText = System.ProfanityFilterText( receivedText ) See Also None System.SendNpMessage Brief Sends an NP message to the specified users. Definition System.SendNpMessage( User[] users, string subject, string body ) Arguments users - An array of User objects.subject - The subject of the message.body - The body/main text of the message. Return Values None. Description Sends an NP message to the specified users. A popup appears requiring user interaction to send the message. Users are grouped in batches of 12. The maximum subject length is 18 bytes including 1 byte for null termination. The maximum text body is 512 bytes including 1 byte for null termination. Examples friends = LocalPlayer.GetFriends() subject = "Game Launching" body = "Hi! We're about to game launch. Come join us! System.SendNpMessage( friends, subject, body ) See Also • LocalPlayer.GetFriends System.SetChatLogMode Brief Sets the display mode of the Chat Log. Definition System.SetChatLogMode(ChatLogMode mode) Arguments mode - the desired mode of the Chat Log. This will be one of the following: • ChatLogMode.Minimized • ChatLogMode.Maximized • ChatLogMode.Closed Return Values Description Sets whether the mode of the Chat Log is minimized (visible but not interactive), maximized (visible and interactive), or closed. Examples System.SetChatLogMode(ChatLogMode.Maximized) See Also • System.GetChatLogMode System.UploadVideo Brief Upload a specified video to a supported video sharing site. Definition boolean System.UploadVideo( FileHandle file, siteCode, ... ) Arguments file - a handle to a video file obtained from VideoRecorder.GetOutputFilesiteCode - video sharing site ID code (see details)... - further parameters, depending on the site code (see details) Return Values true if upload was successfully initiated, false otherwise. Description Initiates an upload of the specified video to a supported video sharing site. A variety of extra metadata may be supplied depending on the site, see the list below: YouTube (R) - [ string clientld ] [ string developerKey ] [ string title ]. [ string description ], [ string keywordl ], clientld - Client ID chosen by developer, max 63 bytes ASCII alphanumeric characters only. developerKey - Developer key on YouTube. A developer should obtain this from YouTube directly (see below). title - Video title, max 60 bytes in UTF-8. description - Video description, max 1023 bytes in UTF-8. keywordl, keyword2, keyword3 - Video keywords, each max 24 bytes in UTF-8. isPrivate - Private video (only visible to uploading user). rating - Viewer age restriction, 0 indicates no restrictions. The client ID can be chosen by the developer and represent the object using the upload API. The developer key must be obtained from YouTube (http://code.google.com/apis/youtube/dashboard/) and is separate from the user's username and password. The user will be prompted for their own username and password automatically as part of the upload. Also note that it is forbidden to charge a fee either directly or indirectly to upload videos to YouTube, this is against the YouTube Terms of Use. [] = compulsory <> = optional The siteCodes available are: VideoSite.YouTube Note that a successful result from this function only indicates that the upload process has started successfully, you must check the progress using the GetVideoUploadStatus() function. The upload is not complete until the utility status is VidUploadStatus.ldle or VidUploadStatus.Error. If this function returns false, this will indicate the uploader is busy, the script may try again a fixed number of times but it should not assume that the upload will always succeed. Examples local video = VideoRecorder.GetOutputFile() if ( System.UploadVideo( video, VideoSite.YouTube, myClientld, myDevKey, 'My Video', 'My PS Home video', 'Home' ) ) then print('Video uploading...') end See Also • System.GetVideoUploadStatus • System.GetVideoUploadResult • System.GetVideoUploadUrl • VideoRecorder.GetOutputFile System. VideoSystem Lock Brief Allows a non scene object to attempt to gain access to the video system. Definition boolean System.VideoSysteraLock() Arguments None Return Values True if the object successfully locked the video system or false otherwise. Description The VideoSystem is primarily used for scenes and scene objects. Other types of object may attempt to lock the video system for use if it is not already in use by the scene. If the lock returns true, this instance of the object may freely create and play videos. Once playback has finished, the object must unlock the video system for use by other objects. If the lock fails, no videos can be created by non scene objects. A script can distinguish between the two lock failure cases (another object having the lock, and the scene using the video system) by checking the IsVideoSystemLocked function; this will only return true in the former case. Examples local screen = Screen.Create() if ( not System.IsVideoSystemLocked() ) then if ( System.VideoSystemLock() ) then print("Video system locked!") Screen.SetContent( screen, "http://www.mycontentserver.com/video.mp4" ) else print("Oops, the scene is using the video system. Lock will never succeed.") end else print("Oops, another object holds the lock! Can try again later.") end See Also • System.VideoSystemllnlock • System.IsVideoSystemLocked • Screen.Create System.VideoSystemllnlock Brief Unlocks the video system assuming the object currently has the lock. Definition ! System.VideoSystemUnlock() Arguments None Return Values None. Description Assuming a non scene object successfully acquired the lock for the video system, this function will release the lock once the object has finished using it. This must be called before termination of the object. The unlock call will only succeed once the video has been deleted so it may not be possible to immediately reacquire the lock after this call. Examples ! if ( not Screen.IsContentPlaying( myScreen ) ) then System.VideoSystemUnlock() j end See Also • System.VideoSystemLock • System. IsVideoSystemLocked • Screen.Create System.WebBrowserlsClosed Brief Checks if the user has closed the browser. Definition ! boolean System.WebBrowserlsClosed() Arguments None Return Values true if the user has closed the browser, false otherwise. Description Checks if the user has closed the browser. Examples local hasFinished = System.WebBrowserlsClosed() See Also • System.WebBrowserOpen SystemWeb B rowserOpe n Brief Requests opening of the web browser. Definition number System.WebBrowserOpen( string url ) Arguments url - The HTTP-based URL to open in the web browser. Return Values The result of the open request. Return values are: 1 - Browser was opened 0 - Browser is not available yet -1 - Browser is already running -2 - Browser is not permitted to run Description Checks for the availability of the web browser and opens it at the specified URL if available. The web browser that is opened supports Adobe Flash Player 7. Examples local browserWasOpened = System.WebBrowserOpen( "http://www.example.com/" ) See Also • System.WebBrowserlsClosed System.WriteScriptedGameLaunchXML