// copyright (c) 2018 humbletim var sound = SoundCache.getSound('http://hifi-content.s3.amazonaws.com/wadewatts/hey%21.wav'); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"), button = tablet.addButton({ icon: SVG(), text: 'Hey', }); button.clicked.connect(function() { if (button.getProperties().isActive) { return; } button.editProperties({ isActive: true }); Audio.playSound(sound, { position: Vec3.sum(MyAvatar.position, Quat.getForward(MyAvatar.orientation)), volume: 0.15, localOnly: false }) .finished.connect(function() { button.editProperties({ isActive: false }); }); }); Script.scriptEnding.connect(function() { tablet.removeButton(button); }); function SVG() { return 'data:image/svg+xml;xml,'; }