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

[Script] D&D 5e Shaped NPC & Spell Importer

1440373287
Kryx
Pro
Sheet Author
API Scripter
Black Falcon said: Trying to use the heal with the new spells but it's not adding the caster attribute.  It is just roll the dice. This sounds like a sheet issue, not a script issue. I do not see this issue though. If I cast healing word with int (-1) set as my casting stat and roll a 4 I get a total of 3. Please clarify on that thread if the sheet is not doing what you expect.
1440375299
Falcon
Pro
Sheet Author
I have the August 12th sheet and this is the output: Rolling 1D4 + 4 + ((1+({{Spell cast as level = 1}}) -1) *0) + ((1 +({{spell_cast_as_level=1}}) -1)*0)4[higher level] = (1) SO even through it says 1D4 +4 which is accurate it is only showing the value of 1 after it does all of this.  It's almost like it is either ignoring or subtracting 4. 
1440375432
Kryx
Pro
Sheet Author
API Scripter
Again, this is a sheet issue, not an importer issue. You're a pro. Update to the latest version and any higher level issues are gone. The issue you see above has been brought up several times on the sheet thread.
1440375459
Falcon
Pro
Sheet Author
it does it accurately without the higher level query.  So the problem is with the higher level query.
1440375517
Falcon
Pro
Sheet Author
Ok - the thread is extensive and didn't review it.  If it's fixed on a later sheet - I will get it fixed via that.
I might have missed this in the many pages of this thread...but is there a way to allow my players to use the !spell-shaped command to import spells to their sheets without making them GMs of my campaign?
1440461096
Kryx
Pro
Sheet Author
API Scripter
Mike said: I might have missed this in the many pages of this thread...but is there a way to allow my players to use the !spell-shaped command to import spells to their sheets without making them GMs of my campaign? There is no limit on who can use the commands.
Odd.  I had a player attempt to import a spell to his sheet and nothing happened.  but if I opened his sheet and imported a spell it worked as intended.  I will do a couple more test attempts with different players to see how it goes and report back.
I have created a macro specifically for my players to import spells and have yet to have a problem. I do have to remind them on occasion to select their token before using the macro. Here is what I use: !shaped-spell --?{Select Spell|Abi-Dalzim&#39s Horrid Wilting|Absorb Elements|Acid Splash|Aganazzar&#39s Scorcher|Aid|Alarm|Alter Self|Animal Friendship|Animal Messenger|Animal Shapes|Animate Dead|Animate Objects|Antilife Shell|Antimagic Field|Antipathy/Sympathy|Arcane Eye|Arcane Gate|Arcane Lock|Armor of Agathys|Arms of Hadar|Astral Projection|Augury|Aura of Life|Aura of Purity|Aura of Vitality|Awaken|Bane|Banishing Smite|Banishment|Barkskin|Beacon of Hope|Beast Bond|Beast Sense|Bestow Curse|Bigby&#39s Hand|Blade Barrier|Blade Ward|Bless|Blight|Blinding Smite|Blindness/Deafness|Blink|Blur|Bones of the Earth|Branding Smite|Burning Hands|Call Lightning|Calm Emotions|Catapult|Chain Lightning|Charm Person|Chill Touch|Chromatic Orb|Circle of Death|Circle of Power|Clairvoyance|Clone|Cloud of Daggers|Cloudkill|Color Spray|Command|Commune|Commune with Nature|Compelled Duel|Comprehend Languages|Compulsion|Cone of Cold|Confusion|Conjure Animals|Conjure Barrage|Conjure Celestial|Conjure Elemental|Conjure Fey|Conjure Minor Elementals|Conjure Volley|Conjure Woodland Beings|Contact Other Plane|Contagion|Contingency|Continual Flame|Control Flames|Control Water|Control Weather|Control Winds|Cordon of Arrows|Counterspell|Create Bonfire|Create Food and Water|Create or Destroy Water|Create Undead|Creation|Crown of Madness|Crusader&#39s Mantle|Cure Wounds|Dancing Lights|Darkness|Darkvision|Daylight|Death Ward|Delayed Blast Fireball|Demiplane|Destructive Wave|Detect Evil and Good|Detect Magic|Detect Poison and Disease|Detect Thoughts|Dimension Door|Disguise Self|Disintegrate|Dispel Evil and Good|Dispel Magic|Dissonant Whispers|Divination|Divine Favor|Divine Word|Dominate Beast|Drawmij&#39s Instant Summons|Dominate Monster|Dominate Person|Dream|Druidcraft|Dust Devil|Earth Tremor|Earthbind|Earthquake|Eldritch Blast|Elemental Bane|Elemental Weapon|Enhance Ability|Enlarge/Reduce|Ensnaring Strike|Entangle|Enthrall|Erupting Earth|Etherealness|Evard&#39s Black Tentacles|Expeditious Retreat|Eyebite|Fabricate|Faerie Fire|False Life|Fear|Feather Fall|Feeblemind|Feign Death|Find Familiar|Find Steed|Find the Path|Find Traps|Finger of Death|Fireball|Fire Bolt|Fire Shield|Fire Storm|Flame Arrows|Flame Blade|Flame Strike|Flaming Sphere|Flesh to Stone|Fly|Fog Cloud|Forbiddance|Forcecage|Foresight|Freedom of Movement|Friends|Frostbite|Gaseous Form|Gate|Geas|Gentle Repose|Giant Insect|Glibness|Globe of Invulnerability|Glyph of Warding|Goodberry|Grasping Vine|Grease|Greater Invisibility|Greater Restoration|Guardian of Faith|Guards and Wards|Guidance|Guiding Bolt|Gust|Gust of Wind|Hail of Thorns|Hallow|Hallucinatory Terrain|Harm|Haste|Heal|Healing Word|Heat Metal|Hellish Rebuke|Heroes&#39 Feast|Heroism|Hex|Hold Monster|Hold Person|Holy Aura|Hunger of Hadar|Hunter&#39s Mark|Hypnotic Pattern|Ice Knife|Ice Storm|Identify|Illusory Script|Immolation|Imprisonment|Incendiary Cloud|Inflict Wounds|Insect Plague|Investiture of Flame|Investiture of Ice|Investiture of Stone|Investiture of Wind|Invisibility|Jump|Knock|Legend Lore|Leomund&#39s Secret Chest|Leomund&#39s Tiny Hut|Lesser Restoration|Levitate|Light|Lightning Arrow|Lightning Bolt|Locate Animals or Plants|Locate Creature|Locate Object|Longstrider|Maelstrom|Mage Armor|Mage Hand|Magic Circle|Magic Jar|Magic Missile|Magic Mouth|Magic Stone|Magic Weapon|Major Image|Mass Cure Wounds|Mass Heal|Mass Healing Word|Mass Suggestion|Maximilian&#39s Earthen Grasp|Maze|Meld into Stone|Melf&#39s Acid Arrow|Melf&#39s Minute Meteors|Mending|Message|Meteor Swarm|Mind Blank|Minor Illusion|Mirage Arcane|Mirror Image|Mislead|Misty Step|Modify Memory|Mold Earth|Moonbeam|Mordenkainen&#39s Faithful Hound|Mordenkainen&#39s Magnificent Mansion|Mordenkainen&#39s Private Sanctum|Mordenkainen&#39s Sword|Move Earth|Nondetection|Nystul&#39s Magic Aura|Otiluke&#39s Freezing Sphere|Otiluke&#39s Resilient Sphere|Otto&#39s Irresistible Dance|Pass without Trace|Passwall|Phantasmal Force|Phantasmal Killer|Phantom Steed|Planar Ally|Planar Binding|Plane Shift|Plant Growth|Poison Spray|Polymorph|Power Word Heal|Power Word Kill|Power Word Stun|Prayer of Healing|Prestidigitation|Primordial Ward|Prismatic Spray|Prismatic Wall|Produce Flame|Programmed Illusion|Project Image|Protection from Energy|Protection from Evil and Good|Protection from Poison|Purify Food and Drink|Pyrotechnics|Raise Dead|Rary&#39s Telepathic Bond|Ray of Enfeeblement|Ray of Frost|Ray of Sickness|Regenerate|Reincarnate|Remove Curse|Resistance|Resurrection|Reverse Gravity|Revivify|Rope Trick|Sacred Flame|Sanctuary|Scorching Ray|Scrying|Searing Smite|See Invisibility|Seeming|Sending|Sequester|Shape Water|Shapechange|Shatter|Shield|Shield of Faith|Shillelagh|Shocking Grasp|Silence|Silent Image|Simulacrum|Skywrite|Sleep|Sleet Storm|Slow|Snilloc&#39s Snowball Swarm|Spare the Dying|Speak with Animals|Speak with Dead|Speak with Plants|Spider Climb|Spike Growth|Spirit Guardians|Spiritual Weapon|Staggering Smite|Stinking Cloud|Stone Shape|Stoneskin|Storm of Vengeance|Storm Sphere|Suggestion|Sunbeam|Sunburst|Swift Quiver|Symbol|Tasha&#39s Hideous Laughter|Telekinesis|Telepathy|Teleport|Teleportation Circle|Tenser&#39s Floating Disk|Thaumaturgy|Thorn Whip|Thunderous Smite|Thunderclap|Thunderwave|Tidal Wave|Time Stop|Tongues|Transmute Rock|Transport via Plants|Tree Stride|True Polymorph|True Resurrection|True Seeing|True Strike|Tsunami|Unseen Servant|Vampiric Touch|Vicious Mockery|Vitriolic Sphere|Wall of Fire|Wall of Force|Wall of Ice|Wall of Sand|Wall of Stone|Wall of Thorns|Wall of Water|Warding Bond|Warding Wind|Water Breathing|Water Walk|Watery Sphere|Web|Weird|Whirlwind|Wind Walk|Wind Wall|Wish|Witch Bolt|Word of Recall|Wrathful Smite|Zone of Truth} I also added a line to the import to whisper the owner of the sheet in addition to the GM when a spell is imported
Well, I feel noobish.  Where/how am I supposed to place the spells to get them to import?  I always get the "Error: cannot find a spell by the name of X" message.
1441214155
Kryx
Pro
Sheet Author
API Scripter
Replace the square brackets in "spellData = [];" with the square brackets from the spell data.
1441214962

Edited 1441215001
Kryx said: Replace the square brackets in "spellData = [];" with the square brackets from the spell data. OH!  Thank you very much for answering a question you already did!  I was just misunderstanding, and trying to do this the same way as MM entries.  This script is amazing!
1441330092

Edited 1441377640
OK I am at a total loss here. I was using the script late last night without much issue other than not copying the statblock data correctly confusing the script etc ... but then around 1:40AM it just up and quit working. I had not made any changes as of that time to the script other than turning the max, link and show off. So I went investigating after work today and put a bunch of log('') into the script to see what it is doing. Here is what is confusing me I apologize for the confusing formatting, have not figured out how to make it pretty. But trust me it is exactly what is on github as of an hour ago. if(msg.type !== 'api') { return; } log('msg.content: ' + msg.content); var args = msg.content.split(/\s+--/); switch(args[0]) { case '!build-monster': case '!shaped-parse': case '!shaped-import': if(args[1] && args[1] === 'clean') { shaped.getSelectedToken(msg, shaped.deleteOldSheet); } shaped.getSelectedToken(msg, shaped.importStatblock); break; case '!shaped-rollhp': shaped.getSelectedToken(msg, shaped.rollTokenHp); break; case '!shaped-settings': args.shift(); shaped.changeSettings(args); break; case '!shaped-spell': args.shift(); shaped.getSelectedToken(msg, shaped.spellImport, args); break; case '!shaped-convert': shaped.getSelectedToken(msg, shaped.parseOldToNew); break; case '!shaped-token-macro': shaped.getSelectedToken(msg, shaped.tokenMacros, args); break; } } When I save off the script if I enter !shaped-import I get nothing from the in the log but if I enter an invalid api command such as !shaped I get the following in the log: "Shaped Scripts ready" "In Handle Input" "msg.content: !shaped" The additional "In Handle Input" is one of the addition log('') I put in to see which functions the script was executing. I just don't understand why the script will only give me the msg result when I enter something illegal but not when when I enter something legal.
BP said: I have created a macro specifically for my players to import spells and have yet to have a problem. I do have to remind them on occasion to select their token before using the macro. Here is what I use: I also added a line to the import to whisper the owner of the sheet in addition to the GM when a spell is imported I don't suppose you could PM what line and change this was? (Forgive me. I'm crap at this stuff)
1441360893
Kryx
Pro
Sheet Author
API Scripter
@Shadowspawn: Nothing has changed on the script. Maybe roll20's servers just died? Try taking the latest code from github, change your settings, and then put it in the API.
1441593291

