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

Blood and Honor script

Hey everyone, I've been trying to get the Blood and Honor script up and working for a stream I have coming in April. (Gladiators need blood right?) The last post I found was from some time ago so I'm starting this one up looking for assistance. I'm new to the Roll20 API but do scripting for videogame engines.          TRIED I've used the latest script, added the images to my tokens and grabbed the URLs from the thumbnails but I just can't get it to function. Deleted and re-implemented the script. Cloned the table.  Restarted the API          ERRORs Syntax errors for unknown tokens
1585178440
The Aaron
Roll20 Production Team
API Scripter
Were the URLs you added from User Library urls? Can you link to the version you're using?
Thanks for the fast response The Aaron LINK Script Link:&nbsp; <a href="https://app.roll20.net/forum/post/1477230/script-blood-and-honor-automatic-blood-spatter-pooling-and-trail-effects-lightweight/?pageforid=1477230" rel="nofollow">https://app.roll20.net/forum/post/1477230/script-blood-and-honor-automatic-blood-spatter-pooling-and-trail-effects-lightweight/?pageforid=1477230</a> Library Link:&nbsp; <a href="https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475</a> I made sure to delete the // comment before each URL.
1585181959
The Aaron
Roll20 Production Team
API Scripter
Try this version:&nbsp; <a href="https://gist.github.com/shdwjk/9f65e684309dea7e5e6152e03bcdc93e" rel="nofollow">https://gist.github.com/shdwjk/9f65e684309dea7e5e6152e03bcdc93e</a>
1585188395

