Tubal said: I've looked around a bit, and gave the handout doc a read, but there's no handy way to place multiple tokens in a nice ordered grid is there? Not with TokenMod, but here's a little script I wrote to do that called MarshalTokens. Just select the tokens and run: !marshal-tokens and it will put them in as close to a square as it can. Code: on('ready',()=>{
const positioner = (x,y) => {
const shell = (n) => Math.ceil(Math.sqrt(n));
const xyForN = (n) => {
let s = shell(n);
let sm = s-1;
let sSeq=n-(Math.pow(sm,2));
let pSeq=Math.ceil(sSeq/2);
return {
x: (sSeq%2 ? pSeq : s)-1,
y: (sSeq%2 ? s : pSeq)-1
};
};
let startx = x;
let starty = y;
let count=0;
return (obj)=>{
let coord = xyForN(++count);
obj.set({
top: starty+(coord.y*70),
left: startx+(coord.x*70)
});
};
};
const normalizer = (n) => {
return (Math.max(0,Math.floor((n-35)/70))*70)+35;
};
on('chat:message',function(msg){
if('api'===msg.type && /^!marshal-tokens(\b\s|$)/i.test(msg.content) && playerIsGM(msg.playerid)){
let tokens = [...new Set([
...msg.content.split(/\s+/).slice(1),
...((msg.selected && msg.selected.map(s=>s._id)) || [])
])]
.map(id=>getObj('graphic',id))
.filter(g=>undefined !== g)
;
let firstToken = (tokens[0]||{get:()=>0});
let x=normalizer(firstToken.get('left'));
let y=normalizer(firstToken.get('top'));
let poser = positioner(x,y);
tokens.forEach(poser);
}
});
});