Edited 1441596832
So, I've been trying to import the Xorn and I think it's breaking something in the script. When I try importing the Xorn, nothing happens and the script stops responding to commands. There is nothing in the output to indicate an error, either. This is the stat block I've been trying: XORN Medium elemental, neutral Armor Class 19 (natural armor) Hit Points 73 (7d8 + 42) Speed 20 ft., burrow 20 ft. STR 17 (+3) DEX 10 (+0) CON 22 (+6) INT 11 (+0) WIS 10 (+0) CHA 11 (+0) Skills Perception +6, Stealth +3 Damage Resistances piercing and slashing from nonmagical weapons that aren't adamantine Senses darkvision 60 ft., tremorsense 60 ft., passive Perception 16 Languages Terran Challenge 5 (1800 XP) Earth Glide . The xorn can burrow through nonmagical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through. Stone Camouflage . The xorn has advantage on Dexterity (Stealth) checks made to hide in rocky terrain. Treasure Sense . The xorn can pinpoint, by scent, the location of precious metals and stones, such as coins and gems, within 60 feet of it. ACTIONS Multiattack . The xorn makes three claw attacks and one bite attack. Claw . Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit : 6 (1d6 + 3) slashing damage. Bite . Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit : 13 (3d6 + 3) piercing damage. The script works just fine up until I try importing the Xorn. (I've also tried the stat block from the MM, same thing happens... nothing :P ) The script ceases to work until I disable, then re-enable it. I can import other monsters again, but stops again when trying the Xorn. I just wanna know if I'm the only one with this issue.
1441601690

Edited 1441601751
I can't get your Xorn stat block to import either.  I tested with another monster to make sure the API was working.  Made sure I had the newest version of the script, etc.  I used !build-monster to build one monster and it worked fine.  Then I tried a token with the Xorn stats and it killed all scripts in my game until I re-saved them.  I grabbed the block from my scan of my monster manual and got the same results. XORN M e dium ele m e ntal , neutr a l Armor Class 19 . (natural armor) Hit Points 73 (7d8 + 42) Speed 20 ft., burrow 20ft. STR 17 (+3) DEX 10 (+0) CON 22 (+6) Skills Perception +6, Stealth +3 INT 11 (+0) WI S 10 (+0) CHA 11 (+0) Damage Resistances piercing and slashing from non mag i cal weapons that aren't adamantine Senses darkvision 60ft., tremorsense 60ft., passive Perception 16 Languages Terran Challenge 5 (1 ,800 XP) Earth Glide. The xorn can burrow through non magical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through. Stone Camouflage. The xorn has advantage on Dexterity (Stealth) checks made to hide in rocky terrain . Treasure Sense. The xorn can pinpoint, by scent, the location of precious metals and stones, such as coins and gems, within 60 feet of it. ACTIONS Multiattack. The xorn makes three claw attacks and one bite attack. Claw. Melee Weapon Attack: + 6 to hit, reach 5 ft., one target. Hit: 6 (ld6 + 3) slashing damage. Bite. Melee Weapon Attack: +6 to hit , reach 5 ft., one target . Hit: l3 (3d6 + 3) piercing damage
Seems like a crazy random issue like the Earth Elemental :P
1441663380
Kryx
Pro
Sheet Author
API Scripter
Yup, something random. Maybe it's a combination that I parse. No idea. Try removing sections until it works.
It's something to do with/about the word "adamantine" and/or the period at the end of the line. Adding a "." to the line "Damage Resistances piercing and slashing from non magical weapons that aren't adamantine" makes it work.  I tried it with both of our stat blocks with the same result.
Khrain said: It's something to do with/about the word "adamantine" and/or the period at the end of the line. Adding a "." to the line "Damage Resistances piercing and slashing from non magical weapons that aren't adamantine" makes it work.  I tried it with both of our stat blocks with the same result. That's odd, and thanks :) Now I'm all done with my Imports except for legendaries ^^
Hello every one, So, noob question here..  Where can i find the Stat blocks i can copy and paste? All I have are the hard backs. 
1441987524
Kryx
Pro
Sheet Author
API Scripter
Scott M. said: Where can i find the Stat blocks i can copy and paste? All I have are the hard backs.  In the free rules, or a PDF if you have one of those.
Saevar L. "Liquid-Sonic" said: BP said: I have created a macro specifically for my players to import spells and have yet to have a problem. I do have to remind them on occasion to select their token before using the macro. Here is what I use: I also added a line to the import to whisper the owner of the sheet in addition to the GM when a spell is imported I don't suppose you could PM what line and change this was? (Forgive me. I'm crap at this stuff) Sorry for taking awhile to get back: With the full spell text it about line 13250: var message = spell.name + ' imported for ' + characterName + ' on spell level ' + spell.level + ' at index ' + spellIndex; log(message); sendChat('GM', '/w gm ' + message); added -->>      sendChat('GM', '/w '+ characterName + ' ' + message); }; I added the one line : sendChat('GM', '/w '+ characterName + ' ' + message);
1442053118

