[5e Shaped Script] Version 11+

1498598175

Edited 1499955568
Kryx
Pro
Sheet Author
This script is designed to enhance the 5e Shaped Character sheet. It provides a variety of import methods, token & character  configuration services, and dynamic sheet enhancements (ammo, death save, HD processing etc). Full details of the functionality can be found in the documentation available  on github , along with a changelog listing fixes and features for each version. Installation You can find the latest script from github - you can also see the latest changelog and up-to-date documentation there as well. Copy the raw text of 5eShapedScript.js into a new script in your API settings (or paste it over your previous version if updating). Usage Please see the Github Documentation for full details on available command and other functionality. Problems and Bugs Issue Tracker
1498598280

Edited 1500108646
Kryx
Pro
Sheet Author
With Lucian gone I have released version 11.0.0 of the script with some help from Thorsten. Over the next few days or weeks I will migrate the code from where it currently exists over to bitbucket and create an issue repository there (Lucian suggested I do so). Everything should be working so for now enjoy: 11.0.0 (2017-06-27) Features added Hit dice to be recovered on a short rest ( 788c234 ) renamed Attacks to Offense and added Offense and Utility to !shaped-abilities allow custom saving throws ( 22b90f4 ) added more sanitizing of imported statblocks Bug Fixes Ammo now deducts on the latest version of the Shaped sheet. entity-lookup now searches for an apostrophe or a single quote when looking up names of monsters and spells ( 61c030e ) Having a "per use" of 0 now correctly does not remove a use Chat output from the sheet should be fixed (thanks Thorsten) Higher level dice for healing spells is fixed. (thanks Thorsten) BREAKING CHANGES config: Will not work with earlier versions of the Shaped Sheet
1498598731
The Aaron
Pro
API Scripter
Awesome!
Thank you, Kryx and Thorsten!
You have my thanks and Patreon-age Kryx!
1498657851
Yay!
This is completely trivial but, I'm running 11.0.0 and have verified the new features are present but the UI doesn't have the nice buttons just text links. This isn't a problem for me but I'm curious why that might be.
1498664369
Kryx
Pro
Sheet Author
Can you include a screenshot of what you mean?
Here you are Kryx.
1498666359
How difficult would it be to add stat block import support for the fifth edition foes?
1498666621
Kryx
Pro
Sheet Author
KiltedVaper said: Here you are Kryx. What is the problem with this behavior? As far as I can see it's the same as 10.0.1.
I saw this picture at the top post and thought it was supposed to look like this now. Sorry.
1498667314
Kryx
Pro
Sheet Author
Ah, that is the old behavior from long ago. Right now I just copied lucian's thread over. I'll be making updated to the OP in the next few days or weeks. ============ @Gary: 5th edition foes are not formatted like normal 5e monsters. Lucian and I agreed to focus all our effort on the 5th edition format. Parsing that format is actually incredibly complicated. Supporting a totally different format would be a lot of work. For example thw Aaztar-Ghola has an offense section with speed and attacks which makes very little sense and spellcasting doesn't match the 5e format. Short answer: Likely the only format that we'll ever support is the 5th edition format. It's unfortunate that the 5th edition foes publisher decided to use an entirely different format for not only readability and familiarity, but also for reasons like this.
1498678853
Wasn't sure- thanks for looking at it. I was wondering why they went to far off myself. Probably some type of licencing concern.
Thanks so much for updating this Kryx!
1498842239
Kryx
Pro
Sheet Author
I have updated the repository with an  Issue Tracker . Please file any bugs there. I likely won't do many feature requests for the script, but if they're simple I may.
1499266522
Good morning people. I would like to find or create spells that are not present in the SRD. Example: Frostbite. How can I do this? Is there any place where this code is available? If not, what format should I use in the API? Thank you in advance.
1499270228

