Conditional slide jump programmatically
Nov 17, 2020
Hi every one, I'd like your help on this subject.
I need to make a flow in which when pressing a button redirects to a specific slide according to current time (dynamic clock).
Example: If i am at slide 8:00 and press a button that adds 30 minutes, the clock should be updated to 8:30 and redirect to slide named 8:30.
Clock is already coded and i can access the variable but i can't redirect to the corresponding slide, i thought that i would be able to do it with javascript but i could't do it.
5 Replies
You probably need js to add the 30 minutes, but you don't need it to redirect to the slide. Change the variable with js (It sounds like you are already doing this) then use a trigger to jump to the correct slide when the variable changes if the value of the variable is == X:XX
Directing the slide with a storyline trigger would be very complicated ... since I have 29 buttons on a page and the time varies between 8:45 am and 5:45 pm, with jumps of 15 min ... for which I would have to do a lot of programming manually, which could be solved more easily with a code javascript.... I already have the dynamic clock variable, the minutes are added correctly.
What do the 29 buttons do?
Each button is a task to develop. Each task adds time and makes you advance to another slide with other tasks to select. Tasks are repeated at specific times throughout the day. I could program the variables manually with the triggers, but my idea is to save a bit of time, and to do it in an easier way with a javascript code as I did in the dynamic clock.
If you check the code in ds-slides.min.js you will find quite some code leading you to a solution how to do things programmatically with Storyline.
Basically Articulate creates a slide as a Javascript file in a folderstructure like: 'output > html5 > data > js"
If you make a simple title with a few slides after publishing and unminifying and searching in ds-slides.min.js you find functions like
getCurSlidePromise, rebuildCurSlide
and more.A slide gets an id at some point. In ds-slides.min.js i found a function called getFirstSlide. Adding there a
console.log(" getFirstSlide:"+e.length);
shows when published the amount of slides..So next you need to find your slides ids. After some searching i found that by adding a
console.log("getSlide.id: "+t.props.model.getSlide().id);
at some point.The ids of my pages were the same as the names of the js-files in my 'data > js"-folder.
I dont have time to find exactly how Storyline handles this, but what i found sofar is that those ids are called at some point when going to a slide... a function i found for that is:
g.trigger(p.request.NEXT_SLIDE, i, t.window)
Other topics like showing/hiding a slidelayer or triggering a state i also found relevant entries in the ds-slides.min.js file.Good luck,
Math
This discussion is closed. You can start a new discussion or contact Articulate Support.