Scripting events in Scenaria


Scenaria supports a simple sandboxed scripting library that allows developers to code simple interactions (onclick onfocusenter etc) into scenes.


In the XML scene definition, the <Hologram> tag is used to define a single hologram asset. Each Hologram (amongst other attributes) has can specify scripts (event handlers) for

  • onload - triggered once the hologram has completed its load routine.
  • onclick - triggered by the user 'air tapping' whilst gazing ta the asset
  • onfocusenter - triggered by the user gazing at the asset
  • onfocusexit - triggered by the user removing their gaze

By attaching a script to each of these you can facilitate some surprisingly complex interactions.

e.g. Adding onclick='LoadScene("http://website.mydomain.net/index.htm") to the XML attributes an asset will cause a new scene to be loaded when the asset is air tapped on to.

So the hologram tag would look like 

<hologram uri="Label" uid="A1"  
                  positionxyz="-0.4,-0.4,3" 
                  text="Home"
                  onclick='LoadScene("http://website.mydomain.net/index.htm")' >
</hologram>


We currently support functions including - 
  • ClickOn - Allows a hologram to programmatically click on another hologram 
  • Get/SetVisibility - Allows one hologram to turn on/off another.
  • GetSystemInfo -returns information (date, time, month, year, serviceurl, deviceid, connected (the connection state), roomid );
  • Label - Allows the text property of a label to be changed.
  • LoadScene
  • LoadSound, PlaySound, StopSound  - Loads and plays a sound (WAV file)
  • StartTimer 

The mini scripting language itself is a high-level object-oriented language that is relatively easy to read and write.

Language Notes- 
  • One statement per line, with no semicolons, except to join multiple statements on one line.
  • Indentation doesn't matter (except for readability).
  • Comments begin with // and the language IS case-sensitive.
  • Variables are all local by default.
  • Currently, program blocks must complete there work within 0.5 sec or they will be stopped (timers may trigger events in the future - those events also must complete with 0.5 secs).
  • The script language supports if/while/for numbers/strings lists etc.
  • We originally intended to use javascript as our scripting language, however, so far we are yet to find a suitable JVM for HL.

For more information on the language  please contact us at support@scenaria.net












Comments

Popular posts from this blog