Difference between revisions of "Script:Flip Tokens"
From Roll20 Wiki
m |
m (235259 moved page User:235259/Flip Tokens to Script:Flip Tokens) |
Revision as of 17:59, 8 January 2015
The following script creates the API command !flip
Syntax
!flip
Code
/** * If a player or GM uses the `!flip' command, all graphics they have selected * will flip horizontally. Try creating a macro button for this and making it * visible to all players! */ on('chat:message', function(msg) { if(msg.type == 'api' && msg.selected && msg.content.indexOf('!flip') == 0) { var selectedObjs = msg.selected; _.each(selectedObjs, function(obj) { if(obj._type == 'graphic') { var token = getObj('graphic', obj._id); token.set('fliph', !token.get('fliph')); } }); } });