Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Doubt about new Script: HazEncumberance

So, i build my first Script. It tracks encumberance and anounce in the chat when someone gets encumbered and sets a character status icon in its token. Ofcourse i copied it from someone else (Giger HazInspiration) and modified it for my on use.&nbsp; So the script tracks if the character sheet encumbrance has been updated in the OGL 5E sheet and sets a token (snail) if the character has overweight. I created 3 functions:&nbsp; announceEncumberance for Encumbered, announceEncumberanceOne for Heavily Encumbered&nbsp; and&nbsp;announceEncumberanceTwo for immobile. The thing is that i am using the line bellow to set the token status to snail, but with this status marker I can't&nbsp; differentiate the 3 status. I know that using The Aaron TokenMod script I can put a number in each status and my idea is to use the numbers (1, 2 and 3, or just 1 and 2) to represent each of the status. How can i implment that in the script? getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',true)); &nbsp;&nbsp; TokenMod Code to use a number and a status icon Update v0.8.2 &nbsp;-- Added multiple status markers. I haven't updated the help for it yet, but basically, anything that works for a single status works for one with an index. The first command here sets the blue status marker on with a number of 1. The second line adds a second blue status marker and sets it's value to 2: !token-mod --set statusmarkers|snail:1 !token-mod --set statusmarkers|snail[2]:2 &nbsp; Here is the whole code for tracking encumberance: //HazEncumbrance v. 0.1 created on the 11-05-2020 by Krupas, my first script code shamelessly stolen from Giger HazInspiration Script /* This script reports to the chat window, and updates the players token with an icon, to indicate whether the player has overweight or not. Designed for the 5th Edition ( OGL by Roll20 ) Character Sheet. */ on('ready',()=&gt;{ const getCharacterTokens = (cid) =&gt; findObjs({type:'graphic'}).filter((t)=&gt;t.get('represents')===cid); //Brightness var getBrightness = getBrightness || {}; var getHex2Dec = getHex2Dec || {}; function getBrightness(hex) { hex = hex.replace('#', ''); var c_r = getHex2Dec(hex.substr(0, 2)); var c_g = getHex2Dec(hex.substr(2, 2)); var c_b = getHex2Dec(hex.substr(4, 2)); return ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000; }; function getHex2Dec(hex_string) { hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, ''); return parseInt(hex_string, 16); }; const announceEncumberance = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está com Sobrecarga! &lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',true)); }; const announceEncumberanceOne = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está com Sobrecarga Pesada! &lt;/div&gt;&lt;img src='<a href="https://s3.amazonaws.com/files.d20.io/images/39783029/-w45_4ICV9QnFzijBimwKA/max.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/39783029/-w45_4ICV9QnFzijBimwKA/max.png</a>' style='" + AlertImageStyle + "'&gt;&lt;/img&gt;&lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',true)); }; const announceEncumberanceTwo = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está imóvel! &lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',true)); }; const dropEncumberance = function (id) { //Remove Status Icon from Token if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " não está mais com sobrecarga! &lt;/div&gt;"); //Drop Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',false)); }; on("chat:message", function(msg) { //Is script running? if(msg.type == "api" &amp;&amp; msg.content.indexOf("!inspiration") !== -1) { sendChat("", "/desc &lt;div style='max-height: 40px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;'&gt;&lt;div style='max-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: fff; background-color: 20b2aa; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 000, 1px -1px 0 000, -1px 1px 0 000, 1px 1px 0 000'&gt;Inspiration Tracking Online!&lt;/div&gt;&lt;/div&gt;"); } }); // Has a character sheet been updated? on("change:attribute", function(obj) { var isupdated = obj.get("name"); //Was it the Inspiration attribute? if (isupdated =="encumberance"){ var val = obj.get("current"); var id = obj.get("_characterid"); //Gained encumberance? if (isupdated =="encumberance" &amp;&amp; val == "ENCUMBERED"){ // Announce Character Encumbered announceEncumberance(id); }if (isupdated =="encumberance" &amp;&amp; val == "HEAVILY ENCUMBERED"){ // Announce Character Heavy Encumbered announceEncumberanceOne(id); }if (isupdated =="encumberance" &amp;&amp; val == "IMMOBILE"){ // Announce Character Immobile announceEncumberanceTwo(id); } else if (isupdated =="encumberance" &amp;&amp; val == " "){ //Remove Encumbered Icon from Token dropEncumberance(id); } } }); log('-=&gt; HazEncumberance &lt;=- V0.1'); sendChat("", "/desc &lt;div style='max-height: 40px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;'&gt;&lt;div style='max-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: fff; background-color: 20b2aa; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 000, 1px -1px 0 000, -1px 1px 0 000, 1px 1px 0 000'&gt;Encumberance Tracking Online!&lt;/div&gt;&lt;/div&gt;"); }); &nbsp;&nbsp;
1589212579
The Aaron
Roll20 Production Team
API Scripter
Here are some functions that should help with that: const unpackSM = (stats) =&gt; stats.split(/,/).reduce((m,v) =&gt; { let p = v.split(/@/); let n = (undefined === p[1] ? true : parseInt(p[1] || '0', 10)); if(p[0].length) { m[p[0]] = n; } return m; },{}); const packSM = (o) =&gt; Object.keys(o) .reduce( (m,k)=&gt; (false===o[k] ? m : [...m,( ('dead'===k || true === o[k]) ? k : `${k}@${Math.max(Math.min(parseInt(o[k]),9),0)}` )] ) ,[]) .join(','); unpackSM() takes the contents of a token's statusmarkers property and expands it to an object with the status name as a property and the the number 0-9 or true for the value.&nbsp; You'd use it like: let sm = unpackSM(token.get('statusmarkers')); You can then manipulate that object as you like.&nbsp; For example, setting snail to 2: sm.snail = 2; or const MARKER_NAME='snail'; /* ... */ sm[MARKER_NAME] = 2; or you could remove a status like: sm.snail = false; or delete sm[MARKER_NAME]; Then when your'e done, just set them back on the token (or other tokens) with something like: token.set({ statusmarkers: packSM(sm) }); Hope that helps!
Wow The aaron answering. Thanks, have seen you in many of the posts I am studying. I am pretty new in Javascript so I still need some help. I added the two functions (unpack and pack) in the script and used the unpackSM() function inside my announceEncumberance function and sm.snail = 2 inside the same function. I am getting the error bellow: ReferenceError: token is not defined I used the code bellow to unpack the status of the token: let sm = unpackSM(token.get('statusmarkers')); And in my annouceEncumberance i am using getCharacterToken(character.id) as bellow. getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',false)); Tried to use getCharacterToken(character.id) instead of Token,but didn't work
1589225338
The Aaron
Roll20 Production Team
API Scripter
In the example, token is just a variable containing the token.&nbsp; You'd need to get it from getObj() or findObjs() or your getCharacterTokens().&nbsp; If you're doing it with getCharacterTokens() it will look something like: getCharacterTokens().forEach(t =&gt; { let sm = unpackSM(t.get('statusmarkers')); sm.snail = 2; t.set('statusmarkers', packSM(sm)); }); However, that said, since you're just dealing with the one status, it might be easier to just do: getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',2)); I think I read more complexity into your needs than it really has. =D&nbsp; Sorry abou that!
Wow thanks. That is great. The second code works like a charm. Just one last question. I want to link in the chat the info about the condition Encurberance. Can I use commands from other scripts inside a script? In this case I created a condition in StatusInfo Script, and tried to use the command of it inside my script. The command is !condition [name of the condition]; but it didn't work inputing the command raw in my script. Any ideas? !condition sobrecarregado;
I used &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat('','!condition Sobrecarga'); and the command !condition Sobrecarga is inputed in the API Output Console, but the status text dosen't appear in the Roll20 chat.&nbsp; When I use the same command in the Roll20 chat it works and in the API Output Console it writes the same !condition Sobrecarga..
1589229662
The Aaron
Roll20 Production Team
API Scripter
You can, but whether they work will depend on the other script.&nbsp; In particular, if the other script depends on the msg.playerid, it's not going to work correctly for messages from other API scripts as that will come up as "api".&nbsp; If you have handouts with the information, or you have a site on the internet you want to link to, you can send a link to chat for a player to click on.
Wow that is a great idea. Thanks. Done. Problem solved.
1589253742
The Aaron
Roll20 Production Team
API Scripter
Sweet! =D
Well sorry to bother again, but my API is crashing frequently and I think it is happening because of my script hasEncumbrance. Here is the screenshot of the error I am getting. Any Ideas? Here is my final code //HazEncumbrance v. 0.1 created on the 11-05-2020 by Krupas, my first script code shamelessly stolen from Giger HazInspiration Script /* This script reports to the chat window, and updates the players token with an icon, to indicate whether the player has overweight or not. Designed for the 5th Edition ( OGL by Roll20 ) Character Sheet. */ on('ready',()=&gt;{ const getCharacterTokens = (cid) =&gt; findObjs({type:'graphic'}).filter((t)=&gt;t.get('represents')===cid); //Brightness var getBrightness = getBrightness || {}; var getHex2Dec = getHex2Dec || {}; function getBrightness(hex) { hex = hex.replace('#', ''); var c_r = getHex2Dec(hex.substr(0, 2)); var c_g = getHex2Dec(hex.substr(2, 2)); var c_b = getHex2Dec(hex.substr(4, 2)); return ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000; }; function getHex2Dec(hex_string) { hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, ''); return parseInt(hex_string, 16); }; const announceEncumberance = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está com Sobrecarga! &lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',true)); //sendChat('','!condition Sobrecarga'); sendChat('', '[x](<a href="https://i.imgur.com/uydfJZW.png" rel="nofollow">https://i.imgur.com/uydfJZW.png</a>)'); }; const announceEncumberanceOne = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; //sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está com Sobrecarga Pesada! &lt;/div&gt;&lt;img src='<a href="https://s3.amazonaws.com/files.d20.io/images/39783029/-w45_4ICV9QnFzijBimwKA/max.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/39783029/-w45_4ICV9QnFzijBimwKA/max.png</a>' style='" + AlertImageStyle + "'&gt;&lt;/img&gt;&lt;/div&gt;"); sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está com Sobrecarga Pesada! &lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',1)); sendChat('', '[x](<a href="https://i.imgur.com/uydfJZW.png" rel="nofollow">https://i.imgur.com/uydfJZW.png</a>)'); }; const announceEncumberanceTwo = function (id) { //Handles Chat Annoucement if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " está imóvel! &lt;/div&gt;"); //Set Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',2)); sendChat('', '[x](<a href="https://i.imgur.com/uydfJZW.png" rel="nofollow">https://i.imgur.com/uydfJZW.png</a>)'); }; const dropEncumberance = function (id) { //Remove Status Icon from Token if ( _.isEmpty(id)) return; var character = getObj("character", id); var AlertTokenName = character.get("name"); var AlertColor = getObj("player", character.get("controlledby").split(",")[0]).get("color"); var AlertTextColor = (getBrightness(AlertColor) &lt; (255 / 2)) ? "#FFF" : "#000"; var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000"; var AlertOuterStyle = "max-height: 500px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;"; var AlertInnerStyle = "max-height: 500px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";"; var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;"; sendChat("", "/desc &lt;div style='" + AlertOuterStyle + "'&gt;&lt;div style='" + AlertInnerStyle + "'&gt;" + AlertTokenName + " não está mais com sobrecarga! &lt;/div&gt;"); //Drop Status Icon on Token getCharacterTokens(character.id).forEach((t)=&gt;t.set('status_snail',false)); }; on("chat:message", function(msg) { //Is script running? if(msg.type == "api" &amp;&amp; msg.content.indexOf("!inspiration") !== -1) { sendChat("", "/desc &lt;div style='max-height: 40px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;'&gt;&lt;div style='max-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: fff; background-color: 20b2aa; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 000, 1px -1px 0 000, -1px 1px 0 000, 1px 1px 0 000'&gt;Inspiration Tracking Online!&lt;/div&gt;&lt;/div&gt;"); } }); // Has a character sheet been updated? on("change:attribute", function(obj) { var isupdated = obj.get("name"); //Was it the Inspiration attribute? if (isupdated =="encumberance"){ var val = obj.get("current"); var id = obj.get("_characterid"); //Gained encumberance? if (isupdated =="encumberance" &amp;&amp; val == "ENCUMBERED"){ // Announce Character Encumbered announceEncumberance(id); }if (isupdated =="encumberance" &amp;&amp; val == "HEAVILY ENCUMBERED"){ // Announce Character Heavy Encumbered announceEncumberanceOne(id); }if (isupdated =="encumberance" &amp;&amp; val == "IMMOBILE"){ // Announce Character Immobile announceEncumberanceTwo(id); } else if (isupdated =="encumberance" &amp;&amp; val == " "){ //Remove Encumbered Icon from Token dropEncumberance(id); } } }); log('-=&gt; HazEncumberance &lt;=- V0.1'); sendChat("", "/desc &lt;div style='max-height: 40px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;'&gt;&lt;div style='max-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: fff; background-color: 20b2aa; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 000, 1px -1px 0 000, -1px 1px 0 000, 1px 1px 0 000'&gt;Encumberance Tracking Online!&lt;/div&gt;&lt;/div&gt;"); });