Monday, February 26, 2018

Idle Engine: Javascript for our Virtual Tabletops

We are happy to announce that Idle Engine, our Javascript engine, has been integrated for use in Mote.

It will take some more updates to translate all of the functions of the Motescript API in order for them to work in Javascript, but this shouldn't take too long.

A discussion thread was opened for this feature, where the rolling list of function conversions, can also be found.

Javascript (JS) brings with it faster script execution speeds. It also makes our VTTs more accessible to a large number of users that are versed with the Javascript language. JS is also (arguably) a much easier language to learn over Mote's inherent scripting system, which many say holds a lot of idiosyncrasies not found in "popular" scripting languages. 

Some may say that other languages are more suited for scripting within the JVM (Groovy, for example). But the choice for Javascript was based on its relevance to the heavy use of HTML forms and views (e.g. in character sheets, input forms etc, as well as JSON, which is the main data structure used within our applications.

Like our earlier blog post on HTML5, this post will change over time, as the Javascript feature matures. Do come by from time to time, to keep up with any updates we make :)

How to write and use Javascript macros:

  • Mote's Javascript feature is only available to subscribers of Sandstorm's Full-feature plan. Full-feature users are able to write macros using JS.
  • Clients connecting to sessions hosted by Full-feature subscribers, can run these macros, without needing to be subscribed to the Full-feature plan.
  • You create a JS macro in the usual ways Motescript macros are made; either by making a macro button, or by using script.
  • In order for Mote to know where to send the script, you have to make sure you set the macro content type to "Javascript".
  • This property can be accessed via the Macro Properties Panel, which is integrated into the Macro Editor. You can open this panel up by hitting F5, or by clicking the 1st button, top-left, on the editor's toolbar.
  • Before you start writing your script, do remember to set code completion, appropriately. You can do this by selecting Javascript on the dropdown menu on the editor toolbar. By default, it's set to Motescript.

Things to note:

  • Do not expect JS macros to behave exactly as those written in Motescript. Idle Engine has no relation to the Motescript scripting language and parser.
  • For long-time Motescript writers, JS does not employ any of the delay/deferment tricks of Motescript i.e. context.delay, etc.
  • Script events, like onCampaignLoad, have not yet been converted. Rest assured, this will be tackled soon.
  • JS is single-threaded. While it is possible to open up multi-threading, this will not be tackled anytime soon.
  • Invoking other macros, is not yet possible, because the relevant bits that enables this in Motescript, have yet to be converted. This will be tackled soon. 
  • This feature fully functionaly, but is not yet mature, and will need community input, in order to make it the best it can be. We'll also work as fast as the community is interested in this.

Video Hangouts

Subscribers to Sandstorm's Full-feature plan can now host video hangouts in their sessions! When creating a server, just make sure you...