Edited 1442053156
Kryx
Pro
Sheet Author
API Scripter
Sep 11th 2015 (1.95) Import custom skills (this will import any unknown skill to the custom skills area) Sep 12th 2015 (1.96) Spell import default to male if there is no gender specified (previously errored out) Spells have been moved to their own file Included dist versions of the script to make it easier for others to use
Thanks for all of this! :D
1442098452
Lucian
Pro
API Scripter
Hey, I think I've found a minor issue with the interaction between the importer and the hit point rolling function. I'm not sure if something has changed (either with this script or roll20 somehow), but I don't remember this being a problem last time I checked, but that could just be bad memory on my part. 1) Create a token, add creature text to GM notes 2) !shaped-import 3) set the token as the default token for the character 4) drop an instance of the character on the map Expected result: HP should be rolled automatically according to the HD of the creature and set on the new token Actual result: HP are rolled, and reported correctly in the chat window, but the actual HP on the token always ends up as the average. After sticking a bit of extra debugging in there and playing with a few things, what I believe is happening here is that the script is setting the auto-rolled HP on the token *before* roll20 comes along and sets the HP from the value that was save on the default token for the character sheet. I have bar1 set to link: false. Removing the current and max values from the token after import but before setting as default for the character fixes the problem, but I assume the intention is for this to work "out of the box" based on the imported version of the character sheet. I'm using version 1.96 of the script. Cheers, Lucian
1442101857

