Skip to main content
Participant
July 30, 2024
Answered

IF/WHILE not working?

  • July 30, 2024
  • 1 reply
  • 544 views

Hi,

I'm working on a pretty simple timer advanced action, but I haven't been having much luck.

I have my advanced action set up to the following:

First tab:

WHILE TestTimer =/= 0, decrement TestTimer by 1.

Second tab:

IF TestTimer = 0, Exit

 

I have my TestTimer variable showing on screen and that's working fine, but it doesn't exit when it reaches zero.

I've tried several variations of this, such as trying to hide/show objects based on TestTimer value within the same advanced action, but have not had any luck so far and it's really confusing me.

    This topic has been closed for replies.
    Correct answer RodWard

    Since you have not stated which version of Captivate you are using, I will assume it is Captivate Classic, 2019.

     

    What event are you using to trigger your action?

     

    If for example you are using the On Slide Enter event to trigger the action, then the action will only trigger once unless you leave the slide entirely and reenter again.  If you are triggering via clicking a button, you need to repeatedly click the button to repeatedly execute the action.

     

    That's the way Captivate interactivity has always worked.

    1 reply

    Participant
    July 30, 2024

    Wait.. is Captivate only checking IF statements once, when the action is called?

    Participant
    July 30, 2024

    Just in case this was the issue, I switched to using one Advanced Action tab, just the WHILE condition.

    While Timer is greater than 0, Decrement Timer by 1.

    That works on its own, but I need to perform actions once it hits 0, so I added javascript action within the While loop, and that doesn't work either (timer no longer counts down - it's just a dumy JavaScript function that only calls console.log).

    I'm starting to think Captivate is just broken.

    RodWard
    Community Expert
    RodWardCommunity ExpertCorrect answer
    Community Expert
    August 1, 2024

    Since you have not stated which version of Captivate you are using, I will assume it is Captivate Classic, 2019.

     

    What event are you using to trigger your action?

     

    If for example you are using the On Slide Enter event to trigger the action, then the action will only trigger once unless you leave the slide entirely and reenter again.  If you are triggering via clicking a button, you need to repeatedly click the button to repeatedly execute the action.

     

    That's the way Captivate interactivity has always worked.