This scriptlet is for the D&D 5th Edition by Roll20 Sheet only I have seen a number of threads where people have expressed dissatisfaction with how difficult it is to set a token bar to a character's Passive Perception. This script allows you to select any number of tokens and send their passive perception number to the bar of your choice. It will pull the number from the end of the npc_senses attribute on NPCs, where the passive Perception is always the end of the string. For Player characters, it will pull the Passive Wisdom number, or if it is at the default (perception is not a proficient skill), the base wisdom roll. I've done only a little testing on this, so I urge caution. It is very easy to overwrite data on a token . It should not overwrite data on the sheet though—it unlinks the bar first, if any link is set, then writes the value in the bar value and deletes any value that was previously set in the bar max. I would suggest testing with a small number of tokens at a time until you have confirmed that it is working as you wish. If you are using this on a Roll20 official module, all of the tokens for a game are located on the Token Page. Once you have converted them there, you can update the default tokens using a token-mod command (i.e. install the tokenmod script). This will not set up all tokens in a campaign. The potential for a mistake is too high. However, once you are confident it does what you want, it's very quick to convert all of the tokens on a given page with one command. The value is written to the bar and not linked, because the NPC sheet does not have a standalone number value for passive Perception. Commands are simple: !pp1 !pp2 !pp3 ...write the passive perception to bar 1, 2, or 3 respectively. Anyway, this is a very simple script without a lot of error catching. It hasn't broken yet, but please post any errors and if I can fix them, I will. Code: var API_Meta = API_Meta || {}; API_Meta.PassivePerception = {     offset: Number.MAX_SAFE_INTEGER,     lineCount: -1 }; {     try {         throw new Error('');     } catch (e) {         API_Meta.PassivePerception.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4));     } } on('ready', () => {     const version = '0.0.0';     log("Passve Perception v" + version + " is ready! --offset " + API_Meta.PassivePerception.offset + " -- Use the command !pp1, !pp2, or pp3 to link token's passive perception to the bar of that number"); }); on('chat:message', (msg_orig) => {     let msg = _.clone(msg_orig);     if (!/^!pp[1|2|3]/.test(msg.content)) {         return;     }     let pp = "";     let pw = "";     let barNumber = msg.content.match(/\d/);     let character = "";     if (undefined !== msg.selected) {         tokens = msg.selected             .map(o => getObj('graphic', o._id))             .filter(o => undefined !== o)         tokens.forEach(t => {             if (t.get("type") === 'graphic' && undefined !== t.get("represents")) {                 character = getObj("character", t.get("represents"));                 let isNPC = getAttrByName(character.id, "npc") || 0;                 if (isNPC === 1) {                     pp = getAttrByName(character.id, "npc_senses").match(/\d\d$/) + "";                 } else {                     pp = getAttrByName(character.id, "passive_wisdom") || parseInt(getAttrByName(character.id, "wisdom_mod")) + 9;                 }                 switch (parseInt(msg.content.match(/\d/))) {                     case 1:                         t.set("bar1_link", "");                         t.set("bar1_value", pp);                         t.set("bar1_max", "");                         break;                     case 2:                         t.set("bar2_link", "");                         t.set("bar2_value", pp);                         t.set("bar2_max", "");                         break;                     case 3:                         t.set("bar3_link", "");                         t.set("bar3_value", pp);                         t.set("bar3_max", "");                         break;                     default:                 }             }         });         sendChat("Passive Perception", `/w gm Passive perception on selected characters has been sent to bar ${barNumber}`, null, {             noarchive: true         });     }; });