Forum Discussion
Center Click Trigger
For posterity's sake, that script didn't fully work, but this one did with a newly created variable called CenterClick:
// Get the player object
var player = GetPlayer();
function incrementCenterClick() {
// Get the Articulate Storyline player
var player = GetPlayer();
// Get the current value of the CenterClick variable from Storyline
var centerClickValue = player.GetVar("CenterClick");
// Increment the value by 1
centerClickValue += 1;
// Set the new value back to the CenterClick variable in Storyline
player.SetVar("CenterClick", centerClickValue);
// Optional: Log the new value to the console
console.log("CenterClick count is now:", centerClickValue);
}
// Add event listener for middle mouse button click
document.addEventListener('mousedown', function(event) {
// Check if the middle mouse button (button code 1) was clicked
if (event.button === 1) {
incrementCenterClick();
// Optional: Prevent the default action of the middle mouse button click
event.preventDefault();
}
});