This should do it, long as the token has a sheet with those attributes on it, it will update them. if it doesn't have all 3 attributes it stops (vs adding them, wouldnt want to randomly add them to a character you didnt want by accident..this way it just does nothing if its missing)
you can even select more than one token and set it on them all, it will loop all selected tokens and set the values.
just rename the Atta, Attb, and Attc to the Attribute names you want it to look for.
doing
!Set 10 20 30 will set them to 10,20,30 current and max for the 3, in that order.
So like below you get
fort;10/10
ref:20/20
will:30/30
on('chat:message', function (msg) {
var CmdName = '!Set '
if(msg.type == 'api' && msg.content.indexOf(CmdName) !== -1) {
//Set Attrib names---
var Atta = 'fort';
var Attb = 'ref';
var Attc = 'will';
//--------------------
var selected = msg.selected;
var msgTxt = msg.content;
var msgFormula = msgTxt.split(" ");
i = 0;
_.each(selected, function (obj) {
var token = getObj('graphic', msg.selected[i]._id);
//---make sure its a token, and has a sheet---
if(token.get("represents") != '') {
if(token.get('subtype') != 'token') return;
var oCharacter = getObj('character', token.get("_represents"));
//----------------------------------------
var oAtt1 = findObjs({_type: "attribute",name: Atta,_characterid: oCharacter.id})[0];
var oAtt2 = findObjs({_type: "attribute",name: Attb,_characterid: oCharacter.id})[0];
var oAtt3 = findObjs({_type: "attribute",name: Attc,_characterid: oCharacter.id})[0];
if(oAtt1 == undefined || oAtt2 == undefined || oAtt3 == undefined){
log('Token has no Attributes on its sheet');
return;
}
oAtt1.set('current', msgFormula[1]);
oAtt1.set('max', msgFormula[1]);
oAtt2.set('current', msgFormula[2]);
oAtt2.set('max', msgFormula[2]);
oAtt3.set('current', msgFormula[3]);
oAtt3.set('max', msgFormula[3]);
}
i++
});
}
});