Copy link to clipboard
Copied
Hi All,
I have a button on a slide with an advanced action attached. I would like to trigger this button when entering the slide i.e. the button automatically gets clicked on slide entry if conditions are met (As advanced actions attached to "On Enter"). I have used cpExtra xcmndCallActionOn but it is not working as attached.
Copy link to clipboard
Copied
Can you explain why it is not possible just to trigger all the commands with the On Enter slide event, by using multiple and conditional decisions? I want first to explore the Captivate route before CpExtra (which I love) because it would be valid for all users. Give some more details please, want to see both the On Enter and that Button action. Please use the Preview Window to take a screenshot, which you can open with this button:
Copy link to clipboard
Copied
The reason is that the button which I want to trigger is included in Quiz (which will pass the points added to total). My understanding is that I can't change the quiz points using advanced actions
Slide Enter Advanced Actions
Button Advanced Actions
Copy link to clipboard
Copied
On Enter if Total Score is greater or equal 80 then I want to trigger the button which calls the actions and go to Next Slide without pausing on the slide. If score is less than 80 then this button is hidden and the slide pauses.
Copy link to clipboard
Copied
I haven't used cpExtra, but I believe it is just firing the Advanced Action attached to the button, not clicking the button itself. Try executong this JS:
document.getElementById("SmartShape_791c").click();
Copy link to clipboard
Copied
@david You don't need to click the interactive object to launch an advanced action attached to it. Just FYI.
Copy link to clipboard
Copied
I understand that, but it does need to be clicked to score the object.
Copy link to clipboard
Copied
That was important missing information. You could have assigned a score to that button, but it would have needed a click to add that score to the quizzing system variables. I didn't know you also used xcmndscore.
This is more a question about CpExtra than about Captivate. I hope Rod Ward or his son pops in here.
You are not using the quizzing system variable cpQuizInfoPointsscored but a custom variable.
Copy link to clipboard
Copied
Yo,
xcmndCallActionOn does not trigger the action by simulating a click on the button. It finds the code attached to the button's success (or failure) action and runs it. From Captivate's POV there was no click.
xcmndScore can change the score on a button so that it will report to the quiz even if it hasn't been clicked. So I would recommend trying to include all your logic in the On Enter Slide Advanced Action. Theoretically, the xcmndCallActionOn is not necessary.
I see that the current assignment to xcmndScore is 'SmartShape_791, myScore1'. Is there a Captivate variable in your project called 'myScore1'? As a test, if you set your Enter Slide action to be an assign action which assigns xcmndScore with 'SmartShape_791, myScore1', does the project score change? When using a variable value in an assignment to a CpExtra command variable it is prefferable to surround the variable name with double dolar signs. So what happens if you assign xcmndScore with 'SmartShape_791, $$myScore1$$'?
I'm not 100% certain on what your desired behaviour is, so I'm running through some ways to potentially diagnose the issue.
Copy link to clipboard
Copied
Thanks, Tristan, for your assistance. I hoped for this, but didn't dare to contact you personally.
Copy link to clipboard
Copied
🤣 It's okay. Sometimes I take a while to respond to an e-mail, but I like answering questions about CpExtra.
It's all good 👍