Edited 1442102412
Lucian H. said: Hey, I think I've found a minor issue with the interaction between the importer and the hit point rolling function. I'm not sure if something has changed (either with this script or roll20 somehow), but I don't remember this being a problem last time I checked, but that could just be bad memory on my part. 1) Create a token, add creature text to GM notes 2) !shaped-import 3) set the token as the default token for the character 4) drop an instance of the character on the map Expected result: HP should be rolled automatically according to the HD of the creature and set on the new token Actual result: HP are rolled, and reported correctly in the chat window, but the actual HP on the token always ends up as the average. After sticking a bit of extra debugging in there and playing with a few things, what I believe is happening here is that the script is setting the auto-rolled HP on the token *before* roll20 comes along and sets the HP from the value that was save on the default token for the character sheet. I have bar1 set to link: false. Removing the current and max values from the token after import but before setting as default for the character fixes the problem, but I assume the intention is for this to work "out of the box" based on the imported version of the character sheet. I'm using version 1.96 of the script. Cheers, Lucian I made the same mistake when I first switched to using the script. The script presumes that you are using Bar 3 for HP. I had to redo all my PC tokens so I wasn't getting confused with the bars. Also, default NPCs should never have their stats linked, so you can run multiple off the same sheet (You can link and then unlink them so they have the average stats before you save).
1442102824
Kryx
Pro
Sheet Author
API Scripter
On phone, so shorter answers. The script should allow you to change which bar is used. I use 3, but it should be one of the parameters. Linking is also optional. I do not suggest linking hp in most cases. AC is fine. I can test tomorrow if the problem persists.
1442108549

