Skip to main content
Jonathan Joosten
Inspiring
May 26, 2016
Answered

variables for attempts

  • May 26, 2016
  • 1 reply
  • 1189 views

why is there a $$cpQuizInfoMaxAttemptsOnCurrentQuestion$$

but no $$cpQuizInfoAttemptOnCurrentQuestion$$

so I could make a reply or feedback massage saying:

"Incorrect, this was attempt 1 of 3."

or maybe a $$cpQuizInfoAttemptsLeftOnCurrentQuestion$$

so you can say:

"Incorrect, you have 2 attempst left."

And no I don't want to make custom code for it, this is more of a feature request.

This topic has been closed for replies.
Correct answer Jonathan Joosten

Not sure why you marked a bug/feature request as correct since Captivate supplies the variable through the Common JS Interface.

If you declare cp in a global scope you would not need to repopulate it. You need to do it in every function because that is where you are declaring it, so it is scoped to that function.


If you look more closelly you can see I dit use it as a global, but somehow it dit not stick.
maybe I should have used: window.cp to get it, but I'm moving forward now.

I was allready looking into the Common JS Interface and how to get the variables without external coding ;-)

if(window.cpAPIInterface)

{

    if(window.cpAPIEventEmitter)

    {

        window.cpAPIEventEmitter.addEventListener("CPAPI_QUESTIONSUBMIT",function(e)

{

window.cpAPIInterface.setVariableValue("currentAttempt",e.Data.questionAttempts);

});

    }

}

This does work from within captivate but unfortunatelly the variables in a retryfield do not update durring a question in flash mode, so it only works properly with html5. 

1 reply

RodWard
Community Expert
Community Expert
May 26, 2016

If this is a feature request, you need to do it through the proper channel using the feature request form on the Adobe website.

This is just a user forum and we didn't design the app.  So we cannot really give you any factual insight as to why a particular System Variable was not included in the more than 70 of them that Adobe DID provide with Captivate.

Jonathan Joosten
Inspiring
May 26, 2016
TLCMediaDesign
Inspiring
May 27, 2016

It's available in the Common JS Interface, put the following script in the head of your html document and create the variable in Captivate "myTries"

var interfaceObj, eventEmitterObj;

window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();
});

function initializeEventListeners()
{
if ( interfaceObj )
{
     if ( eventEmitterObj )
  {
         eventEmitterObj.addEventListener( 'CPAPI_QUESTIONSUBMIT', function ( e )
   {
   
    window.cpAPIInterface.setVariableValue( "myTries", e.Data.questionAttempts )
            });
  }
}
}