Forum Discussion
Jump to Slide %Variable%
Nathan. thanks for your input. But I can't seem to retrieve any built-in variables whatsoever. I can retrieve project variables using GetVar. All built-in variables return NULL values.
var player = GetPlayer();
var anyVariable = player.GetVar("Slide.Id");
alert( anyVariable );
The built-in variable for the slide ID is "Slide.Id" that returns NULL. I have tried other built-in variables and all return NULL.
If I use a project variable, it works correctly. Any idea why I can't retrieve built-in variables with JavaScript? I can retrieve those variables slides by typing %Slide.Id%
Thanks
I don't think you can (or I don't know how) in JavaScript. To read or assign a built-in variable, you need to do it via a trigger in Storyline. That's why I suggested creating new variable slideID in SL. Set it equal to Slide.Id in a trigger, or set the value manually. You can also manually set up an array of text values in JavaScript and set it there.
- GarrisonWilliam3 months agoCommunity Member
How do you set a project variable equal to the value of a built-in variable?
- Nathan_Hilliard3 months agoCommunity Member
- GarrisonWilliam3 months agoCommunity Member
On the first slide I have a trigger to set variable slideID=Slide.Id on Timeline Start.
I can confirm that the variable is set correctly.
On the last slide I have trigger/button with this javascript:
var slideID = GetPlayer().GetVar("slideID");
GetPlayer().JumpToSlide(slideID);This is not working. I've tried using Project.SlideNumber and fixed values for the JumpToSlide function but nothing works. Am I missing something?
Thanks.
- Nathan_Hilliard3 months agoCommunity Member
See this example. Slides 1 and 3 do as you described above. Also includes some buttons and JavaScript on the Master slide as an example of jumping from an array list of IDs.