Edited 1442108925
Kryx said: On phone, so shorter answers. The script should allow you to change which bar is used. I use 3, but it should be one of the parameters. Linking is also optional. I do not suggest linking hp in most cases. AC is fine. I can test tomorrow if the problem persists. The order of lines 35-50 can be changed to set which bar does what, but after seeing it in the script, I preferred using Bar 3 for HP anyway so I changed my PC tokens to match (They were only a few sessions in, so they were fine with the change)
1442129498
Lucian
Pro
API Scripter
Hey, For the avoidance of doubt, here is my "bar" array from the top of the script:  bar: [       /* Setting these to a sheet value will set the token bar value. If they are set to '' or not set then it will use whatever you already have set on the token        Do not use npc_HP, use HP instead        */       {         name: 'HP', // Red bar         max: true,         link: false,         show: false       }, {         name: 'speed', //Blue bar 'speed'         max: false,         link: true,         show: false       }, {         name: 'passive_perception', // Green bar         max: false,         link: true,         show: false       },     ]
Hi Kryx, I've been using your npc importer with much happiness and just managed to get your spell importer working and still haven't picked my jaw up off the floor... One thing I've noticed (and others perhaps -&nbsp; <a href="https://app.roll20.net/forum/post/2409363/token-to" rel="nofollow">https://app.roll20.net/forum/post/2409363/token-to</a>... ) is that if I place a token, cut and paste the stat block in, and use !build-monster, all goes swimmingly, but there's another step I have to do before I can drag monsters from the journal entry to the table. &nbsp;I have to either edit the character to give it an avatar (which since I almost always want to use the token seems as if it shouldn't be necessary) or I have to edit the character to use the default token (which still doesn't give it a picture.) Would it be possible to copy the token image to the character avatar on character sheet generation? &nbsp;Can anyone give me a few lines of code to add to the API script do this if it's fairly straightforward? &nbsp;Or a macro even to do this in the general case? Also, when I drag a creature with an avatar but no token onto the table, the avatar image is used as the token, and the hit point dice rolling occurs correctly, but bar1 and bar2 don't get set as desired, presumably because this only happens for the original token. &nbsp;What do you think about the hit point rolling function also setting the other two bars to the requested initial state in this circumstance? &nbsp;I ask because this particularly applies when characters are being exported and imported between games, since the avatar image seems to survive the trip, but not the default token. Thanks.
1442150947
Kryx
Pro
Sheet Author
API Scripter
Sredni Vashtar said: Would it be possible to copy the token image to the character avatar on character sheet generation? &nbsp;Can anyone give me a few lines of code to add to the API script do this if it's fairly straightforward? &nbsp;Or a macro even to do this in the general case? Also, when I drag a creature with an avatar but no token onto the table, the avatar image is used as the token, and the hit point dice rolling occurs correctly, but bar1 and bar2 don't get set as desired, presumably because this only happens for the original token. &nbsp;What do you think about the hit point rolling function also setting the other two bars to the requested initial state in this circumstance? &nbsp;I ask because this particularly applies when characters are being exported and imported between games, since the avatar image seems to survive the trip, but not the default token. Setting a default token is a restriction that roll20 does not allow. I think avatar is the same, but I'm unsure. Dragging on to the map requires a default token as far as I'm aware. If it isn't working for an avatar then it needs a default token.
Thanks for the reply. &nbsp;Dragging a character onto the map works with just an avatar set, it's just that the other bars don't automatically get set. &nbsp;They could do if the hit point rolling callback set all three bars (as applicable.) &nbsp;Otherwise a default token is needed. &nbsp;It seems odd that it is possible for API scripts to create tokens and set their imgsrc and other properties, but not to be able to change the imgsrc of the avatar of a character. Another dumb question: &nbsp;If I've selected a token, is there any simple way to open the character sheet to which it is linked without going into the journal? &nbsp;The only workaround I've come up with is to square bracket the character name in the GM field so that I can clink on the hyperlink, but again, that seems more complicated than it should be.
1442163211
Lucian
Pro
API Scripter
Hi, I think there may be another minor issue withe HP rolling. Currently the system calculates a single die expression for the total of all the HD and then executes that. I believe that technically this is slightly incorrect, since each hit die should contribute a minimum of 1 HP, irrespective of CON modifier. I noticed this when creating some very weak monsters (1d4-1 HP!), some of whom started off dead :-)&nbsp; A crude approximation would be to say that the minimum HP should be equal to the total number of HD/levels, but obviously this doesn't account for the fact that a creature could have e.g. 3 HD and a CON penalty of -1, and might roll 2,1, & 4. It easily meets the minimum of 3 HP, but you could argue that it has been cheated out of 1 HP if you simply roll it as 3d4-3 (giving 4HP) rather than 3 separate rounds of&nbsp;[[ {1d4-1, 0d1+1}kh1 ]] (which would result in 5HP with the same roll). (Thanks to HoneyBadger for the kh1 expression!) Of course, rolling individual hit dice is mainly really relevant for PCs - the Monster Manual seems fairly blasé about it (HPs are just given as single total expressions). Besides, I can't find any monsters with more than 1HD who have a CON penalty. So I think that using the "crude approximation" would probably be a reasonable solution here. I've just stuck a Math.max(result, totalLevels) in my copy of the script at the moment, which seems to work ok, but I guess you could incorporate into the die expression if you wanted it to be a bit neater. Cheers, Lucian
Lucian H. said: Hi, I think there may be another minor issue withe HP rolling. Currently the system calculates a single die expression for the total of all the HD and then executes that. I believe that technically this is slightly incorrect, since each hit die should contribute a minimum of 1 HP, irrespective of CON modifier. I noticed this when creating some very weak monsters (1d4-1 HP!), some of whom started off dead :-)&nbsp; A crude approximation would be to say that the minimum HP should be equal to the total number of HD/levels, but obviously this doesn't account for the fact that a creature could have e.g. 3 HD and a CON penalty of -1, and might roll 2,1, & 4. It easily meets the minimum of 3 HP, but you could argue that it has been cheated out of 1 HP if you simply roll it as 3d4-3 (giving 4HP) rather than 3 separate rounds of&nbsp;[[ {1d4-1, 0d1+1}kh1 ]] (which would result in 5HP with the same roll). (Thanks to HoneyBadger for the kh1 expression!) Of course, rolling individual hit dice is mainly really relevant for PCs - the Monster Manual seems fairly blasé about it (HPs are just given as single total expressions). Besides, I can't find any monsters with more than 1HD who have a CON penalty. So I think that using the "crude approximation" would probably be a reasonable solution here. I've just stuck a Math.max(result, totalLevels) in my copy of the script at the moment, which seems to work ok, but I guess you could incorporate into the die expression if you wanted it to be a bit neater. Cheers, Lucian Hold [Shift] when you double click on a token and it'll open the character sheet. Once you have a token set up, just set it as the default and everytime you drag it out, the bars will be all set up for you. Just don't Link the HP to the character sheet, otherwise when you damage one monster, all other copys of that monster will take damage too.
1442168168
Kryx
Pro
Sheet Author
API Scripter
I don't quite understand the 2 current issues. @Sredni: You must use a default token to get bars. Avatar will not work. Bars are set on a token. You can also shift double click a token to get it's journal. @Lucian: Do you have a rules source that the minimum hp gained per level is 1?
Mike said: Odd. &nbsp;I had a player attempt to import a spell to his sheet and nothing happened. &nbsp;but if I opened his sheet and imported a spell it worked as intended. &nbsp;I will do a couple more test attempts with different players to see how it goes and report back. Something probably did happen, it's just the player didn't see it. &nbsp;The default code for the shaped scripts only sends text output to the GM. &nbsp;The changes I make on each edit are: 1.) Find & Replace: &nbsp; sendChat('GM' with sendChat('Shaped' ...so that the sheet shows that it's from "Shaped" instead of just from the GM. 2.) After //userAaronsNumberedScript insert a new line that says: showCharacterShapedSpellOutput: true, //when a shaped-spell import is run, send a message to the character as well as the GM. ...so that you have the option to turn off whether or not you want the character to ALSO see the message. 3.) In the function shaped.importSpell, replace: sendChat('Shaped', '/w gm ' + message); with sendChat('Shaped', '/w gm ' + message); if(shaped.settings.showCharacterShapedSpellOutput) { sendChat('Shaped', '/w "' + characterName + '" ' + message); } ...which will send a message to the GM as normal, but also send a message to the owner of the token being updated.
1442172472
Kryx
Pro
Sheet Author
API Scripter
Sep 13th 2015 (1.97) Fixed higher level query toggle on spells. Logs are now sent in chat to whoever invokes the command
1442174362
Lucian
Pro
API Scripter
Well, I'll be damned. I could have sworn that was in the rules somewhere; there are a lot of other *similar* rules relating to ability penalties (e.g. damage can never be less than 1), but nothing explicit about HP and CON modifiers. The closest I can get is Mike Mearls saying this:&nbsp; <a href="http://www.sageadvice.eu/2015/04/08/hp-and-negativ" rel="nofollow">http://www.sageadvice.eu/2015/04/08/hp-and-negativ</a>... ; but it's not Jeremy Crawford so you might not see that as gospel. Either way, there's still a problem with Tiny 1HD creatures starting as dead. Lots of tiny creatures in the MM have HP: 1 (1d4-1) . This means that they start dead a quarter of the time with auto-rolled HP. I guess you could just put in a "Math.max(totalHP, 1)" as a more conservative solution. Perhaps another option in the script settings?
1442174543
Kryx
Pro
Sheet Author
API Scripter
That link is good enough for me. I can set that up soon. Probably not tonight.
1442181018
Lucian
Pro
API Scripter
BTW, I just pulled the latest and there's a bug with the new messageToChat function - if you get there by a route that doesn't involve an api message in the chat (e.g. dropping a token on the canvas), commandExecuter is null so the indexOf call blows up. You've probably already spotted it, but I thought I'd mention it just in case! Thanks for all your work on this, BTW. It's fantastically useful and I really appreciate it, even if most of the time I comment is when I find problems/want something new! :-) Cheers, Lucian
1442181347
Kryx
Pro
Sheet Author
API Scripter
I fixed that if you pull the latest. Currently doing the HP, almost done.
1442181467

Edited 1442181535
Kryx
Pro
Sheet Author
API Scripter
Sep 13th 2015 (1.98) Avatar of a creature is set to the token's image source if you've uploaded the image Hp rolling now has a minimum of 1 per level I'm glad you appreciate it. :) I work in software so I'm used to people pointing out bugs - it just makes the product better. Thanks :)
1442184806
Lucian
Pro
API Scripter
You rock! That looks great :-) Interestingly, the problem I was having before with rolled HP not being applied also seems to have gone away... which leads me to another question (sorry!): what do you do about unique NPCs? Although most of my "NPCs" are actually mooks for whom I want to roll HP, some of them are unique indviduals for whom I want fixed HP. Might it be possible to have HP rolling behaviour be an option on the character sheet (with a default set by the option in the script?) Cheers, Lucian
1442184902
Kryx
Pro
Sheet Author
API Scripter
For specific NPCs I usually link the hp. I believe that prevents the rolling.
1442190507
Lucian
Pro
API Scripter
Yeah, this is what I thought, but it looks like I'm getting bitten by the other side of the problem I was having before. I stuck a log statement into the graphic:added handler and dumped the new token object: {"_id":"-Jz88vX15Gaizcm0lUUE","_pageid":"-JytiX0nC2cGZArNwphy","left":977,"top":154,"width":70,"height":70,"rotation":0,"layer":"objects","isdrawing":false,"flipv":false,"fliph":false,"imgsrc":"<a href="https://s3.amazonaws.com/files.d20.io/images/11074701/D2AqoqE5-Pm7PkVIjzWJZw/thumb.png?1437928650&quot;,&quot;name&quot;:&quot;&quot;,&quot;gmnotes&quot;:&quot;&quot;,&quot;controlledby&quot;:&quot;&quot;,&quot;bar1_value&quot;:&quot;&quot;,&quot;bar1_max&quot;:&quot;&quot;,&quot;bar1_link&quot;:&quot;&quot;,&quot;bar2_value&quot;:&quot;&quot;,&quot;bar2_max&quot;:&quot;&quot;,&quot;bar2_link&quot;:&quot;&quot;,&quot;bar3_value&quot;:&quot;&quot;,&quot;bar3_max&quot;:&quot;&quot;,&quot;bar3_link&quot;:&quot;&quot;,&quot;represents&quot;:&quot;-Jz6vF6xvDberySTZm1r&quot;,&quot;aura1_radius&quot;:&quot;&quot;,&quot;aura1_color&quot;:&quot;#FFFF99&quot;,&quot;aura1_square&quot;:false,&quot;aura2_radius&quot;:&quot;&quot;,&quot;aura2_color&quot;:&quot;#59E594&quot;,&quot;aura2_square&quot;:false,&quot;tint_color&quot;:&quot;transparent&quot;,&quot;statusmarkers&quot;:&quot;&quot;,&quot;showname&quot;:false,&quot;showplayers_name&quot;:false,&quot;showplayers_bar1&quot;:false,&quot;showplayers_bar2&quot;:false,&quot;showplayers_bar3&quot;:false,&quot;showplayers_aura1&quot;:false,&quot;showplayers_aura2&quot;:false,&quot;playersedit_name&quot;:true,&quot;playersedit_bar1&quot;:true,&quot;playersedit_bar2&quot;:true,&quot;playersedit_bar3&quot;:true,&quot;playersedit_aura1&quot;:true,&quot;playersedit_aura2&quot;:true,&quot;light_radius&quot;:&quot;&quot;,&quot;light_dimradius&quot;:&quot;&quot;,&quot;light_otherplayers&quot;:false,&quot;light_hassight&quot;:false,&quot;light_angle&quot;:&quot;&quot;,&quot;light_losangle&quot;:&quot;&quot;,&quot;light_multiplier&quot;:1,&quot;sides&quot;:&quot;&quot;,&quot;currentSide&quot;:0,&quot;lastmove&quot;:&quot;&quot;,&quot;_type&quot;:&quot;graphic&quot;,&quot;_subtype&quot;:&quot;token&quot;,&quot;_cardid" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/11074701/D2AqoqE5-Pm7PkVIjzWJZw/thumb.png?1437928650","name":"","gmnotes":"","controlledby":"","bar1_value":"","bar1_max":"","bar1_link":"","bar2_value":"","bar2_max":"","bar2_link":"","bar3_value":"","bar3_max":"","bar3_link":"","represents":"-Jz6vF6xvDberySTZm1r","aura1_radius":"","aura1_color":"#FFFF99","aura1_square":false,"aura2_radius":"","aura2_color":"#59E594","aura2_square":false,"tint_color":"transparent","statusmarkers":"","showname":false,"showplayers_name":false,"showplayers_bar1":false,"showplayers_bar2":false,"showplayers_bar3":false,"showplayers_aura1":false,"showplayers_aura2":false,"playersedit_name":true,"playersedit_bar1":true,"playersedit_bar2":true,"playersedit_bar3":true,"playersedit_aura1":true,"playersedit_aura2":true,"light_radius":"","light_dimradius":"","light_otherplayers":false,"light_hassight":false,"light_angle":"","light_losangle":"","light_multiplier":1,"sides":"","currentSide":0,"lastmove":"","_type":"graphic","_subtype":"token","_cardid</a>":""} I've also got a simple api script that dumps the selected token when requested. I ran this immediately after the token had been added to the canvas, and got this: {"_id":"-Jz88vX15Gaizcm0lUUE","_pageid":"-JytiX0nC2cGZArNwphy","left":977,"top":154,"width":70,"height":70,"rotation":0,"layer":"objects","isdrawing":false,"flipv":false,"fliph":false,"imgsrc":"<a href="https://s3.amazonaws.com/files.d20.io/images/11074701/D2AqoqE5-Pm7PkVIjzWJZw/thumb.png?1437928650&quot;,&quot;name&quot;:&quot;Melia" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/11074701/D2AqoqE5-Pm7PkVIjzWJZw/thumb.png?1437928650","name":"Melia</a> Moonstaff","gmnotes":"","controlledby":"","bar1_value":26,"bar1_max":26,"bar1_link":"-Jz79UPtiMOkePluBCvL","bar2_value":"","bar2_max":"","bar2_link":"","bar3_value":"","bar3_max":"","bar3_link":"","represents":"-Jz6vF6xvDberySTZm1r","aura1_radius":"","aura1_color":"#FFFF99","aura1_square":false,"aura2_radius":"","aura2_color":"#59E594","aura2_square":false,"tint_color":"transparent","statusmarkers":"","showname":false,"showplayers_name":false,"showplayers_bar1":false,"showplayers_bar2":false,"showplayers_bar3":false,"showplayers_aura1":false,"showplayers_aura2":false,"playersedit_name":true,"playersedit_bar1":true,"playersedit_bar2":true,"playersedit_bar3":true,"playersedit_aura1":true,"playersedit_aura2":true,"light_radius":"","light_dimradius":"","light_otherplayers":false,"light_hassight":false,"light_angle":"","light_losangle":"","light_multiplier":1,"sides":"","currentSide":0,"lastmove":"785,150","_type":"graphic","_subtype":"token","_cardid":""} As you can see, it's the same token, but when it first appeared (as supplied to the HP rolling functions) it was pretty much bare apart from the "represents" value and the position. Shortly afterwards it now has a name and bar details that it didn't have the first time round. This causes two problems: First time around the script doesn't know that the token's HP bar is linked, so it runs HP rolling when it shouldn't It seems like *sometimes* when the script writes to the token to set HP, this gets overwritten immediately afterwards by the value from the character sheet at the point that the token gets "filled out", and *sometimes* it happens the other way round. Since this looks like a race condition, I stuck a setTimeout in the add:graphic handler as follows: on('add:graphic', function(obj) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(obj); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setTimeout(function() { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(obj); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shaped.rollTokenHp(obj); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, 1000); Sure enough, the "obj" changes between the two log calls - all the bar details get filled in. Putting the timeout in there also means that the code now behaves correctly - no rolls for linked bars, reliable rolls for non-linked ones. Have you ever seen anything like this before? I can't see anything else in my other scripts that could be causing this, and, from the behaviour, it seems most likely to be a feature of how Roll20 itself is handling the token. Is it a bug? At the very least it seems unhelpful behaviour.... Or have I got this completely wrong? Cheers, Lucian
1442212223
Kryx
Pro
Sheet Author
API Scripter
I remember raising this or something similar as a bug to roll20. They were unconcerned. Though I don't know what you mean by "reliable rolls". I don't have any issues with normal rolls. Not sure about linked ones.
1442217737
Lucian
Pro
API Scripter
Fair enough. By "reliable rolls" I simply meant that with the setTimeout in place the auto HP rolling is reliably applied to tokens, rather than sometimes getting overwritten by the parallel Roll20 process in the background. Would you consider including a&nbsp; setTimeout (maybe try 200ms?) in the handler for add:graphic as a workaround for the time being? I'm getting this problem a lot at the moment (I guess it will be a question of server load and possibly client latency, so will vary for people) and it would be helpful to remove the non-deterministic behaviour. I will try and create a minimal test case and report to Roll20 separately. Cheers, Lucian
1442219359
Kryx
Pro
Sheet Author
API Scripter
Lucian H. said: the auto HP rolling is reliably applied to tokens, rather than sometimes getting overwritten by the parallel Roll20 process in the background. I've never had the hp rolling not work. You're saying sometimes it doesn't apply to the token??? Lucian H. said: I will try and create a minimal test case and report to Roll20 separately. I did a while ago.&nbsp; <a href="https://app.roll20.net/forum/post/2149510/api-toke" rel="nofollow">https://app.roll20.net/forum/post/2149510/api-toke</a>... They basically said they won't prioritize fixing it (I suggested using promises) Lucian H. said: Would you consider including a&nbsp; setTimeout (maybe try 200ms?) in the handler for add:graphic as a workaround for the time being? I'm getting this problem a lot at the moment (I guess it will be a question of server load and possibly client latency, so will vary for people) and it would be helpful to remove the non-deterministic behaviour. As mentioned in the post above the timeout period would still be a race condition. It would likely work in most cases, but not all. If you're getting lag then it won't fix it unless I put a lengthy timeout. I haven't experienced any issues with hp rolling. I've used it for months. Maybe my response time to the server is low. *shrug* If I put a speed limiter on myself I may experience it as well. I haven't seen any others bring up this issue though. Can you describe exactly what is happening? You drop the token, hp is rolled, but then replace by roll20's hp? That shouldn't happen under any conditions that I know of.