Edited 1499270855
Mello, You can add that information directly to the 5eShaped Companion.js file. If you follow the existing format I believe you can add whatever you like to the Companion Database. ASSUMING YOU MANUALLY UPDATE YOUR COMPANION.JS FILE OTHERWISE AS KRYX STATED YOU WILL OVERWRITE YOUR CHANGES UPON UPDATE. MAKING IT A SEPARATE FILE IS WAY SMARTER. ShapedScripts.addEntities({"name":"SRD","version":"2.0.0" is the section you are looking for. I'm sure there is a better way, but this is the only way I know how if you want to use the Companion to apply these spells. UAOldBlackMagic SAMPLE ENTRY {"name":"Conjure Barlgura","level":4,"school":"Conjuration","castingTime":"1 action","range":"60 feet","components":{"verbal":true,"somatic":true},"duration":"up to 10 minutes","description":"You summon a barlgura that appears in an unoccupied space you can see within range. The barlgura disappears when it drops to 0 hit points or when the spell ends.\nThe barlgura is hostile to all non-demons. Roll initiative for the barlgura, which has its own turns. At the start of its turn, it moves toward and attacks the nearest non-demon it can perceive. If two or more creatures are equally near, it picks one at random. If it cannot see any potential enemies, the barlgura moves in a random direction in search of foes.\nAs part of casting the spell, you can scribe a circle on the ground using the blood of an intelligent humanoid slain within the past 24 hours. The circle is large enough to encompass your space. The summoned barlgura cannot cross the circle or target anyone in it while the spell lasts.","emote":"summons a Barlgura","concentration":true}
1499270340
Kryx
Pro
Sheet Author
KiltedVaper said: Mello, You can add that information directly to the 5eShaped Companion.js file. If you follow the existing format I believe you can add whatever you like to the Companion Database. Don't do this please. It will be lost when you use a new version. Create a new file with the same structure.
Kryx said: KiltedVaper said: Mello, You can add that information directly to the 5eShaped Companion.js file. If you follow the existing format I believe you can add whatever you like to the Companion Database. Don't do this please. It will be lost when you use a new version. Create a new file with the same structure. You're so right. I've gotten too used to manualy updating I make assumptions about other folks methods.
1499272664
Create a new script- name it whatever you like.  on('ready', function() { ShapedScripts.addEntities({ "version": "2.0.0", "classes": [ { "name": "ENTER CLASS HERE", "spells": [ "ENTER SPELL NAME HERE", "ENTER SPELL NAME HERE","ENTER SPELL NAME HERE","ENTER SPELL NAME HERE"] }], "spells": [ { ENTER YOUR SPELLS HERE FOLLOWING SRD FORMAT IN COMPANION SCRIPT }], "name": "WHAT YOU CALLED YOUR DATABASE" }); });
1499274730
BP
Pro
@Gary W: Check out this post.  Kryx posted a example
1499284567
Kryx
Pro
Sheet Author
KiltedVaper said: You're so right. I've gotten too used to manualy updating I make assumptions about other folks methods. Even of you do it manually that section will change so you'd have to diff the files to see what is different. Please don't use that method.
1499331128
Perhaps someone can help me out in finding my error. I created my own monster and was placing in the API format but everytime I run the sandbox it finds 1 error and I don't see it.  In the game all my APIs run fine but when pulling up the shaped-monsters list my monster does add.  I have no issues with all my added spells.  If you get a second can you look over to see if anything is missing. I left out the dependencies, version name and closing brackets on purpose.  Thanks "monsters":[{ "name":"Lucrecia", "size":"Large", "type":"Monstrosity", "alignment":"chaotic evil", "AC":"19 (natural armor)", "HP":"218 (18d10 + 72)", "speed":"30 ft., climb 30 ft., swim 30 ft.", "strength":24, "dexterity":21, "constitution":19, "intelligence":16, "wisdom":14, "charisma":25, "savingThrows":"Con +9, Cha +12", "skills":"Acrobatics +10, Arcana +8, Deception +12, History +8, Intimidate +12, Persuasion +12", "damageResistances":"pyschic", "conditionImmunities":"charmed", "senses":"darkvision 60 ft.", "languages":"Abyssal, Common, Draconic, Giant, Sylvan, Thassilonian", "challenge":"13", "traits":[{"name":"Legendary Resistance","text":"If the lucrecia fails a saving throw, it can choose to succeed instead.","recharge":"3/Day"},{"name":"Innate Spellcasting","text":"The lucrecia innate spellcasting ability is Charisma (spell save DC 20). It can innately cast the following spells, requiring no material components.\nAt Will: charm person, major image\n3/day each: mirror image, scrying, suggestion\n1/day each: dream, geas"},{"name":"Spellcasting","text":"The lucrecia is an 9th-level spellcaster. Its spellcasting ability is Charisma (spell save DC 20, +12 to hit with spell attacks). The lucrecia has the following cleric and sorcerer spells prepared:\nCantrips (at-will): blade ward, mage hand, mending, prestidigitation, sacred flame\n1st level (4 slots): cure wounds, divine favor, magic missile\n2nd level (3 slots): blindness/deafness, invisibility\n3rd level (3 slots): counterspell, haste\n4th level (3 slots): confusion, ice storm\n5th level (1 slot): dominate person, flame strike"}], "actions":[{"name":"Multiattack","text":"The lucrecia can use its Intoxicating Touch. It then makes two attacks with its scimitars."},{"name": "Scimitar","text":"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) slashing damage."},{"name":"Intoxicating Touch","text":"Melee Spell Attack: +12 to hit, reach 10 ft. one target. Hit: The target is magically cursed for 1 hour. Until the curse ends, the target has disadvantage on Wisdom saving throws and all ability checks."},{"name":"Change Shape","text":"The lucrecia magically polymorphs into a Medium or smaller size humanoid that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the lucrecia's choice).\nIn a new form, the lucrecia retains its alignment, hit points, Hit Dice, ability to speak, proficiencies,Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form."}], "legendaryPoints":3,"legendaryActions":[{"name":"Cantrip","text":"The lucrecia casts a cantrip.","cost":1},{"name":"Wisdom Drain","text":"Melee Spell Attack: +12 to hit, reach 10 ft., one creature. Hit: 17 (3d6+7) psychic damage, and the target's Wisdom score is reduced by 1d4. The target dies if this reduces its Wisdom to 0. Otherwise, this reduction lasts until the target finishes a short or long rest.","cost":2},{"name":"Intoxicating Gaze","text":"The lucrecia fixes its gaze on one creature it can see withing 30 feet of it. The target must succeed on a DC 20 Wisdom saving throw against this magic or take 10 (3d6) psychic damage and become stunned for 1 minute. The stunned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lucrecia's gaze for the next 24 hours.","cost":2}]}
1499333034

Edited 1499333050
Kryx
Pro
Sheet Author
Looks like you didn't close the array at the end. Try: { "monsters": [ { "name": "Lucrecia", "size": "Large", "type": "Monstrosity", "alignment": "chaotic evil", "AC": "19 (natural armor)", "HP": "218 (18d10 + 72)", "speed": "30 ft., climb 30 ft., swim 30 ft.", "strength": 24, "dexterity": 21, "constitution": 19, "intelligence": 16, "wisdom": 14, "charisma": 25, "savingThrows": "Con +9, Cha +12", "skills": "Acrobatics +10, Arcana +8, Deception +12, History +8, Intimidate +12, Persuasion +12", "damageResistances": "pyschic", "conditionImmunities": "charmed", "senses": "darkvision 60 ft.", "languages": "Abyssal, Common, Draconic, Giant, Sylvan, Thassilonian", "challenge": "13", "traits": [ { "name": "Legendary Resistance", "text": "If the lucrecia fails a saving throw, it can choose to succeed instead.", "recharge": "3/Day" }, { "name": "Innate Spellcasting", "text": "The lucrecia innate spellcasting ability is Charisma (spell save DC 20). It can innately cast the following spells, requiring no material components.\nAt Will: charm person, major image\n3/day each: mirror image, scrying, suggestion\n1/day each: dream, geas" }, { "name": "Spellcasting", "text": "The lucrecia is an 9th-level spellcaster. Its spellcasting ability is Charisma (spell save DC 20, +12 to hit with spell attacks). The lucrecia has the following cleric and sorcerer spells prepared:\nCantrips (at-will): blade ward, mage hand, mending, prestidigitation, sacred flame\n1st level (4 slots): cure wounds, divine favor, magic missile\n2nd level (3 slots): blindness/deafness, invisibility\n3rd level (3 slots): counterspell, haste\n4th level (3 slots): confusion, ice storm\n5th level (1 slot): dominate person, flame strike" } ], "actions": [ { "name": "Multiattack", "text": "The lucrecia can use its Intoxicating Touch. It then makes two attacks with its scimitars." }, { "name": "Scimitar", "text": "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) slashing damage." }, { "name": "Intoxicating Touch", "text": "Melee Spell Attack: +12 to hit, reach 10 ft. one target. Hit: The target is magically cursed for 1 hour. Until the curse ends, the target has disadvantage on Wisdom saving throws and all ability checks." }, { "name": "Change Shape", "text": "The lucrecia magically polymorphs into a Medium or smaller size humanoid that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the lucrecia's choice).\nIn a new form, the lucrecia retains its alignment, hit points, Hit Dice, ability to speak, proficiencies,Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form." } ], "legendaryPoints": 3, "legendaryActions": [ { "name": "Cantrip", "text": "The lucrecia casts a cantrip.", "cost": 1 }, { "name": "Wisdom Drain", "text": "Melee Spell Attack: +12 to hit, reach 10 ft., one creature. Hit: 17 (3d6+7) psychic damage, and the target's Wisdom score is reduced by 1d4. The target dies if this reduces its Wisdom to 0. Otherwise, this reduction lasts until the target finishes a short or long rest.", "cost": 2 }, { "name": "Intoxicating Gaze", "text": "The lucrecia fixes its gaze on one creature it can see withing 30 feet of it. The target must succeed on a DC 20 Wisdom saving throw against this magic or take 10 (3d6) psychic damage and become stunned for 1 minute. The stunned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lucrecia's gaze for the next 24 hours.", "cost": 2 } ] } ] }
1499334751
Made sure everything was closed throughout the addEntries for the monster and still does not show up on the list for shaped-monster.  There isn't anything spell that needs to be added to the file perhaps?  I'll show my whole file which as I was mentioning is an addentry for the primary of v11.0.0. (Snippit) ShapedScripts.addEntities({ "name":"TravisCreations", "dependencies":["SRD"], "version":"2.0.0", "monsters":[{ "name":"Lucrecia", ....snippit..... "legendaryPoints":3,"legendaryActions":[ {"name":"Cantrip","text":"The lamia matriarach casts a cantrip.","cost":1}, {"name":"Wisdom Drain","text":"Melee Spell Attack: +12 to hit, reach 10 ft., one creature. Hit: 17 (3d6+7) psychic damage, and the target's Wisdom score is reduced by 1d4. The target dies if this reduces its Wisdom to 0. Otherwise, this reduction lasts until the target finishes a short or long rest.","cost":2}, {"name":"Intoxicating Gaze","text":"The lamia matriarach fixes its gaze on one creature it can see withing 30 feet of it. The target must succeed on a DC 20 Wisdom saving throw against this magic or take 10 (3d6) psychic damage and become stunned for 1 minute. The stunned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lamia matriarach's gaze for the next 24 hours.","cost":2} ] } ]});
1499335260
Could be there something with the skills?  So far only twice when I run !shaped-monsters it has shown this error but when I rune the command a again it gives me the monster list minus my monster.
1499387949
No need to look into my above issue with the monster not appearing on the list.   I figured out my error.  Thanks though for checking into it.  I had the skill Intimidiation as Intimidate.
1499794260
Hello guys. I'll fine-tune the SRD and add PHD spells, I wonder if I do it the following way, in a new JS file, will work: on ('ready', function () { ShapedScripts.addEntities ( { "name": "SRD", "version": "2.0.0", "spells": [ { "name": "Acid Splash", "level": 0, "school": "Conjuration", "castingTime": "1 action", "range": "60 feet", "components": { "verbal": true,  "somatic": true }, "duration": "Instantaneous", "description": "You hurl a bubble of acid. Choose one creature within range, or choose two creatures within range that are within 5 feet of each other. A target must succeed on a Dexterity saving throw or take 1d6 acid damage.", "higherLevel": "This spell's damage increases by 1d6 when you reach 5th level (2d6), 11th level (3d6), and 17th level (4d6).", "emote": "hurls a bubble of acid", "save": { "ability": "Dexterity",  "damage": "[[ceil((@{level} + 2) / 6)]]d6",  "damageType": "acid" } }, { "name": "Aid", ... } ] } ); ShapedScripts.addEntities( { "name": "PHB", "dependencies": ["SRD"], "version": "2.0.0", "spells": [ { "name": "Arcane Gate", ... }, { "name": "Armor of Agathys", ... } ] } ); }); Thank you in advance.
Just as a note Mello, you can't add the Player's Handbook stuff to a public script file. Doing so would violate WOTC's copyright. Doing it for your own private copy is fine though, as long as you don't share it anywhere.
1499795682
Kryx
Pro
Sheet Author
As mentioned before please do not add custom data to the main script. It will be lost when you update the script. Add it as its own file. I need to minify the script to prevent any confusion here.
1499800507

