Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Help Fixing Flip Tokens Script

Just trying to implement a 2-year old script to flip tokens repeatedly without right-clicking.  The sandbox is sending back a slew of error messages that I don't know how to interpret.  Here's the script: var bshields = bshields || {}; bshields.flip = (function() { 'use strict'; var version = 2.3, commands = { flip: function(args, msg) { var selected = msg.selected; if (!selected) { return; } _.each(selected, function(obj) { var token = getObj('graphic', obj._id); if (token) { if (args.length === 0) { token.set('fliph', !token.get('fliph')); } else { _.each(args, function(arg) { if (arg.toLowerCase() === 'horizontal') { token.set('fliph', !token.get('fliph')); } else if (arg.toLowerCase() === 'vertical') { token.set('flipv', !token.get('flipv')); } }); } } }); }, help: function(command, args, msg) { if (_.isFunction(commands['help_' + command])) { commands['help_' + command](args, msg); } } }; function handleInput(msg) { var isApi = msg.type === 'api', args = msg.content.trim().splitArgs(), command, arg0, isHelp; if (isApi) { command = args.shift().substring(1).toLowerCase(); arg0 = args.shift() || ''; isHelp = arg0.toLowerCase() === 'help' || arg0.toLowerCase() === 'h'; if (!isHelp) { if (arg0) { args.unshift(arg0); } if (_.isFunction(commands[command])) { commands[command](args, msg); } } else if (_.isFunction(commands.help)) { commands.help(command, args, msg); } } else if (_.isFunction(commands['msg_' + msg.type])) { commands['msg_' + msg.type](args, msg); } } function registerEventHandlers() { on('chat:message', handleInput); } return { registerEventHandlers: registerEventHandlers }; }()); on('ready', function() { 'use strict'; bshields.flip.registerEventHandlers(); }); And here's the error text: TypeError: msg.content.trim(...).splitArgs is not a function TypeError: msg.content.trim(...).splitArgs is not a function at handleInput (apiscript.js:1184:39) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1634:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400 The script is "Flip Tokens" by Lithl.  Hope somebody can help - thanks!
1524748102
The Aaron
Pro
API Scripter
There is another script called "SplitArgs" that is required for this one to work. It's in the repo also.
Right on - fixed, thank you!