Edited 1585188503
EFP
KS Backer
SCRIPT ERROR For reference, the error message generated was:&nbsp; SyntaxError: Invalid or unexpected token ON THE TABLE. The blood art shows on tokens, like before, and I can click them. When the 3rd bar is assigned to health and I do damage to the token, nothing happens. CODE This makes me think I'm missing something. ///////////////////////////////////////////////// /***********************************************/ var BloodAndHonor = { author: { name: "John C." || "Echo" || "SplenectomY", company: "Team Asshat" || "The Alehounds", contact: "<a href="mailto:echo@TeamAsshat.com" rel="nofollow">echo@TeamAsshat.com</a>" }, version: "0.8.2", // The Aaron - Patched for playerIsGM(), createObj(), and randomInteger() crash. gist: "<a href="https://gist.github.com/SplenectomY/097dac3e427ec50f32c9" rel="nofollow">https://gist.github.com/SplenectomY/097dac3e427ec50f32c9</a>", forum: "<a href="https://app.roll20.net/forum/post/1477230/" rel="nofollow">https://app.roll20.net/forum/post/1477230/</a>", wiki: "<a href="https://wiki.roll20.net/Script:Blood_And_Honor:_Automatic_blood_spatter,_pooling_and_trail_effects" rel="nofollow">https://wiki.roll20.net/Script:Blood_And_Honor:_Automatic_blood_spatter,_pooling_and_trail_effects</a>", /***********************************************/ ///////////////////////////////////////////////// // This value should match the size of a standard grid in your campaign // Default is 70 px x 70 px square, Roll20's default. tokenSize: 70, bar: 1, // YOU MUST ADD YOUR OWN SPATTERS AND POOLS TO YOUR LIBRARY // AND GET THE IMAGE LINK VIA YOUR WEB BROWSER. // FOLLOW THE INSTRUCTIONS HERE: // <a href="https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions" rel="nofollow">https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions</a> // You can add as many as you'd like to either category. // Spatters are also used for blood trails. spatters: [ "<a href="https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733736/UXfvZ8wX9UO5Q2Vca3VSjQ/max.png?1585128474" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733736/UXfvZ8wX9UO5Q2Vca3VSjQ/max.png?1585128474</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733738/MdkzTSpFb0VyZyACAngtmg/max.png?1585128477" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733738/MdkzTSpFb0VyZyACAngtmg/max.png?1585128477</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733739/Jku1qm791Jo5EJW2KFaZVg/max.png?1585128478" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733739/Jku1qm791Jo5EJW2KFaZVg/max.png?1585128478</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733742/h9Gi1DNDda4vps5iTtaq9g/max.png?1585128483" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733742/h9Gi1DNDda4vps5iTtaq9g/max.png?1585128483</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733743/QdiYCuM9bu5gIqdJ-2cShg/max.png?1585128484" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733743/QdiYCuM9bu5gIqdJ-2cShg/max.png?1585128484</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733744/2-vqJCxXxfVn--oHFiUWHQ/max.png?1585128486" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733744/2-vqJCxXxfVn--oHFiUWHQ/max.png?1585128486</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733747/8meZ0p0IRuEoqAcKK1kGNQ/max.png?1585128996" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733747/8meZ0p0IRuEoqAcKK1kGNQ/max.png?1585128996</a>", ], pools: [ "<a href="https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479</a>", ], chooseBlood: function chooseBlood(type) { if (type == "spatter") return BloodAndHonor.spatters[randomInteger(BloodAndHonor.spatters.length) - 1]; if (type == "pool") return BloodAndHonor.pools[randomInteger(BloodAndHonor.pools.length) - 1]; }, getOffset: function getOffset() { if (randomInteger(2) == 1) return 1; else return -1; }, bloodColor: function bloodColor(gmnotes) { if (gmnotes.indexOf("bloodcolor_purple") !== -1) return "#0000ff"; if (gmnotes.indexOf("bloodcolor_blue") !== -1) return "#00ffff"; if (gmnotes.indexOf("bloodcolor_orange") !== -1) return "#ffff00"; if (gmnotes.indexOf("bloodcolor_black") !== -1) return "#000000"; if (gmnotes.indexOf("bloodcolor_green") !== -1) return "#008000"; else return "transparent"; }, createBlood: function createBlood(gPage_id,gLeft,gTop,gWidth,gType,gColor) { gLeft = gLeft + (randomInteger(Math.floor(gWidth / 2)) * BloodAndHonor.getOffset()); gTop = gTop + (randomInteger(Math.floor(gWidth / 2)) * BloodAndHonor.getOffset()); setTimeout(function(){ toFront(createObj("graphic",{ imgsrc: gType, gmnotes: "blood", pageid: gPage_id, left: gLeft, tint_color: gColor, top: gTop, rotation: randomInteger(360) - 1, width: gWidth, height: gWidth, layer: "map" })); },50); }, timeout: 0, onTimeout: function theFinalCountdown() { if (BloodAndHonor.timeout &gt; 0) { BloodAndHonor.timeout--; } else { return; } } }; const getActivePages = (()=&gt;{ let lastCall = 0; let fn = () =&gt; [...new Set([ Campaign().get('playerpageid'), ...Object.values(Campaign().get('playerspecificpages')), ...findObjs({ type: 'player', online: true }) .filter((p)=&gt;playerIsGM(p.id)) .map((p)=&gt;p.get('lastpage')) ]) ]; let last = []; return () =&gt; { if((Date.now()-300) &gt; lastCall){ last = fn(); lastCall = Date.now(); } return last; }; })(); const isPlayerPage = (id) =&gt; getActivePages().includes(id); on("ready", function() { setInterval(function(){BloodAndHonor.onTimeout();},1000); on(`change:graphic:bar${BloodAndHonor.bar}_value`, function(obj, prev) { if(isPlayerPage(obj.get('pageid'))){ if (obj.get(`bar${BloodAndHonor.bar}_max`) === "" || obj.get("layer") != "objects" || (obj.get("gmnotes")).indexOf("noblood") !== -1) return; // Create spatter near token if "bloodied". // Chance of spatter depends on severity of damage else if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= obj.get(`bar${BloodAndHonor.bar}_max`) / 2 &amp;&amp; prev[`bar${BloodAndHonor.bar}_value`] &gt; obj.get(`bar${BloodAndHonor.bar}_value`) &amp;&amp; obj.get(`bar${BloodAndHonor.bar}_value`) &gt; 0) { var m=parseInt(obj.get(`bar${BloodAndHonor.bar}_max`),10)||1, v=parseInt(obj.get(`bar${BloodAndHonor.bar}_value`),10)||1, r=randomInteger(m); if (r&gt;v) { var bloodMult = 1 + ((obj.get(`bar${BloodAndHonor.bar}_value`) - prev[`bar${BloodAndHonor.bar}_value`]) / obj.get(`bar${BloodAndHonor.bar}_max`)); BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize * bloodMult), BloodAndHonor.chooseBlood("spatter"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); } } // Create pool near token if health drops below 1. else if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= 0) { BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize * 1.5), BloodAndHonor.chooseBlood("pool"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); } } }); //Make blood trails, chance goes up depending on how injured a token is on("change:graphic:lastmove", function(obj) { if(isPlayerPage(obj.get('pageid')) &amp;&amp; BloodAndHonor.timeout === 0) { if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= obj.get(`bar${BloodAndHonor.bar}_max`) / 2 &amp;&amp; (obj.get("gmnotes")).indexOf("noblood") == -1) { var m=parseInt(obj.get(`bar${BloodAndHonor.bar}_max`),10)||1, v=parseInt(obj.get(`bar${BloodAndHonor.bar}_value`),10)||1, r=randomInteger(m); if (r&gt;v) { BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize / 2), BloodAndHonor.chooseBlood("spatter"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); BloodAndHonor.timeout += 2; } } } }); on("chat:message", function(msg) { if (msg.type == "api" &amp;&amp; msg.content.indexOf("!clearblood") !== -1) { if (!playerIsGM(msg.playerid)) { sendChat(msg.who,"/w " + msg.who + " You are not authorized to use that command!"); return; } else { let objects = filterObjs(function(obj) { return obj.get("type") == "graphic" &amp;&amp; obj.get("gmnotes") == "blood" &amp;&amp; isPlayerPage(obj.get('pageid')) ; }); _.each(objects, function(obj) { obj.remove(); }); } } }); });
1585188691