Edited 1499804997
Thank you so much guys. One more doubt. What is ceil ? "attack": { "type": "ranged",  "damage": "[[ ceil ((@{level} + 2) / 6)]]d10",  "damageType": "fire" } Thank you in advance one more time.
Mello said: Thank you so much guys. One more doubt. What is ceil ? Ceil is short for ceiling and will round up to the nearest integer. https://wiki.roll20.net/Dice_Reference#Math_Operators_and_Functions H
I'm having an issue using the UI to display a token action for the things the npc can do in a turn (e.g.-Multiattack, Attack1, Attack2...). Every other Token Action I enabled shows up as a button in a bar (Ability Checks, Init, Saving Throws & StatBlock).  I have a second issue in that when I right-click the token and select 'Add Turn', it doesn't add the npc to the turn tracker.  I can get the initiative to display in the chat using 'Init' Token Action button, but that's about as far as I can get with that.   I suspect I know the answer to this one, but I'll ask anyway:  What do I need to do to change the display UI for attacks?  Right now, I have to click StatBlock and I can click on an attack and it will put the results in the chat.  There's nothing wrong with the UI inherently other than I'm not crazy about the look.  My suspicion is that I need to figure out what the label for each attack is and substitute portions of a Power Card script with the attack label.  
Brandon S. said: I'm having an issue using the UI to display a token action for the things the npc can do in a turn (e.g.-Multiattack, Attack1, Attack2...). Every other Token Action I enabled shows up as a button in a bar (Ability Checks, Init, Saving Throws & StatBlock).  I have a second issue in that when I right-click the token and select 'Add Turn', it doesn't add the npc to the turn tracker.  I can get the initiative to display in the chat using 'Init' Token Action button, but that's about as far as I can get with that.   I suspect I know the answer to this one, but I'll ask anyway:  What do I need to do to change the display UI for attacks?  Right now, I have to click StatBlock and I can click on an attack and it will put the results in the chat.  There's nothing wrong with the UI inherently other than I'm not crazy about the look.  My suspicion is that I need to figure out what the label for each attack is and substitute portions of a Power Card script with the attack label.   You can use "traitsMacro" and "actionsMacro" to have two buttons for NPC abilities and attacks. Or "traits" and "actions" if you want each ability or attack to have it's own button.
As I understand it, the output style is dictated by the Roll Template for the Shaped Sheet. If you are satisfied with the functionality, but want to change the styling, you might have some luck using Stylish to replace the appropriate CSS. But it seems like a pretty huge task.
1499901801
BP
Pro
Brandon S. said: I'm having an issue using the UI to display a token action for the things the npc can do in a turn (e.g.-Multiattack, Attack1, Attack2...). Every other Token Action I enabled shows up as a button in a bar (Ability Checks, Init, Saving Throws & StatBlock).  I have a second issue in that when I right-click the token and select 'Add Turn', it doesn't add the npc to the turn tracker.  I can get the initiative to display in the chat using 'Init' Token Action button, but that's about as far as I can get with that.   I suspect I know the answer to this one, but I'll ask anyway:  What do I need to do to change the display UI for attacks?  Right now, I have to click StatBlock and I can click on an attack and it will put the results in the chat.  There's nothing wrong with the UI inherently other than I'm not crazy about the look.  My suspicion is that I need to figure out what the label for each attack is and substitute portions of a Power Card script with the attack label.   I'm a bit confused, are you creating generic macros for all tokens, or using the !shaped-abilities command to auto generate macros from NPC actions, or the !shaped-config setting for macro generation? If it's the config setting, I think that only applies to new sheets (I don't use this). If you're using a generic macro the you need to use something like: %{selected|repeating_action_$0_roll} Where the $0 is the number of the action going top to bottom of the list starting at 0. If using the shaped abilities to create the macros I suggest something like this: !shaped-abilities --actions Refer the to the script documentation for more details on the command. (linked in the first post) Rright-clicking to "Add Turn" is a Roll20 option and not related to the script. This should add the token to the "Turn Tracker" with a 0 initiative. It does not pop up the Turn tracker. This is my generic token macro for rolling Initiative: %{selected|shaped_initiative}
1499955094
BP
Pro
FYI the link to the raw text of the script in the first post goes to a 404 page. I think it should be: https://raw.githubusercontent.com/mlenser/roll20-api-scripts/master/5eShapedScript/5eShapedScript.js
1499955612
Kryx
Pro
Sheet Author
Fixed, thanks!
1500067281
Kryx
Pro
Sheet Author
11.1.0 Features Added a command list which can be spawned with !shaped Chores Updated to the latest webpack, used yarn, and a myriad of other coding fixes
This last one makes me smile. :)
1500074193
Kryx said: 11.1.0 Features Added a command list which can be spawned with !shaped Sometimes you have no idea you needed something until it's there. Great addition!
Yay Bringing KeithCurtis and Kryx Together For the Win!!!
1500511831
Is there a way to set up always advantage on one save only?
Is there a input form or guidance on how to format the JSON for adding additional information? I have some custom variant of spells, and other content I'd like to make sure when I'm importing to PC character sheets, or using the script to generate monsters, that it populates the spells/class features with the updates.
1500538699

