Sorry, I forgot that let is a strict-mode-only keyword, and I forgot the parse/stringify the turn order. Try this one: on('chat:message', function(msg) {
'use strict';
if (msg.type !== 'api' || msg.content !== '!sort') return;
let order = Campaign().get('turnorder');
if (order.length) {
order = _.sortBy(JSON.parse(order), (t) => -parseInt(t.pr));
}
Campaign().set('turnorder', JSON.stringify(order));
});
(Swapping -parseInt for parseInt as needed to get the ordering you're looking for)