Edited 1585188707
EFP
KS Backer
Here is the test subject.
1585191021
The Aaron
Roll20 Production Team
API Scripter
Oh right, this version is configurable for which bar to use.&nbsp; It's set up for bar 1.&nbsp; Go down to about line 20 where it has: bar: 1, And change the 1 to a 3.
UPDATES 1.1 &nbsp;Still no changes with the updateing 1 to 3. Turned off other scripts Changed the 1 to a 3. Saved&nbsp; Reloaded UI Deleted the token, added a new on. Relinked to Bar 3 and health. Still nothing. ///////////////////////////////////////////////// /***********************************************/ var BloodAndHonor = { author: { name: "John C." || "Echo" || "SplenectomY", company: "Team Asshat" || "The Alehounds", contact: "<a href="mailto:echo@TeamAsshat.com" rel="nofollow">echo@TeamAsshat.com</a>" }, version: "0.8.2", // The Aaron - Patched for playerIsGM(), createObj(), and randomInteger() crash. gist: "<a href="https://gist.github.com/SplenectomY/097dac3e427ec50f32c9" rel="nofollow">https://gist.github.com/SplenectomY/097dac3e427ec50f32c9</a>", forum: "<a href="https://app.roll20.net/forum/post/1477230/" rel="nofollow">https://app.roll20.net/forum/post/1477230/</a>", wiki: "<a href="https://wiki.roll20.net/Script:Blood_And_Honor:_Automatic_blood_spatter,_pooling_and_trail_effects" rel="nofollow">https://wiki.roll20.net/Script:Blood_And_Honor:_Automatic_blood_spatter,_pooling_and_trail_effects</a>", /***********************************************/ ///////////////////////////////////////////////// // This value should match the size of a standard grid in your campaign // Default is 70 px x 70 px square, Roll20's default. tokenSize: 70, bar: 3, // YOU MUST ADD YOUR OWN SPATTERS AND POOLS TO YOUR LIBRARY // AND GET THE IMAGE LINK VIA YOUR WEB BROWSER. // FOLLOW THE INSTRUCTIONS HERE: // <a href="https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions" rel="nofollow">https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions</a> // You can add as many as you'd like to either category. // Spatters are also used for blood trails. spatters: [ "<a href="https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733736/UXfvZ8wX9UO5Q2Vca3VSjQ/max.png?1585128474" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733736/UXfvZ8wX9UO5Q2Vca3VSjQ/max.png?1585128474</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/max.png?1585128475</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733738/MdkzTSpFb0VyZyACAngtmg/max.png?1585128477" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733738/MdkzTSpFb0VyZyACAngtmg/max.png?1585128477</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733739/Jku1qm791Jo5EJW2KFaZVg/max.png?1585128478" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733739/Jku1qm791Jo5EJW2KFaZVg/max.png?1585128478</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733742/h9Gi1DNDda4vps5iTtaq9g/max.png?1585128483" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733742/h9Gi1DNDda4vps5iTtaq9g/max.png?1585128483</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733743/QdiYCuM9bu5gIqdJ-2cShg/max.png?1585128484" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733743/QdiYCuM9bu5gIqdJ-2cShg/max.png?1585128484</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733744/2-vqJCxXxfVn--oHFiUWHQ/max.png?1585128486" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733744/2-vqJCxXxfVn--oHFiUWHQ/max.png?1585128486</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733747/8meZ0p0IRuEoqAcKK1kGNQ/max.png?1585128996" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733747/8meZ0p0IRuEoqAcKK1kGNQ/max.png?1585128996</a>", ], pools: [ "<a href="https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733741/VyNM_dcwowvUJRz4uIY4eQ/max.png?1585128480</a>", "<a href="https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733740/VmK3eb87GvsZ-nDCBk5IQw/max.png?1585128479</a>", ], chooseBlood: function chooseBlood(type) { if (type == "spatter") return BloodAndHonor.spatters[randomInteger(BloodAndHonor.spatters.length) - 1]; if (type == "pool") return BloodAndHonor.pools[randomInteger(BloodAndHonor.pools.length) - 1]; }, getOffset: function getOffset() { if (randomInteger(2) == 1) return 1; else return -1; }, bloodColor: function bloodColor(gmnotes) { if (gmnotes.indexOf("bloodcolor_purple") !== -1) return "#0000ff"; if (gmnotes.indexOf("bloodcolor_blue") !== -1) return "#00ffff"; if (gmnotes.indexOf("bloodcolor_orange") !== -1) return "#ffff00"; if (gmnotes.indexOf("bloodcolor_black") !== -1) return "#000000"; if (gmnotes.indexOf("bloodcolor_green") !== -1) return "#008000"; else return "transparent"; }, createBlood: function createBlood(gPage_id,gLeft,gTop,gWidth,gType,gColor) { gLeft = gLeft + (randomInteger(Math.floor(gWidth / 2)) * BloodAndHonor.getOffset()); gTop = gTop + (randomInteger(Math.floor(gWidth / 2)) * BloodAndHonor.getOffset()); setTimeout(function(){ toFront(createObj("graphic",{ imgsrc: gType, gmnotes: "blood", pageid: gPage_id, left: gLeft, tint_color: gColor, top: gTop, rotation: randomInteger(360) - 1, width: gWidth, height: gWidth, layer: "map" })); },50); }, timeout: 0, onTimeout: function theFinalCountdown() { if (BloodAndHonor.timeout &gt; 0) { BloodAndHonor.timeout--; } else { return; } } }; const getActivePages = (()=&gt;{ let lastCall = 0; let fn = () =&gt; [...new Set([ Campaign().get('playerpageid'), ...Object.values(Campaign().get('playerspecificpages')), ...findObjs({ type: 'player', online: true }) .filter((p)=&gt;playerIsGM(p.id)) .map((p)=&gt;p.get('lastpage')) ]) ]; let last = []; return () =&gt; { if((Date.now()-300) &gt; lastCall){ last = fn(); lastCall = Date.now(); } return last; }; })(); const isPlayerPage = (id) =&gt; getActivePages().includes(id); on("ready", function() { setInterval(function(){BloodAndHonor.onTimeout();},1000); on(`change:graphic:bar${BloodAndHonor.bar}_value`, function(obj, prev) { if(isPlayerPage(obj.get('pageid'))){ if (obj.get(`bar${BloodAndHonor.bar}_max`) === "" || obj.get("layer") != "objects" || (obj.get("gmnotes")).indexOf("noblood") !== -1) return; // Create spatter near token if "bloodied". // Chance of spatter depends on severity of damage else if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= obj.get(`bar${BloodAndHonor.bar}_max`) / 2 &amp;&amp; prev[`bar${BloodAndHonor.bar}_value`] &gt; obj.get(`bar${BloodAndHonor.bar}_value`) &amp;&amp; obj.get(`bar${BloodAndHonor.bar}_value`) &gt; 0) { var m=parseInt(obj.get(`bar${BloodAndHonor.bar}_max`),10)||1, v=parseInt(obj.get(`bar${BloodAndHonor.bar}_value`),10)||1, r=randomInteger(m); if (r&gt;v) { var bloodMult = 1 + ((obj.get(`bar${BloodAndHonor.bar}_value`) - prev[`bar${BloodAndHonor.bar}_value`]) / obj.get(`bar${BloodAndHonor.bar}_max`)); BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize * bloodMult), BloodAndHonor.chooseBlood("spatter"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); } } // Create pool near token if health drops below 1. else if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= 0) { BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize * 1.5), BloodAndHonor.chooseBlood("pool"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); } } }); //Make blood trails, chance goes up depending on how injured a token is on("change:graphic:lastmove", function(obj) { if(isPlayerPage(obj.get('pageid')) &amp;&amp; BloodAndHonor.timeout === 0) { if (obj.get(`bar${BloodAndHonor.bar}_value`) &lt;= obj.get(`bar${BloodAndHonor.bar}_max`) / 2 &amp;&amp; (obj.get("gmnotes")).indexOf("noblood") == -1) { var m=parseInt(obj.get(`bar${BloodAndHonor.bar}_max`),10)||1, v=parseInt(obj.get(`bar${BloodAndHonor.bar}_value`),10)||1, r=randomInteger(m); if (r&gt;v) { BloodAndHonor.createBlood(obj.get("_pageid"), obj.get("left"), obj.get("top"), Math.floor(BloodAndHonor.tokenSize / 2), BloodAndHonor.chooseBlood("spatter"), BloodAndHonor.bloodColor(obj.get("gmnotes"))); BloodAndHonor.timeout += 2; } } } }); on("chat:message", function(msg) { if (msg.type == "api" &amp;&amp; msg.content.indexOf("!clearblood") !== -1) { if (!playerIsGM(msg.playerid)) { sendChat(msg.who,"/w " + msg.who + " You are not authorized to use that command!"); return; } else { let objects = filterObjs(function(obj) { return obj.get("type") == "graphic" &amp;&amp; obj.get("gmnotes") == "blood" &amp;&amp; isPlayerPage(obj.get('pageid')) ; }); _.each(objects, function(obj) { obj.remove(); }); } } }); });
1585195269
The Aaron
Roll20 Production Team
API Scripter
Hmm... It only becomes active when the token is below 50% health, and then there's a chance based on how damaged it is.&nbsp; Did you get it that low?&nbsp; If you want to PM me a join link and GM me, I can come take a look.
1585195833