Edited 1500538834
Kryx
Pro
Sheet Author
Stephen R. said: Is there a way to set up always advantage on one save only? No. Modnar Wylde said: Is there a input form or guidance on how to format the JSON for adding additional information? I have some custom variant of spells, and other content I'd like to make sure when I'm importing to PC character sheets, or using the script to generate monsters, that it populates the spells/class features with the updates. The script has tons of examples in the first few lines. Take that code and format it so it's readable (there are many javascript formatters on the web) and you can see how to format it. Class features is only what exists on the sheet. The script can't impact it.
Thank you.
1500598921
Well your skill system has an adv always on feature. I just set up a skill for the PC to use when rolling the save that has advantage. Perhaps this feature could be added in the future? Anyway, fantastic sheet. I really like it. Great work. 
1500605889

Edited 1500607241
So, for some reason I can't seem to use the !shaped-spells or !shaped-monsters command anymore. It was working a week ago. Tonight, it's just not doing anything at all.  "5eShapedScript 1500605988872 INFO : -=> ShapedScript v11.1.0 <=-" "5eShapedScript 1500605991071 INFO : Detected sheet version as : 15.1.1" It looks like it's not loading anything from the SRD examples in the Companion Script. EDIT: So, the Spells by Query works, but not the Spells List that used to show up in chat. Monsters by Query works as well, but not Monsters List.