Skip to main content
Inspiring
March 30, 2023
Answered

Need to write a script for a button that will "leapfrog" over x amount of slides -.but- with caveats

  • March 30, 2023
  • 1 reply
  • 970 views

Hi. I'm stumped, days of daily scripting are long gone, but here's what I want to do:

 

I have several courses that contain the same 4 slides in each course, albeit at different starting slide numbers. In my courses, I have a series of 4 slides.  If the user has seen these slides in a different course, I want them to be able to click a button on the first slide of the 4 to bypass that slide, plus further bypass the next set of 3 slides and go straight to the fifth slide in the series.  (I'd prefer to use a shared script as I need to do this for actually 2 sets of slides)

Since these slides are in multiple courses, there is no telling what the actual slide numbers affected will be - they will be independent per course so I can't just hard code a "jump to slide X".  So, to summarize:

Click a button on slide x (let's say slide 11).  That action will then leap frog over the current slide (11) plus the next 3 more slides (12, 13, 14) and re-enter on slide 15.

I can either used a shared script where I pass in variables, or just hard code the script(s).  The name of the slide I want to jump to will also be different per course, and I've noticed the "Jump to" action requires what appears to be the slide number and title.  I just need to go to the slide number and ignore the title of the slide.

Any hints?  I think that when the user clicks the button I'll need to create a variable and assign it to the System variable cpInfoCurrentSlide (?), then add 3 to said variable, then jump to the slide that is essentially cpInfoCurrentSlide + 4.  (But it doesn't look like I can jump to a variable).

I would appreciate any and all help and/or suggestions.  Thanks!!!  I hope this makes sense.

    This topic has been closed for replies.
    Correct answer Lilybiri

    I may be misunderstand but this is rather easy with an advanced action.  It would look like this:

     

    Expression cpCmndGotoSlide = cpInfoCurrentSlide +3

    The reason I use 3, not 4 is the difference in start value for the index: for cpCmndGotoSlide it starts with 0 whereas cpInfoCurrentSlide starts with 1. For your example cpCmndGotoSlide will go to slide 15 if cpInfoCurrentSlide is 11.

    I am a big fan of shared actions for several reasons. If you want this to be used in multiple courses I would convert it into a Shared action because it is much easier to transfer a shared action from the original project opened as External Library. No parameter is needed if the jump is always over the same number of slides. If it could be another number I would define the number 3 as parameter. Always keep in mind the difference in index.

      

    1 reply

    Lilybiri
    LilybiriCorrect answer
    Legend
    March 30, 2023

    I may be misunderstand but this is rather easy with an advanced action.  It would look like this:

     

    Expression cpCmndGotoSlide = cpInfoCurrentSlide +3

    The reason I use 3, not 4 is the difference in start value for the index: for cpCmndGotoSlide it starts with 0 whereas cpInfoCurrentSlide starts with 1. For your example cpCmndGotoSlide will go to slide 15 if cpInfoCurrentSlide is 11.

    I am a big fan of shared actions for several reasons. If you want this to be used in multiple courses I would convert it into a Shared action because it is much easier to transfer a shared action from the original project opened as External Library. No parameter is needed if the jump is always over the same number of slides. If it could be another number I would define the number 3 as parameter. Always keep in mind the difference in index.

      

    Inspiring
    March 30, 2023

    Thank you so much.  I'll be able to try this out later.  Hope it's ok if I have a follow up.

    Thanks again!

    Lilybiri
    Legend
    March 30, 2023

    Sure, maybe one day you'll have some time to read about what I call 'micro-navigation':

    https://blog.lilybiri.com/micro-navigation-introduction