Edited 1585196294
EFP
KS Backer
At that I did. I'll add you as a GM. PMed link.
1585197532
The Aaron
Roll20 Production Team
API Scripter
Joined!
Added you as GM. This is a copy of the table so no worries if you need to mess around. Game is shadows of the demonlord.
1585251715
The Aaron
Roll20 Production Team
API Scripter
cool.. will take a look after work!
Done with the game. Any idea on what the problem is?
1585265657
The Aaron
Roll20 Production Team
API Scripter
Ok, there are two problems: 1)&nbsp; The API can only create images with the thumb name, all of yours have the max name.&nbsp; For example: "<a href="https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/</a> max .png?1585128475", needs to be "<a href="https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/733737/9QAVylkn7yUHgHX2r5xjPw/</a> thumb .png?1585128475", 2) For some reason, your images don't have a thumb version!?&nbsp; I'm not sure what to recommend here.&nbsp; I guess remove them and re upload them.&nbsp; The thumb version is supposed to get created when the image is uploaded, so it's something on the Roll20 side that's causing the problem.&nbsp; I dropped a message to the Devs about this, but I don't know that there is any more expedient way forward than just re-uploading and checking if the thumb version gets created.&nbsp; I adjusted the script in your game to be a bit better about reporting when it's having problems.&nbsp; You should see things like this in the API Console:&nbsp; "ERROR: Please use the 'thumb' size for imgsrc properties." For now, the version that's on there is working with a different set of blood images.
Lets make sure I did them correctly. I downloaded all the PNGs Uploaded them into the Tokens Library under a single folder. For the URLs I copied the URL address form the folder Does that sound correct? The images do show up when you click the token and can be applied but not in the proper way.
1585281932
The Aaron
Roll20 Production Team
API Scripter
Try dragging them to the tabletop, selecting them, and hitting Z, then right click and copy the URL from there.&nbsp; See if that's a different URL than the one you got from the Library.&nbsp; I wouldn't think it would be different, but I always get URLs from the Zoom this way, so who knows...
1585282498
The Aaron
Roll20 Production Team
API Scripter
Ok, think we figured this out.&nbsp; The image urls you were copying were from a Token Marker set.&nbsp; Apparently uploaded Token Markers do not create the various versions of a graphic, including the thumb version the API needs.&nbsp; Uploading the images to the User Library via dropping them on a game map should fix that, though the URLs will still need to be collected for the game version.
Thanks, that me halfway there. CURRENTLY I had them in the user library already as a backup. Got that to work. Now to figure out how to get them to function consistently. It supposed to cause bleed when they take half and when they move. So far I can only get blood when they hit 0.
PROBLEMES CURRENTLY Only creates blood at 0 health Won't creat a trail. Won't create at half health When healed to full it won't do it again. The command to clear the blood doesn't function.