
While this script works, it doesn't change the value of @{selected|weapon-type}. I have the field in the character sheet for that attribute as 'ranged' for testing. The sendChat still says the attack type is ranged. on('chat:message', function(msg) {
if (msg.type != 'api') return;
var parts = msg.content.split(' ');
var command = parts.shift().substring(1);
if (command == 'equip-melee')
{
var selectedId = parts[0];
var selectedweapontype = parts[1];;
//Get the token.id as tokens
var selectedToken = getObj('graphic', selectedId);
if (selectedweapontype != 'melee')
{
selectedToken.set('weapon-type', 'melee');
}
sendChat(msg.who, "/desc Your equiped weapon's attack type is now " + selectedweapontype);
}
});