The Script Interface documentation for the Photon Chat addon of the Construct Master Collection, for Construct 3.
This is the documentation to use Construct 3's new JavaScript Scripting feature with Photon Chat.
You can easily access the PhotonChat object's interface using the runtime
, from both the event sheet and script.
runtime.objects.PhotonChat.getFirstInstance().publishMessage("channelName", "message");
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 IPhotonChat
{
constructor()
{
super();
}
}
The supported methods and properties to use in Construct 3's scripting feature with Photon Chat.
- Context - retrieve the current instance of the Photon Chat object.
- Client - retrieve the current instance's load balancing client.
- Photon - retrieve the global Photon object.
- setUserId (userId)
- setCustomAuthentication (authParameters, authType)
- setRegion (region)
- setAppId (appId)
- setAppVersion (version)
- connect ()
- disconnect ()
- subscribe (channelNames, historyLength, lastIds)
- unsubscribe (channelNames)
- publishMessage (channelName, content)
- sendPrivateMessage (userId, content)
- addFriends (userIds)
- removeFriends (userIds)
- setUserStatus (statusOption, status, messageOption, statusMessage)
- reset ()
- PlayFabAuthenticate (PlayFabID, PhotonToken)
- GetPhotonAuthToken ()
- isConnectedToNameServer ()
- isConnectedToFrontEnd ()
- Result ()
- ErrorCode ()
- ErrorMessage ()
- State ()
- StateString ()
- UserId ()
- Channel ()
- Message ()
- Sender ()
- UserStatusUserId ()
- UserStatus ()
- UserStatusString ()
- UserStatusMessageUpdated ()
- UserStatusMessage ()
- ChannelLastMessageID (channelName)
- PhotonToken ()
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 Chat 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.