I am building an iOS-game in "Construct 2" and trying to use the Phonegap-plugin "Headset detection" to alert if a Headset is not plugged in.
I am able to create an alert-box (true/falls) to tell if the user has plugged in a headset via this:
<button onclick="window.plugins.headsetdetection.detect(function(detected) {alert(detected)})">headphone detected?</button>
But I am new to javascript, and would like to know:
How do I:
- Only alert if the detection is FALSE? OR (even better):
- Let the above boolean variable set another variable inside Construct 2? (That way I can make other dependancies in my game design)