The Script Interface documentation for the Photon Realtime addon of the Construct Master Collection, for Construct 3.
This is the documentation to use Construct 3's new JavaScript Scripting feature with Photon Realtime.
You can easily access the PhotonRealtime object's interface using the runtime
, from both the event sheet and script.
runtime.objects.Photon.getFirstInstance().createRoom("roomName", "lobbyName", 0);
For more information, please see the scripting documentation of the Sprite object.
You can also subclass instances in a script, please see the subclassing instances documentation for more information.
class Photon extends IPhotonRealtime
{
constructor()
{
super();
}
}
The supported methods and properties to use in Construct 3's scripting feature with Photon Realtime.
- Context - retrieve the current instance of the Photon Realtime object.
- Client - retrieve the current instance's load balancing client.
- Photon - retrieve the global Photon object.
- setUserId (userId)
- setCustomAuthentication (authParameters, authType)
- setHostingType (hostType)
- setSelfHostedAddress (address)
- setRegion (region)
- setAppId (appId)
- setAppVersion (version)
- connect (lobby)
- createRoom (name, lobbyName, lobbyType)
- joinRoom (name, rejoin, createIfNotExists, lobbyName, lobbyType)
- joinRandomRoom (matchMyRoom, matchmakingMode, lobbyName, lobbyType, sqlLobbyFilter)
- disconnect ()
- suspendRoom ()
- leaveRoom ()
- raiseEvent (eventCode, data, interestGroup, cache, receivers, targetActors, webForward)
- changeGroups (action, group)
- webRpc (uriPath, parameters, parametersType)
- findFriends (friends)
- requestLobbyStats ()
- setMyActorName (name)
- setPropertyOfActorByNr (nr, propName, propValue, webForward, checkAndSet, expectedValue)
- setPropertyOfMyRoom (propName, propValue, webForward, checkAndSet, expectedValue)
- setPropsListedInLobby (propNames)
- setMyRoomIsVisible (isVisisble)
- setMyRoomIsOpen (isOpen)
- setMyRoomMaxPlayers (maxPlayers)
- setEmptyRoomLiveTime (emptyRoomLiveTime)
- setSuspendedPlayerLiveTime (suspendedPlayerLiveTime)
- setUniqueUserId (unique)
- setPlugins (plugins)
- reset ()
- PlayFabAuthenticate (PlayFabID, PhotonToken)
- GetPhotonAuthToken ()
- SetMasterClient (actorNr)
- SyncServerTime ()
- UpdateRoundTripTime ()
- joinRandomOrCreateRoom (matchMyRoom, matchmakingMode, lobbyName, lobbyType, sqlLobbyFilter, roomName)
- isConnectedToNameServer ()
- isConnectedToMaster ()
- isInLobby ()
- isJoinedToRoom ()
- ErrorCode ()
- ErrorMessage ()
- State ()
- StateString ()
- UserId ()
- MyActorNr ()
- MyRoomName ()
- EventCode ()
- EventData ()
- ActorNr ()
- RoomCount ()
- RoomNameAt (i)
- RoomMaxPlayers (name)
- RoomIsOpen (name)
- RoomPlayerCount (name)
- RoomProperty (name, propName)
- PropertyOfMyRoom (propName)
- ActorCount ()
- ActorNrAt (i)
- ActorNameByNr (nr)
- PropertyOfActorByNr (nr, propName)
- ChangedPropertiesCount ()
- ChangedPropertyNameAt (i)
- MasterActorNr ()
- WebRpcUriPath ()
- WebRpcResultCode ()
- WebRpcData ()
- FriendOnline (name)
- FriendRoom (name)
- LobbyStatsCount ()
- LobbyStatsNameAt (i)
- LobbyStatsTypeAt (i)
- LobbyStatsPeerCountAt (i)
- LobbyStatsGameCountAt (i)
- AppStatsPeerCount ()
- AppStatsMasterPeerCount ()
- AppStatsGameCount ()
- PhotonToken ()
- GetRoundTripTime ()
- GetServerTime ()
The API documentation only shows the methods with its parameters, sometimes this is not enough to fully understand each use of the references. To solve that, use the Photon Realtime addon as reference.
Instructions
- For text parameters, use
string
values. - For number parameters, use
int
orfloat
values. - For combo parameters, use the placement of the drop-down selection, starting from
0
. - For toggle parameters, use
boolean
values.