OK I know there are other group initiative tools out there, but I want to be able to select a group of tokens, and only execute the script against certain tokens as identified by an attribute, in this case characterType. I want to be able to select the group quickly by just tracing a selection box around them and not have to shift-click each of the monsters/NPCs, but it will ignore the PC's. This script set I was trying to add a new group of tokens to the initiative turn order. However, no matter what I have tried, the JSON is read and shows the tokens that I have set through the Add Turn option; however, those that I push to the JSON do not show up on the Turn Order list. If I run the script again, I see those items added to the JSON value. What am I missing? Or is it not possible to do in this method? Some other things I am trying to find - If the below is possible and I am just missing something, how can I find the pageid value from within the script? Why, when I read the attributes do they not come out as numbers, but rather as text? What is the better way to convert them to a numeric other than the way I am now by multiplying by 1? (Currently if I don't do this then if the random roll for initRoll comes to 8, and the character has a dexterityMod of 2, it concatenates them to 82.) I also want to be able to select the tokens and roll for initiative, replacing the current values, is there a quicker way to do this other than reading in the JSON and removing then re-adding the selected tokens? I am open to going a completely different route if needed, this is a learning journey for me. Note the functions for getCharacterObj and getAttrByName are scripts from other developers, and will be of great utility value! EDIT: I forgot to mention that the sorting of the Turn Order with the below code works fine. function addMonsterInit(selectedToken) { Campaign().set('initiativepage',false) var characterObj = getCharacterObj(selectedToken) var characterRace = getAttrByName(characterObj.id,'Race','current') var dexterityMod = 0 dexterityMod = getAttrByName(characterObj.id,'DexterityMod','current')*1 var turnOrder var initRoll = randomInteger(10)*1 if (Campaign().get('turnorder') == '') { turnOrder =[] } else { turnOrder = JSON.parse(Campaign().get('turnorder')) } if (characterType == 'Monster' || characterRace == 'GM-NPC'){ log("name - "+characterObj.get('name')+ ' - ID'+characterObj.id+' race - '+characterRace+' - Dex Mod '+dexterityMod+" - init "+initRoll + ' W/Dex ' + (initRoll+dexterityMod)) turnOrder.push({ id: characterObj.id, pr: (initRoll+dexterityMod), custom: '', pageid: "7F73B956-71C3-4C5B-8C72-576EE4F15EA4" }) } turnOrder.sort(function(a,b) { first = a.pr second = b.pr return second - first; }) log(turnOrder) Campaign().set('turnorder', JSON.stringify(turnOrder)) Campaign().set('initiativepage',true) } on('ready', function() { on("chat:message", function(msg) { if (msg.type === "api" && msg.content == "!monsterInit") { var selectedTokens = msg.selected; _.each(selectedTokens,rollMonsterInit) } }) })