Synaptop API
The Syanptop API object can allow a game to use functionality when run as an application on Synaptop. It is highly recommended that any application you create for Synaptop use this plugin. All applications in Synaptop have the ability to add "subscribers", as is set up in Synaptop's Developer.To learn how to install and a tutorial on using this plugin go Set up tutorial. You can also read more about the API (not the plugin) at www.synaptop.com/developers/api
Important To Export: When using the plugin, it is required to modify construct's exported html file (index.html in the folder you exported to). If you modified the html export files as recommended in the install instructions the only required change on export is to fill in the APP ID in index.html. You will find this near the bottom of the <head> section, which should be around line 60.
The Small Text: This plugin works best when ran on Synaptop's API. It can be run natively on the web, but you won't be able to use any of this plugin's benefits while doing so. It cannot be tested on Construct 2's local host test driver.
Synaptop Conditions
API Loaded
Short form: This trigger is called once the Synaptop API is done loading.Long form: When the Synaptop API is added to a project, the plugin automatically loads the API and calls synaptop.loaded(function(response){/*Code here*/}). In this function it sets up the triggers for On Subscriber, On Disconnect and Receive Message, as well as setting the initial stat of the expressions numSubscribers, UserAgent and Device. This trigger gets called once all of these things are set up and initialized.
Question Answered
This trigger gets called when a question given by the "Prompt question" action, was answered. You can use this in conjunction with the "Answer" condition to determine if the user answered the question yes or no.Answer
This returns true if the user answered a yes/no question as "Yes" or the ok/cancel question as "Ok". It returns false if they answered "No" or "Cancel" respectively.On New Subscriber
This trigger gets called whenever a new subscriber joins the application. This also updates the values returned by the expressions lastSubscriberName and lastSubscriberID.On Subscriber Disconnect
This trigger gets called whenever a subscriber leaves the application.Receive Message
This trigger gets called when the app detects an incoming broadcast from another subscriber. Use the lastMessage expression to get the contents of this broadcast.Get Friends Complete
This trigger gets called the app has completed the call of Get Online Friends. The data can be retrieved from the expressions NumFriends, FriendName and FriendID.File Selected
This trigger gets called when the user exits the open file dialogue, whether it be because they selected a file to open or by selecting cancel. This can be used in conjunction with the Valid File condition to determine if they actually did select a file to open.Valid File
This condition returns true if the user selected a file with the Open File action. If a valid file was selected, this updates the Filename, Extension and FileURL expressions.Synaptop Actions
Close App
This closes the application.Message
This creates a message box within Synaptop to display the message passed to it.Open File
This allows the user to pick a file from their Synaptop to open. It can be passed a specific file type to allow or allow any file type to be opened.Open URL
This opens a page in Synapnet with the URL specified.Prompt Question
This prompts a yes/no or ok/cancel dialog. Once the user selects an answer the Question Answered condition triggers and the Answer condition determines if the user selected yes/ok or no/cancel.Broadcast
This broadcasts a packet to all subscribers, or a subset there of. This can be used in conjunction with the Receive Message condition to achieve a networked game or application.The recipients string currently does nothing, all broadcasts are sent to all subscribers.
