
This is a tiny little snippet. I wanted an audio notification for the players when a page changes. It makes for a nice presentation and cues their attention. This script will play a sound from your jukebox whenever you move the player flag. If there is a jukebox track already associate with the page, that track will play instead of the script track.
To use it, replace the title definition below from 'Page Load' to the name of the track you want. Spelling and capitalization must be exact. The script will make a log message if the track name is incorrect or missing, but otherwise, it will make no in-game fuss.
One last thing: choose a short sound. If the track has not finished before you move the page flag again, the sound will not restart.
Here is a little video of it in action.
on('change:campaign:playerpageid', function() {
let track = findObjs({
type: 'jukeboxtrack',
title: 'Page Load'
})[0];
if (track) {
track.set('softstop', false);
track.set('playing', true);
} else {
log('PageSound cannot find track. Check to make sure spelling is correct');
};
});