Difference between revisions of "FBInstant.matchPlayerAsync"
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Available since:''' Gideros 2018.3.1<br/> | + | '''<translate>Available since</translate>:''' Gideros 2018.3.1<br/> |
− | === Description === | + | === <translate>Description</translate> === |
<translate><br /> | <translate><br /> | ||
Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group thread will be created containing the matched players and the player will be context switched to that thread. The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json.<br /> | Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group thread will be created containing the matched players and the player will be context switched to that thread. The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json.<br /> | ||
Line 8: | Line 8: | ||
FBInstant.matchPlayerAsync(matchTag,switchContextWhenMatched,callback) | FBInstant.matchPlayerAsync(matchTag,switchContextWhenMatched,callback) | ||
</source> | </source> | ||
− | === Parameters === | + | === <translate>Parameters</translate> === |
'''matchTag''': (string) <translate>Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. The tag must only include letters, numbers, and underscores and be 100 characters or less in length.</translate> '''optional'''<br/> | '''matchTag''': (string) <translate>Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. The tag must only include letters, numbers, and underscores and be 100 characters or less in length.</translate> '''optional'''<br/> | ||
'''switchContextWhenMatched''': (boolean) <translate>Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context.</translate> '''optional'''<br/> | '''switchContextWhenMatched''': (boolean) <translate>Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context.</translate> '''optional'''<br/> | ||
'''callback''': (function) <translate>A function that will be called with two arguments: True when the player has been added to a group thread and switched into the thread's context. An error code if the function failed.</translate> <br/> | '''callback''': (function) <translate>A function that will be called with two arguments: True when the player has been added to a group thread and switched into the thread's context. An error code if the function failed.</translate> <br/> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Example'''<br/> | '''Example'''<br/> | ||
<source lang="lua"> | <source lang="lua"> |
Revision as of 07:30, 24 August 2018
Available since: Gideros 2018.3.1
Description
Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group thread will be created containing the matched players and the player will be context switched to that thread. The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json.
FBInstant.matchPlayerAsync(matchTag,switchContextWhenMatched,callback)
Parameters
matchTag: (string) Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. The tag must only include letters, numbers, and underscores and be 100 characters or less in length. optional
switchContextWhenMatched: (boolean) Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context. optional
callback: (function) A function that will be called with two arguments: True when the player has been added to a group thread and switched into the thread's context. An error code if the function failed.
Examples
Example
FBInstant.matchPlayerAsync("level1", function(result,error)
print(FBInstant.context.getID()) -- eg 12345
end)
<br/>
Example 2
FBInstant.matchPlayerAsync(nil, function(result,error)
print(FBInstant.context.getID()) -- eg 34567
end)
<br/>