Skip to content

Instantly share code, notes, and snippets.

@shdwjk
Last active October 17, 2015 14:31
Show Gist options
  • Save shdwjk/075beec63a1e0ff085c7 to your computer and use it in GitHub Desktop.
Save shdwjk/075beec63a1e0ff085c7 to your computer and use it in GitHub Desktop.
Roll20 API: Table Token Sizer -- Simple script to scale rollable tokens added to the tabletop to a given size (defaults to 3x3) an set them as not drawings.
GIST: https://gist.github.com/shdwjk/075beec63a1e0ff085c7
var TableTokenSizer = TableTokenSizer || (function() {
'use strict';
var version = 0.15,
gridSize = 70,
scaleSize = 3,
sizeTableToken = function(obj, prev) {
if('card' !== obj.get('subtype') && obj.get('sides')) {
if( (gridSize * scaleSize) !== obj.get('width') ) {
obj.set({
width: (gridSize * scaleSize),
height: (gridSize * scaleSize),
isdrawing: false
});
}
}
},
registerEventHandlers = function() {
on('add:graphic', sizeTableToken);
};
return {
RegisterEventHandlers: registerEventHandlers
};
}());
on("ready",function(){
'use strict';
TableTokenSizer.RegisterEventHandlers();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment