
Hey all, new to this scripting so still trying to wrap my mind around it. my attempt is to make a command that will swivel a token 90'. I know it's a basic script but just can't nail it.any help would be awesome!
/**
* If a player or GM uses the `!rotate' command, all graphics they have selected
* will flip horizontally by 90 degrees.
*/
on('chat:message', function(msg) {
if(msg.type == 'api' && msg.selected && msg.content.indexOf('!rotate') == 0)
{
var selectedObjs = msg.selected;
_.each(selectedObjs, function(obj) {
if(obj._type == 'graphic')
{
var token = getObj('graphic', obj._id);
token.set('rotation 90', !token.get('rotation 90'));
}
});
}
})
/**
* If a player or GM uses the `!rotate' command, all graphics they have selected
* will flip horizontally by 90 degrees.
*/
on('chat:message', function(msg) {
if(msg.type == 'api' && msg.selected && msg.content.indexOf('!rotate') == 0)
{
var selectedObjs = msg.selected;
_.each(selectedObjs, function(obj) {
if(obj._type == 'graphic')
{
var token = getObj('graphic', obj._id);
token.set('rotation 90', !token.get('rotation 90'));
}
});
}
})