While running, Cenario content detects if it is iframed within another project, for example in a Lectora, Captivate, or Storyline course, and posts messages to its parent detailing what is happening in the content. All messages are posted as JSON, and are indexed by the “type” data member. The following messages are passed:

Attempted

Sent once at the start of a session

  • type - cenariovr:attempted
  • scenario - (name of scenario)

Experienced

Sent for each time a scene is visited

  • type - cenariovr:experienced
  • scenario - (name of scenario)
  • scene - (name of scene)
  • duration - (# of seconds in scene)

Clicked

Sent each time an object is clicked on in a scene

  • type - cenariovr:clicked
  • scenario - (name of scenario)
  • scene - (name of scene)
  • object - (name of object clicked on)

Answered

Sent each time a question is answered

  • type - cenariovr:answered
  • scenario - (name of scenario)
  • scene - (name of scene)
  • questname- (name of question)
  • questtext - (text of question)
  • choicetext - (text of selected choice)
  • iscorrect - (true or false)
  • duration - (# of seconds to answer question)

Finish

Sent once at the completion of a session

  • type - cenariovr:finish
  • scenario - (name of scenario)
  • score - (percentage relative to 100)
  • result - (completed,passed,failed)
  • duration - (# of seconds to complete scenario)


Sample JavaScript to catch messages from CenarioVR content

window.addEventListener('message', function(event) {
   var data = JSON.parse(event.data);
   var messagedatatype = data.type;
   if (messagedatatype=='cenariovr:attempted') {
           console.log("Scenario Attempted: " + data.scenario);
   }else if (messagedatatype=='cenariovr:experienced') {
           console.log("Scene Experienced: " + data.scene + ", Duration: " + data.duration );
   }else if (messagedatatype=='cenariovr:clicked') {
           console.log("Hotspot Clicked: " + data.object );
   } else if (messagedatatype=='cenariovr:answered') {
           console.log("Question Answered: " + data.questname + ", Correct: " + data.iscorrect  + ", Duration: " + data.duration );
   } else if (messagedatatype=='cenariovr:finish') {
          console.log("Scenario Finished: " + data.scenario + ", Score: " + data.score + ", Result: " + data.result + ", Duration: " + data.duration);
   }
} );