| 1.44MiniGame . |
| 1.44.1 MiniGame.AddCustomExitMenuOption . |
| 1.44.2 MiniGame.CloseSession . |
| 1.44.3 MiniGame.ConfirmReceivedWelcomeMessage . . . |
| 1.44.4 MiniGame.DisableWelcomeMessages . |
| 1.44.5 MiniGame.EnableQueue . |
| 1.44.6 MiniGame.GetCurrentFocusPersonld . |
| 1.44.7 MiniGame.GetCurrentFocusPlayerSlot . |
| 1.44.8 MiniGame.GetJoinType . |
| 1.44.9 MiniGame.GetMaxPlayerSlots . |
| 1.44.10 MiniGame.GetNumberOfUsedPlayerSlots . |
| 1.44.11 MiniGame.GetPersonldFromPlayerSlot . |
| 1.44.12 MiniGame.GetPlayerSlotUsedByPersonld . |
| 1.44.13 MiniGame.GetQueueSize . |
| 1.44.14 MiniGame.GetTriggerFtadius . |
| 1.44.15 MiniGame.lsAbleToChangeCustomExitMenuOption |
| 1.44.16 MiniGame.lsPersonJoined . |
| 1.44.17 MiniGame.lsSessionOpen . |
| 1.44.18 MiniGame.lsSessionOwner . |
| 1.44.19 MiniGame.LocalPlayerLeaveGame . |
| 1.44.20 MiniGame.OpenSession . |
| 1.44.21 MiniGame.RemoveCustomExitMenuOption . |
| 1.44.22 MiniGame.SetJoinType . |
| 1.44.23 MiniGame.SetLocalPlayerExcludeMessage . |
| 1.44.24 MiniGame.SetSafeToSendWelcomeMessage ... |
|
|
| MiniGame |
| MiniGame.AddCustomExitMenuOption |
| Brief |
| Add a custom menu item to the Exit Menu for the mini-game. |
| Definition |
| MiniGame.AddCustomExitMenuOption(string optionText) |
| Arguments |
| optionText - The localized string to display. Note: This must contain the "[SQUARE]" tag to denote the |
| SQUARE button selects this option. This will almost certainly be at the start of the text, and likely |
| include a space after it, to separate it from the rest of the text. E.g. "[SQUARE] Settings". |
| Return Values |
| None. |
| Description |
| This enables the custom menu option in the mini-game's Exit Menu, and sets the text for that option. The text must be localized before input. Only |
| one custom option can be added. Successive calls to this function can be used to alter the text displayed. Use the |
| 'on_custom_exit_menu_option_selected l callback to detect the SQUARE button being pressed. |
| Examples |
| local customText = Object.GetMe():GetLocalizedText("myCustomOptionText") |
| MiniGame.AddCustomExitMenuOption(myCustomOptionText) |
| See Also |
| � MiniGame. RemoveCustomExitMenuOption |
| � MiniGame. IsAbleToChangeCustomExitMenuOption |
| MiniGame.CloseSession |
| Brief |
| Close the minigame network session to new player entry. |
| Definition |
| Mini-Game .CloseSession() |
| Arguments |
| None. |
| Return Values |
| None. |
| Description |
| Close the current minigame network session to prevent new players from joining. While the session is closed, new players will not be able to join |
| the game. Only the session owner may call this function. |
| Examples |
| if (MiniGame.IsSessionOwner() and gamelsReadyToStart) then � some user flag indicating the lobby |
| period is finished |
| MiniGame.CloseSession() |
| end |
| See Also |
| � MiniGame.OpenSession |
| � MiniGame.IsSessionOwner |
| � MiniGame.IsSessionOpen |
| MiniGame.ConfirmReceivedWelcomeMessage |
| Brief |
| Confirms that a valid welcome message has been received. |
| Definition |
| MiniGame.ConfirmReceivedWelcomeMessage() |
| Arguments |
| None |
| Return Values |
| None. |
| Description |
| Use this function to confirm that a valid welcome message has been received. Until this is called, the local player cannot join the mini-game (if |
| welome messages are not disabled), as it is assumed they do not know the current state of it. |
| Examples |
| function OnReceivedMessage() |
| local message = ReceivedMessage.GetEventMessage() |
| local type = ReceivedMessage.GetType( message ) |
| if ( type == WELCOME_MESSAGE ) then |
| gameState = ReceivedMessage.Readlnt32( message ) |
| MiniGame.ConfirmReceivedWelcomeMessage() |
| else |
| � Handle other message types |
| end |
| end |
| See Also |
| � MiniGame. DisableWelcomeMessages |
| � MiniGame.SetSafeToSendWelcomeMessage |
| MiniGame.DisableWelcomeMessages |
| Brief |
| Disables welcome messages. |
| Definition |
| ! MiniGame.DisableWelcomeMessages() |
| Arguments |
| None |
| Return Values |
| None. |
| Description |
| You must call this function if you do not want to use welcome messages in your mini-game. A welcome message is a full refresh of game state, |
| typically used if an avatar joins a scene and has no prior knowledge of the game. If you don't call this function, the mini-game system will expect |
| welcome messages to be sent and received, and therefore won't allow a player to join the game until one is received from a remote player. You |
| are advised to call this function once when your script initializes. |
| Examples |
| ! MiniGame.DisableWelcomeMessages() |
| See Also |
| � MiniGame.ConfirmReceivedWelcomeMessage |
| � MiniGame.SetSafeToSendWelcomeMessage |
| MiniGame.EnableQueue |
| Brief |
| When called the mini-game uses the queuing system. |
| Definition |
| MiniGarae.EnableQueue () |
| Arguments |
| None |
| Return Values |
| None. |
| Description |
| When called the mini-game uses the queuing system. The default is for it to not use it. Note that this function must only be called at initialization of |
| the script. The queuing system is totally automated and will handle joining players into the mini-game from the queue. Note: Queues act on |
| game-types, not individual game instances. E.g. If you had 4 pool tables, the queue would be for all 4, and would place you on the first one |
| available. The queuing system supplies queues based on the name of the mini-game. Note there's a maximum of 16 game types per scene. |
| Examples |
| Mini-Game . EnableQueue () |
| See Also |
| None |
| MiniGame.GetCurrentFocusPersonld |
| Brief |
| Gets the person id currently in focus. |
| Definition |
| string MiniGame.GetCurrentFocusPersonld() |
| Arguments |
| None |
| Return Values |
| The person id relevant to the event callback in which it is called. |
| Description |
| Gets the currently focussed person id in the context of certain specific callbacks as specified by the 'mini_game' component in the HDK's Object |
| Editor. This function is only valid for the following callbacks: |
| on_add_player |
| on_remove_player |
| on_local_playerJoin |
| on_local_player_leave |
| on_send_welcome_message |
| Examples |
| function OnAddPlayer() |
| personid = MiniGame.GetCurrentFocusPersonld() |
| print( "Player added: " .. personid ) |
| end |
| See Also |
| � MiniGame.GetCurrentFocusPlayerSlot |
| MiniGame.GetCurrentFocusPlayerSlot |
| Brief |
| Gets the player slot currently in focus. |
| Definition |
| number MiniGame.GetCurrentFocusPlayerSlot() |
| Arguments |
| None |
| Return Values |
| The player slot relevant to the event callback in which it is called. |
| Description |
| Gets the currently focussed player slot in the context of certain specific callbacks as specified by the 'mini_game' component in the HDK�s Object |
| Editor. This function is only valid for the following callbacks: on_add_player on_remove_player on_local_playerJoin on_local_player_leave |
| Examples |
| function OnRemovePlayer() |
| slot = MiniGame.GetCurrentFocusPlayerSlot() |
| print( "Player slot of departing player: " . |
| end |
| slot) |
| See Also |
| � MiniGame.GetCurrentFocusPersonld |
| MiniGame.GetJoinType |
| Brief |
| Get the current join type of the minigame. |
| Definition |
| JoinType MiniGame.GetJoinType() |
| Arguments |
| None |
| Return Values |
| The join type of the minigame. |
| Description |
| Get the current join type of the minigame. |
| Examples |
| ! if (MiniGame.GetJoinType() == JoinType.Auto) then |
| MiniGame.SetJoinType(JoinType.Normal) |
| | end |
| See Also |
| � MiniGame.SetJoinType |
| MiniGame.GetMaxPlayerSlots |
| Brief |
| Returns the maximum number of player slots in the mini-game. |
| Definition |
| ! number MiniGame.GetMaxPlayerSlots() |
| Arguments |
| None |
| Return Values |
| The maximum number of player slots in the mini-game. |
| Description |
| Returns the maximum number of player slots in the mini-game. Not all of these necessarily get filled. Imagine a roulette table with 20 seats (the |
| player slots), where only a maximum of 8 people are allowed to play at any one time. |
| Examples |
| ! print( "The max player slots are " .. MiniGame.GetMaxPlayerSlots() ) |
| See Also |
| � MiniGame.GetCurrentFocusPlayerSlot |
| � MiniGame.GetPlayerSlotUsedByPersonld |
| MiniGame. GetNumberOfUsedPlayerSlots |
| Brief |
| Returns the number of people currently joined to the mini-game. |
| Definition |
| ! number MiniGame.GetNumberOfUsedPlayerSlots() |
| Arguments |
| None |
| Return Values |
| The number of people currently joined to the mini-game. |
| Description |
| Returns the number of people currently joined to the mini-game. Each person takes one player slot. |
| Examples |
| ! print( "Player slot count = " .. MiniGame.GetNumberOfUsedPlayerSlots() ) |
| See Also |
| � MiniGame.GetCurrentFocusPlayerSlot |
| � MiniGame.GetPlayerSlotUsedByPersonld |
| MiniGame.GetPersonldFromPlayerSlot |
| Brief |
| Returns the person ID of the given player slot. Note: Slots start from 0 (e.g. first player slot is 0, second is 1, etc). |
| Definition |
| ! string MiniGame.GetPersonldFromPlayerSlot( number playerSlot ) |
| Arguments |
| playerSlot - The player slot in question. |
| Return Values |
| The person ID of the given player slot. |
| Description |
| Returns the person ID of the given player slot. |
| Examples |
| print( "Person id of slot 0 is " .. MiniGame.GetPersonldFromPlayerSlot( 0 ) ) |
| See Also |
| � MiniGame.GetCurrentFocusPlayerSlot |
| � MiniGame.GetPlayerSlotUsedByPersonld |
| MiniGame.GetPlayerSlotUsedByPersonld |
| Brief |
| Returns the player slot of the specified person id. |
| Definition |
| number MiniGame.GetPlayerSlotUsedByPersonld( string personld ) |
| Arguments |
| personld - Person id of an avatar that has joined the mini-game. |
| Return Values |
| The player slot of the specified player person id. |
| Description |
| Returns the player slot of the specified person id. Returns -1 if the person does not have a player slot. |
| Examples |
| j localPlayerld = LocalPlayer.GetPersonld() |
| i if MiniGame.IsPersonJoined( localPlayerld ) then |
| slot = MiniGame.GetPlayerSlotUsedByPersonld( localPlayerld ) |
| print( "I am playing the game and my slot is " .. slot ) |
| i end |
| See Also |
| � LocalPlayer.GetPersonld |
| � MiniGame.IsPersonJoined |
| MiniGame.GetQueueSize |
| Brief |
| Used to determine the length of this mini game's queue. |
| Definition |
| number MiniGame.GetQueueSize () |
| Arguments |
| None |
| Return Values |
| Size of the queue. |
| Description |
| Returns the current size of the queue. Note: the accuracy of this value may fluctuate slightly depending on network traffic and timings etc. |
| Examples |
| if MiniGame.GetQueueSize() > 10 then |
| TellCurrentPlayersToHurryUp() |
| end |
| See Also |
| None |
| MiniGame.GetTriggerRadius |
| Brief |
| Gets the mini-game's trigger radius. |
| Definition |
| number MiniGame.GetTriggerRadius() |
| Arguments |
| None |
| Return Values |
| The mini-game�s trigger radius. |
| Description |
| Gets the mini-game's trigger radius in meters. This is the radius from the game position that the player must be within in order to have the option |
| to join. |
| Examples |
| j p = Object.GetlnitialPosition( Object.GetMe() ) |
| i r = MiniGame.GetTriggerRadius() |
| j print( "Game located at " .. p .. " with trigger radius " .. r ) |
| See Also |
| � Object.GetlnitialPosition |
| � Object.GetMe |
| MiniGame.IsAbleToChangeCustomExitMenuOption |
| Brief |
| Determines if a custom menu option can currently be added to the Exit Menu. |
| Definition |
| MiniGame.IsAbleToChangeCustomExitMenuOption() |
| Arguments |
| None |
| Return Values |
| Whether a custom menu option can currently be added to the Exit Menu. |
| Description |
| Changing the custom menu option while the Exit Menu is visible is not user friendly and is therefore restricted. This function can be used to |
| determine when 'AddCustomExitMenuOption' and 'RemoveCustomExitMenuOption' will fail. |
| Examples |
| ! MiniGame.IsAbleToChangeCustomExitMenuOption() |
| See Also |
| � MiniGame. AddCustomExitMenuOption |
| � MiniGame. RemoveCustomExitMenuOption |
| MiniGame. IsPersonJoined |
| Brief |
| Returns true if the specified person has joined and false otherwise. |
| Definition |
| 1 boolean MiniGame.IsPersonJoined( string personld ) |
| Arguments |
| personld - The ID of the person. |
| Return Values |
| true if the specified person has joined and false otherwise. |
| Description |
| Returns true if the specified person has joined and false otherwise. |
| Examples |
| ! print( MiniGame.IsPersonJoined( LocalPlayer.GetPersonld() ) ) |
| See Also |
| � LocalPlayer.GetPersonld |
| MiniGame.IsSessionOpen |
| Brief |
| Returns true if the minigame network session is currently open. |
| Definition |
| ! boolean MiniGame.IsSessionOpen() |
| Arguments |
| None. |
| Return Values |
| True if the network session is open, or false if closed. |
| Description |
| Returns true if the minigame network session is currently open. An open session will accept new player entry and a closed session will not. |
| Examples |
| ! if (MiniGame.IsSessionOpen() and MiniGame.IsSessionOwner()) then |
| MiniGame.CloseSession() |
| j end |
| See Also |
| � MiniGame.OpenSession |
| � MiniGame.CloseSession |
| � MiniGame.IsSessionOwner |
| MiniGame.IsSessionOwner |
| Brief |
| Returns true if the current player is the minigame network session owner. |
| Definition |
| ! boolean MiniGame.IsSessionOwner() |
| Arguments |
| None. |
| Return Values |
| True if the current player is the network session owner, or false otherwise. |
| Description |
| One player is designated as the network session owner for the minigame at all times. This function can be used to identify this player. |
| Examples |
| j if (MiniGame.IsSessionOwner()) then |
| print("I own this game.") |
| I end |
| See Also |
| � MiniGame.OpenSession |
| � MiniGame.CloseSession |
| � MiniGame.lsSessionOpen |
| MiniGame.LocalPlayerLeaveGame |
| Brief |
| Triggers the local player to leave the mini-game. |
| Definition |
| ! MiniGame.LocalPlayerLeaveGame() |
| Arguments |
| None |
| Return Values |
| None. |
| Description |
| Triggers the local player to leave the mini-game. This will cause the function associated with the 'on_local_player_leave' property of the |
| 'mini_game' object component to be called. |
| Examples |
| function OnRemovePlayer() |
| � If one player leaves the game, force everyone else to leave too |
| me = LocalPlayer.GetPersonld() |
| if (MiniGame.IsPersonJoined( me ) then |
| MiniGame.LocalPlayerLeaveGame() |
| end |
| end |
| See Also |
| � LocalPlayer.GetPersonld |
| � MiniGame.IsPersonJoined |
| MiniGame.OpenSession |
| Brief |
| Open the minigame network session to new player entry. |
| Definition |
| MiniGame.OpenSession () |
| Arguments |
| None. |
| Return Values |
| None. |
| Description |
| Open a closed session to allow new players to join. Calling this on an already open session will have no effect. Only the session owner may call |
| this function, otherwise a Lua error will occur. |
| Examples |
| ! if (MiniGame.IsSessionOwner() and not MiniGame.IsSessionOpen()) then |
| MiniGame.OpenSession () |
| | end |
| See Also |
| � MiniGame.CloseSession |
| � MiniGame.IsSessionOwner |
| � MiniGame.IsSessionOpen |
| MiniGame. RemoveCustomExitMenuOption |
| Brief |
| Remove the custom menu item from the Exit Menu for the mini-game (if one has been added). |
| Definition |
| ! MiniGame.RemoveCustomTargetMenuOption(string optionText) |
| Arguments |
| None |
| Return Values |
| None. |
| Description |
| This removes the custom menu option in the mini-game's Exit Menu, if one has previously been added. |
| Examples |
| ! MiniGame.RemoveCustomExitMenuOption() |
| See Also |
| � MiniGame. AddCustomExitMenuOption |
| � MiniGame. IsAbleToChangeCustomExitMenuOption |
| MiniGame.SetJoinType |
| Brief |
| Set the join type of a minigame. |
| Definition |
| MiniGame.SetJoinType(JoinType type) |
| Arguments |
| type - The join type to use (JoinType.Normal, JoinType.Auto, JoinType.Minimal). |
| Return Values |
| None. |
| Description |
| Set the join type of a minigame. If the user is within range and the join type is changed to JoinType.Auto, the user will automatically join the game. |
| Examples |
| ! MiniGame.SetJoinType(JoinType.Normal) |
| See Also |
| � MiniGame.GetJoinType |
| MiniGame.SetLocalPlayerExcludeMessage |
| Brief |
| Set the message to be displayed if the minigame prevents the local player from joining. |
| Definition |
| ! MiniGame.SetLocalPlayerExcludeMessage( string message ) |
| Arguments |
| message - the localized string to display, or an empty string to display the default message |
| Return Values |
| None. |
| Description |
| If the minigame implements the on_can_local_playerJoin callback, it is able to return false to indicate that the local player may not join at this |
| time. This may be due to the game being busy or unable to accept new players at this time (for example, if a race is in progress). This function |
| allows the script to specify a message to be displayed to the user in this event to clarify the reason for the game not being joinable, and when it |
| will become available again. The function can be called from anywhere in the script and the message will remain active until set to another |
| message. Note that if queueing is enabled, this function will raise an error. |
| Examples |
| function OnCanLocalPlayerJoin() |
| if (RacelnProgress()) then |
| local msg = Object.GetMe():GetLocalizedText("RACE_IN_PROGRESS") |
| MiniGame.SetLocalPlayerExcludeMessage(msg) |
| return false |
| end |
| return true |
| end |
| See Also |
| None |
| MiniGame.SetSafeToSendWelcomeMessage |
| Brief |
| Use this function to allow the mini-game to send welcome messages. |
| Definition |
| MiniGame.SetSafeToSendWelcomeMessage( boolean value = true ) |
| Arguments |
| value - true or false. Defaults to true. |
| Return Values |
| None. |
| Description |
| Use this function to allow the mini-game to send welcome messages (if using welcome messages in the mini-game). As an example, a Pool game |
| will not want to send welcome messages when the balls are moving. So, you should set to true at all times other than when the balls are moving. |
| Examples |
| ! function OnUpdateO |
| � Always safe for the mini-game to send a welcome message |
| MiniGame.SetSafeToSendWelcomeMessage( true ) |
| I end |
| See Also |
| � MiniGame.ConfirmReceivedWelcomeMessage |
| � MiniGame. DisableWelcomeMessages |