Last active
October 17, 2015 14:31
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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