Skip to main content
Participating Frequently
July 17, 2015
Answered

Creating conditional action for clicking a button twice

  • July 17, 2015
  • 3 replies
  • 530 views

I want an action to happen when the learner clicks a button ONCE. I also want a different action when the learner clicks the same button TWICE.  How can I do this with a conditional action?

This topic has been closed for replies.
Correct answer RodWard

Conditional Actions have sections called Decision Blocks, each of which has a condition that must be met in order for the actions underneath it to be executed.

So in your case you would need three decision blocks and you'll also need a counter variable that is set to 0 by default.

The first decision block has a dummy condition (as you stated above) that will always be TRUE.  IF 1 is equal to 1 is a good example of a dummy decision.

The action underneath this dummy condition should be to INCREMENT your counter variable by 1.  (You can also use an EXPRESSION action but that's a little more complex.)

This INCREMENT action will always be executed every time the Conditional Action is executed.

Your next Decision Block's condition checks the value of your Counter variable and if it has been set to a value of 1 at this point then it will execute whatever action you deem appropriate for that.

Your third Decision Block's condition checks the value of the Counter for a value of 2 (meaning it has been incremented twice) and if so executes a different action of your choosing.

You could keep going this way almost indefinitely specifying differing actions for different values of the counter.  However, at some point you may want to use a different action to reset the counter again.  For example, you may have a Decision Block at the end of the sequence in this same Conditional Action that will check the Counter variable and if it has reached a certain number (e.g. three) then will reset it back to 0 or 1.

3 replies

VivintAuthor
Participating Frequently
July 20, 2015

I finally get it!! I don't know why it didn't make sense before.  Thanks Lilybiri and RodWard.  This is a very foreign concept to me and it takes it while for me to understand the reasoning behind this stuff so I really appreciate your quick replies and willingness to help.

Lilybiri
Legend
July 21, 2015

If you want some inspiration, have a look at my blog, lot of examples. Here is a simple one, based on debugging a conditional action for a user:

Blog after Posterous? - ClickClick - Captivate blog

VivintAuthor
Participating Frequently
July 20, 2015

So I have 3 decision blocks now. 

  • v_counter has a value of 0
  • v_attempt has a value of 1
  • v_attempt 2 has a value of 2

Once again, the "Click once" decision block works well, but it's not registering the second decision block. I'm trying to apply what you guys have told me, but I'm utterly confused

Lilybiri
Legend
July 20, 2015

I told you to wait for Rod Ward, because I would have done it differently. I just explained that you didn't do what he told.

Why creating extra variables? This is much simpler:

   IF v_counter is equal to 1

Lilybiri
Legend
July 17, 2015

You need to track the clicks with a user variable, a counter.

VivintAuthor
Participating Frequently
July 17, 2015

Okay so let's say I create this conditional action. This works fine:

If:

    1 is equal to 1

Then:

    Assign    vButton with 1

    Go to next slide

The problem occurs when I have the learner go to the next slide and will require the learner to come back to this slide where they need to click the same button a second time.  I don't know how to create a conditional action that registers the variable, if clicked twice (on separate occasions), to perform a different action.

Lilybiri
Legend
July 17, 2015

You have to use increment, value of the counter will not change when you get back to the slide. The code you were showing is a standard action, not a conditional action because your condition is always resulting in True. You really need a conditional action and more than one decision.

Maybe someone else will give you a solution, it is midnight here. I know this is perfectly possible.