Forum Discussion
Built-in scene title variable?
Where is the built-in scene title (text) variable?
10 Replies
- BarbaraJacobs-1Community Member
Thank you, Nadim, but I need the scene title. We work with scenes in so many ways, particularly as they apply to accessibility. I need that variable.
- Nathan_HilliardCommunity Member
There doesn't seem to be any built-in variable containing the scene title. I looked quickly through the contents of the .story file and the published output, but nothing appears to be assigned to a variable. I see only a couple of options.
- Create a list of the scene names manually and enter them into SL variables, or into a variable array with JavaScript.
- You could extract the scene name (using JavaScript) from the DOM associated with the player's side menu. This requires that the menu is included in the project. If you publish without the menu, then this information will not be included.
For #2, you can use something like the following;
if(document.querySelector("div.cs-menu")) { let sceneTitle = ( document.querySelector("div.cs-menu") .querySelector(".cs-selected") .parentNode .parentNode .parentNode .querySelector("div.cs-listitem") .querySelectorAll("span")[1] .innerText ) console.log(sceneTitle) GetPlayer().setVar("curSceneTitle", sceneTitle) }
This could probably be condensed, but it is clear this way and CSS selectors are not my strong suit. Sample project attached (script on master slide).
Demo: https://360.articulate.com/review/content/d4d714c4-6f1d-44df-ba4d-ad28b9eaaf82/review
You could also extract the entire list of scene names at once using a slightly different selector, if you wanted them all together.
If you publish your project for web, you can also see a complete text list of scene and slide names in the story_content/frame.xml file, near the end.
- KendalRasnake-1Community Member
I may not understand how everything works, but it seems to me that the SCORM module can communicate scene information to the LMS, at least when it comes to question slides. It may not be one of the built-in variables to which Nedim refers, but the information is there.
When running a SCORM module in troubleshooting mode, something called "strID" seems to capture the Scene number and Slide number. That information can then be seen in an LMS report.
Using some code written by Sam Hammond that I modified, I was able to move the Scene and Slide number info to the Course Objective column and replace the missing Question ID column information with the Question Stem text.
Again, I may not understand how everything works, but is the "strID" something that can be tapped into as the recorder of Scene and Slide # information? Even if it is not a built-in variable, could it be accessed within the Storyline project with a trigger, or with JavaScript and a trigger?
(Images are also attached if the posted ones are too small to see.)
- Nathan_HilliardCommunity Member
There is some additional information about your published project available in the DS object (accessed in JavaScript like a variable as window.DS). Information such as the scene number and the generic scene name (e.g., 'Scene1', 'Scene2', etc.) can be accessed there. It is available with or without the side menu being included as part of the project. The scene title text however does not seem to be stored in there anywhere I could locate.
To access the current scene number or generic scene name as Kendal suggested, you can use these JavaScript lines
let sceneGenericName = window.DS.windowManager.getCurrentWindowSlide().parent.attributes.lmsId let sceneNumber = window.DS.windowManager.getCurrentWindowSlide().parent.attributes.sceneNumber
- NedimCommunity Member
The "strID" parameter in the SCORM2004_RecordInteraction() function is a unique identifier for a learner interaction or question within a SCORM course. It is SCORM 2004 cmi.interactions.n.id data model and it tells the LMS exactly which specific interaction is being recorded, allowing it to track responses, determine correctness, and report analytics.
This parameter is only meaningful and used when:
- The project is published to SCORM 2004
- A quiz or assessment is selected under tracking options during the publish process.
If you don’t publish to SCORM or don’t enable tracking via quiz results, the LMS won’t expect or use this data, and the SCORM2004_RecordInteraction() function, along with its strID, will have no effect.
Example:
function SCORM2004_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime, SCORM2004InteractionType)
So, if I have a quiz question on Scene 2, the strID parameter in the SCORM2004_RecordInteraction() function will typically be set automatically by Storyline when the interaction is tracked. Under the hood, Storyline calls another SCORM function:
SCORM2004_CallSetValue("cmi.interactions." + intInteractionIndex + ".id", strID);
In this particular case "SetValue('cmi.interactions.0.id', 'Scene2_Slide2_TrueFalse_0_0');"
The bottom line, the strID can’t be referenced or displayed on the slide until it becomes available at runtime, which only happens when the first interaction is recorded and the course is running in a SCORM-compatible LMS.
To display a generic scene name, JavaScript isn't necessary. You can simply use a text box with a reference to the built-in project variable, like this: "Scene %Project.SceneNumber%".
- KendalRasnake-1Community Member
Thank you, Nathan.
- KendalRasnake-1Community Member
Thank you, Nedim.