Forum Discussion
Built-in scene title variable?
It's Menu.SlideTitle - the slide's name/title in the player menu.
Reference
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_Hilliard5 months agoCommunity 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.
- BarbaraJacobs-15 months agoCommunity Member
This is great work. I hope the Articulate Engineers can appreciate how our community supports their efforts as well. Lots to go through for the moment.š¤©
- Nedim5 months agoCommunity Member
I understand, but this built-in variable doesn't exist ā and it never has. In my previous post, I included a link to the official list of built-in variables currently available in Storyline. If using JavaScript isn't an issue, Iād go with what Nathan suggested in his post. Here's another snippet you can use on your master slide ā it essentially does the same thing. Other than that, I don't see another solution but to create a custom text variable for the scene name.
const Sidebar = document.querySelector("#sidebar-panels .cs-selected"); const currentSceneName = Sidebar ?.parentNode?.parentNode?.parentNode ?.querySelector(".cs-listitem span:nth-of-type(2)") ?.innerText; setVar("currentSceneName", currentSceneName);
Related Content
- 9 months ago
- 3 months ago
- 9 months ago
- 9 months ago