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] SpellMaster - 5e OGL Spell Handling Script

1556981588

Edited 1581190296
GM Michael
API Scripter
UPDATE :  See Thread 2   See Thread 3 I've had a campaign running for almost two years now, and at least at my table, I use a large number of house ruled spells.  The 5e SRD has 319.  Stock 5e has 456.  My table has 708.  Over time, this had led to frustration again and again as my players have been forced to manually import spells rather than just pulling them in from the compendium.  Furthermore, the OGL sheet can't filter spells by any criteria at all, leaving my players frustrated whenever they blank on the name of a spell or want to know what they can cast while silenced. We could have switched to the  Shaped Sheet , but in my experience, its performance under load is much worse than OGL.  External tools like Donjon are great, but don't support homebrew. Roll20 claims to be hard at work securing the rights for more elaborate compendiums, but this only addresses part of the problem, and certainly not the homebrew aspect. That's what led to this script.  (Special thanks to people in the other thread  for your help!) SpellMaster SpellMaster is an Airbag -compatible script specifically built to be expandable and to allow DMs to add homebrew content.  The SRD spells are all provided.  To add additional spells, make use of the Export feature (or manually edit the SRD.js file). SpellMaster is intended as a total replacement for the Spells page of the OGL character sheet in normal play with several additional key features that go beyond the default spells page. Features Instant Import : Instantly add any spell (even homebrew!) in your master spell list to a character's spellbook.  Additionally, you can import a class's entire spell list to a spellbook during setup so your poor Druids and Clerics don't die of old age in Session 0. Class List Perusing : Peruse all spells your character could  know and easily swap them in and out. Filtering : filter by VSM, Ritual, Concentration, Preparedness, Slots Remaining, and the inverse of all of these.  General string search and cast time filtering are also provided. Preparation Lists : Create and configure independent lists of prepared spells for every scenario. Locking : Supports spells that are both conditionally prepared and always prepared, even those that can be used a finite number of times a day without expending slots. Performance : SpellMaster is built to support games with hundreds of spells in play without slowing to a crawl. Compendium Interface : SpellMaster has a automated system to allow you to import spells from your purchased compendium expansions and then export them into your private spell list. Homebrew Support : Utilizing the same export system, you can add or update house spells. Macro Support : Macros of the commands SpellMaster uses are valid. Casting & Slot Tracking : This would hardly be a spell manager if you couldn't cast or track slots. Setup 1. Install SRD.js  (contains the SRD spell list) and  SpellMaster.js  (contains the logic) as API scripts in your game. 2. If you have a lot of homebrew or purchased compendium spells, skip down to the Export section of this post and return here when you're done. 3. Create a Handout with a unique name of your choice such as "Tazeka's Spells."  Give Tazeka's player access to the handout.  This handout will become Tazeka's spellbook, fully replacing all need for the 5e OGL sheet's Spells page. 4. Run the command below to bring up the chat menu. !SpellMaster --Menu 5. In the chat window, a simple menu will appear.  Press [Create Spellbook].  You will be prompted for a couple fields.  Fill them out. 6. Navigate to the handout and see that it's been populated!  Tazeka now has a dedicated spellbook! 7. I recommend going to Tazeka's character sheet and adding the below to the Bio & Info tab, replacing it of course with your own spellbook name.  (SpellMaster automatically generates the link from spellbook to character sheet.  The below is an example link from character sheet to spellbook.) [Tazeka's Spells] Operation Filtering At the top of the sheet, you'll see the ability to filter by presence (or absence!) of VSM components, as well as concentration, ritual, preparedness, slots remaining, cast time, and a general string search.  String search checks spell names, descriptions, notes, and classes for the provided string.  Regex strings are not supported at this time. Tools Long Rest : It will refill all slots to their maximum.  In the future, I may consider adding a UI to create spells, but my table has a dedicated file for homebrew spells and I have a parser for it already, so I doubt I'll ever get around to it. Level Up : This flushes the cache and reconstructs the maximum slot count.  Press this once upon level-up.  It supports full casters, half-casters, third-casters, pact magic, and any combination of the above.  Note that this does NOT update current slots, only maximum.  Some GMs allow level-up immediately after combat, so I didn't want to prevent that from working. Refresh Cache : SpellMaster relies heavily on internal data caching to keep things running as smoothly as possible for you.  This means the first time you load your sheet per session, you can expect a little hitch as it pulls in all the data so it never has to again.  Well, mostly.  If you hit this button, you'll force it to dump its cache and build a new one.  You shouldn't need to do this except in cases like acquiring an item that changes your spellcasting ability modifier. Prepared This counter takes the form of... [Currently Prepared] / [Class1 MaxPreparation] ([Class1 Name]) / [Class2 MaxPreparation]... This counter does not include Locked spells (see below).  It also does not restrict a user from over-preparing as there are simply too many ways that could be legitimate, so it simply marks how many are prepared and its best guess for how many you should have prepared at most. Spells Spells appear within their level in alphabetical order.  What a given spell looks like will make more sense with an example, so here's a spell I wrote. Level 1 Spells - [4] / [4] - [...] : The initial line denotes the spell level and current spell slots.  Click on a number to change it.  Currents can be higher than maximums, but Long Rest will set everything back to the maximum.  The [...] (not shown in the outdated screenshot) displays all knowable spells for you for the specified level.  They appear as a list ihe chat menu where you can add or remove knowledge of them. [_] Azdregath's Opulent Ooze (R) - [-] : The line with the spell's name on it has several features. [_] : Clicking on this empty checkbox will mark it as prepared.  Prepared spells are marked with [X] .  Cantrips are always checked. Azdregath's Opulent Ooze : Clicking this link will attempt to cast the spell.  See casting details below. (R) : SpellMaster flags any Rituals or Concentration spells with tags at this location. [-] : Pressing this will collapse the details of the spell and turn it into [+] instead. [0] / [0] : Should you have a spell you can cast a finite number of times a day without expending a spell slot (such as certain racial features or possession of a magical item), you can edit its current slots and maximum slots here.  If these are non-zero, they will appear in the name line of a spell instead of only being visible when you expand the spell. Details: The next several lines simply provide the details for the spell, just as you'd expect. Ability : Clicking on this will allow you to choose the spellcasting ability for this spell.  If you select "Manual DC," you will see an option appear below this to set that to whatever you like.  If you do so, any spell attack for this spell will have a modifier 8 less than the DC. Notes : Clicking on this allows you to edit the notes for a spell.  I recommend things like "From Artificer" for multiclassing or "Utility" so that the Search function can find this spell easier.  There's usually no need to specify things like "VS Undead" because of prepared spell lists (below). Classes: This is the list of classes that a spell belongs to.  Because of the way my parsers work, SRD also shows up as a class. [Delete] : This brings up a confirmation box to delete the spell from this spellbook. [Lock] : This Locks a spell as permanently prepared, handy for classes with permanently prepared spells like Sorcerers, Druids, or Clerics.  I also use it for items.  If a spell is locked, its preparedness checkbox will show up not as [_] or [X] , but rather [O]  and it will not count toward the preparedness counter at the top of the page.  However, if you filter by preparedness, a Locked spell is counted as prepared and will show up. The plus button at the end of a spell level allows you to import a new spell from the master spell list by name. Preparation Lists As before, it's easier with a picture. These function as radio buttons: press the checkbox for one and the others are unchecked.  Any preparedness changes you make to a spell on one preparation list are unique to that list.  Locked spells are global to the spellbook and do not change between preparedness lists.  The parenthetical number is the number of prepared spells in that list. Click on a list's name to change it, the [-] to delete it, or the [+] to add a new one. Casting Spells with SpellMaster When you cast a spell with SpellMaster, you'll first be presented (if needed) with a list of spell levels you can cast the spell at.  If you have per-spell slots, it will automatically consume them before taking up your main slots. Upon selecting a level, the spell card will be sent according to the character sheet's whisper options.  Rolls within the table are automatically calculated.  If there is a spell attack, it will appear at the top (otherwise defaulting to 0), and the caster's relevant spellcasting ability DC will be posted in all cases. Spell Export If you have homebrew or purchased compendium content, the steps below show you how to replace SRD.js with a list specifically for your table. Create a character sheet.  I'll call it  House Spells . Open your Compendium.  Filter by spells. Begin the arduous process of dragging and dropping all those spells into House Spells.  For each, you must manually fill out the Class field with a list of classes (ie "Druid, Warlock, Wizard") because the character sheet doesn't autopopulate that for some reason.  You can skip any that are already in the SRD. Add any additional homebrew spells you allow at your table.  If you have any special alterations to existing spells, include them as well.  Just make sure the name is unchanged and the exporter will take your new version and ignore the stock version.  If you wish to rename or ban a spell at your table, name the spell either RENAME|Old Name|New Name or DELETE|Banned Spell Name . Once you're done with that, bring up the chat menu with  !SpellMaster --Menu  and press  [Export Homebrew] .  This will bring up a dialog option in which you will type the character sheet name (in the example case, House Spells).  Begin export. After waiting for a while (this could be a few seconds or a few minutes, depending on how much homebrew and compendium content you have), the export will finish and you can navigate over to House Spells'  Bio & Info  tab where you'll find yourself face-to-face with a spell list file just for your table.  I'll call it HouseSpells.js. Copy HouseSpells.js's text and create a new API script for it and paste it in there.  Save the new file to trigger an automatic API restart.  The API will likely crash at this point.  This is fine. After the API comes back up or crashes, disable SRD.js.  (Theoretically, you could delete it, but I'd recommend holding onto the original version in case you need it.)  This will trigger an automatic API restart. After it comes back up, your players will be able to import your homebrew and purchased compendium content just as they would any SRD spell. Performance Part of what influenced my decision to do this was I wanted a solution that could be performant at all levels of play.  For this reason... The master spell list is stored in an API script (to avoid sucking up a surprising amount of the 2 MB cap of state and not cause a performance hitch from trying to parse it out of something like gmnotes).  Expensive operations are cached, so that only part of the page has to be regenerated at a time. Spellbooks are in handouts rather than the main character sheet because loading a character sheet can take a painfully long time at higher levels.  However, for your convenience, the top of a spellbook contains an automatically-generated link to the character sheet. Known Bugs Roll Clone Roll is cloned and clones do not match. Summary : When whispering rolls to both the GM and the player, the rolls sent to the recipients may not match.  Detailed in this thread. Workaround : Configure player rolls to not be whispered to GM or give the GM ownership of all player characters. Resolution : To fix this, I will likely need to build a full-blown Roll20 roll parser, something I am not  looking forward to.  On the upside, if I go for broke, I imagine I can get my code to run faster than Roll20's because I won't be using quantum rolls anymore. Roadmap : Because this change would require manual construction of a lot of HTML in any event, I suspect I would fix this the same time I fix the Zero-Zero bug. Zero-Zero When spells are cast that do not have an attack roll, they have 0|0 on them. Summary : The HTML template used does not work correctly. Workaround : Ignore it.  It's not hurting anything except your eyes. Resolution : I'll need to build my own roll template, which I am not  looking forward to, but it should mean somewhat better performance. Roadmap : This'll be a pretty big change in practice, and it is liable to include the Roll Clone fix as well. Releases 1.0: Initial Release 1.1: Add whisper inheritance, add manual DCs 1.2: Advanced Caching and Homebrew Export are in. 1.3: Export now handles all levels automatically for you. .1: Fixed a minor spell preparation bug for Druids and Clerics. 1.4: Add cast time filtering, add rename and delete to export .1: Rituals now count as non-combat, even if they otherwise wouldn't 1.5: Add knowables printing, improve spell slot count algorithm 1.6: Add support for sorcery points. Future Work A few things I'd like to add in the future... Usability Bug Fixes : Obviously bug fixes improve things. Regex Searching : It's a handy feature. String Proximity Correction : When a user mistypes a spell, calculate the Levenshtein Distance to suggest what they probably meant to type. Shaped Sheet Compatibility : This is a looooong way off, but it'd be nice to have. One-Click Install : I think I may have to make SRD.js a standalone and have it be the dependency of this script, or perhaps merge it all and have it be overridable by another script a user adds. Features Short Rest Recharge : Certainly, I can't fully  support every conceivable thing that happens on short rest, but I can at least add something.   Most notably, I would like to support pact magic recharging. Variable Recharge Rates : allow certain things (like items) to regenerate non-standard amounts. Track Modifiers : most notably, this would allow tracking metamagic. Improved NPC Support : Devise some system to support unnamed NPC casters. Ritual Casting : Allow ritual spells to be cast as rituals to not consume slots. Slotless Casting : Allow users to "cast" a spell without consuming resources, such as when you want another tick of damage.
1557171093
Ziechael
Forum Champion
Sheet Author
API Scripter
This looks really useful, I'll have to find time to have a play around with it.
1557196301
Wes
Sheet Author
I love everything about this script, except that the output is only whispered to the gm. Any Plans on enabling other modes of chat output?
1557202613

Edited 1557204193
GM Michael
API Scripter
1.1 uploaded.  SpellMaster now inherits from the character sheet when it comes to whether or not spellcasts are whispered.  Additionally, you can now manually specify the DC in case you have an item. Recently, things seem slower due to an increasing number of sheet access operations, so 1.2 is liable to be focused optimization rather than features.  The intent will be drastically expanding what can be cached.  Hopefully I can get some hard numbers on what exactly the performance is, but I aim for users to suffer as little lag as the API allows. A few things I'm aiming for Improved Granularity: right now, the spell list as a whole is cached as a single block. I aim to break this up by spell level and possibly even by spell, depending on performance. Sheet Dependency Reduction: I suspect a good deal of the present hitching is due to sheet accesses.  I aim to minimize these by allowing the user to set a caching grade with the ability to flush the sheet cache with a new tool.  Specifically, my ideas for caching levels are... None: direct sheet access every time. Full: caching is always done and only manual purges (and API restarts) cause sheet hits.
1557248354
Ziechael
Forum Champion
Sheet Author
API Scripter
I may have done something wrong but I'm getting the following with the SpellMaster and SRD scripts installed: ReferenceError: SpellList is not defined
1557249179
GiGs
Pro
Sheet Author
API Scripter
Did you install them in the correct order? SRD first
1557253072
Ziechael
Forum Champion
Sheet Author
API Scripter
I did... but will do it again just in case I actually didn't lol...
1557253817
Ziechael
Forum Champion
Sheet Author
API Scripter
Apparently I didn't lol... thanks for the catch GiGs, serves me right for having both open in tabs to make copy/pasting 'easier'! Now... to play!!!
1557254193
GiGs
Pro
Sheet Author
API Scripter
Hehe, it's easily done.  I recommend OP tweak both scripts so that install order is not necessary, because it's inevitable that this will happen. Maybe use a version of the module pattern mentioned in the wiki, and have the srd.js script embedded in a function that the spellmaster script has access to. 
1557255026
Ziechael
Forum Champion
Sheet Author
API Scripter
At first glance this looks really useful, especially for full caster classes (wizards, clerics and druids most of all). How would one go about setting it up for an Eldritch Knight for example?
1557255753
Ziechael
Forum Champion
Sheet Author
API Scripter
Also, minor thing: Bane has a spelling mistake ("Spelslot") in the higher level casting description... I've check the rest of the code for the same error and it is the only one. When casting a spell from the handout, each template sent to chat for spells without attacks starts with a : 0|0 rolling 0d1 for the nonexistent attack. Spells with attacks roll as expected but don't have anything prefixing the roll, just the ':' rather than 'Attack' or some other descriptor. All in all though, so far so very very useful!
GiGs said: Hehe, it's easily done.  I recommend OP tweak both scripts so that install order is not necessary, because it's inevitable that this will happen. Maybe use a version of the module pattern mentioned in the wiki, and have the srd.js script embedded in a function that the spellmaster script has access to.  I have them as two scripts because I personally don't actually use SRD.js.  I have my own heavily modified one for my own table.  Not wanting to risk accidentally committing that one to github, I have it as a standalone file and I just hadn't bothered to make installation order reversible.  Having said that, I plan for 1.2 to be reversible. Ziechael said: At first glance this looks really useful, especially for full caster classes (wizards, clerics and druids most of all). How would one go about setting it up for an Eldritch Knight for example? It actually does support automatic population of all caster classes (including half and third), but it lies to the user and tells them it doesn't because I've not tested that as thoroughly as I'd like.  In the intervening time, you can just manually set your maximum spell slots to what the PHB says they should be and go from there, importing spells you have. Ziechael said: Also, minor thing: Bane has a spelling mistake ("Spelslot") in the higher level casting description... I've check the rest of the code for the same error and it is the only one. When casting a spell from the handout, each template sent to chat for spells without attacks starts with a : 0|0 rolling 0d1 for the nonexistent attack. Spells with attacks roll as expected but don't have anything prefixing the roll, just the ':' rather than 'Attack' or some other descriptor. All in all though, so far so very very useful! Good catch on the typo.  It'll be corrected in 1.2.  As for the : 0|0, that's...  well, essentially it's an artifact of the npc action sheet that I can't figure out how to work around (I literally copied and pasted the example from the wiki and still got the colon, so I don't know what's going on).  Long-term, I'd like to get fix it so it displays correctly, but for now it stays since it's not really hurting anything and I have higher priorities than to go down that rabbit hole again.
1557290099

Edited 1557292036
GM Michael
API Scripter
So some updates as I'm going through 1.2 development so you can have some hard performance numbers on how long it takes to actually print the spellbook to the handout when expanding/contracting a spell and how this is improving over time: No Caching: >300ms Old Caching (1.1): ~100ms Per-Level Caching (current dev build of 1.2): 5-20ms Next up will be getting character sheet value caching up and running which should help significantly with preparation operations, which even now are sitting around 200ms.  It should also speed up all other operations, including expand/contract. Side Notes: Expanding and contracting a spell is essentially the same time in either direction. The new caching system consumes about 320ms on startup for a sheet, the first time you open it and try to edit it.  I may move some of this to state.SpellMaster for expediency because that first time, you feel  that lag spike.  After that it's fine of course, but realistically, you won't need to purge the cache frequently, and if the purge operation isn't instant, I don't think anyone will care.  Contrast that with players not being super stoked about their sheet lagging the first time after an API reboot.
1557305683
Ziechael
Forum Champion
Sheet Author
API Scripter
Thanks for the additional info, certainly nothing I mentioned is a deal breaker, just wanted to make sure you were aware... which you obviously are :) Great script, now I just gotta figure out the best way to get my unlocked compendium spells into a usable format... any tips? I have all the books (except the DMG obviously :( ) on Roll20.
1557314749

Edited 1557318006
GM Michael
API Scripter
Hrmm...  That's a good point...  At present, I don't have a good solution for you.  I guess I could make a parser that's part of SpellMaster.  Then the user could take their purchased spells, drag them into the sheet, add any Homebrew, and SpellMaster will get to work parsing them (which will probably take several minutes), and then it sticks a js array in a handout which the user can copy out and use to replace SRD.js. This means I'll have to put up with repeating items, which I hate, but at least if I'm only reading it won't be so bad.
1557317405
Ziechael
Forum Champion
Sheet Author
API Scripter
It's a tricky one to be sure given the various levels of access a player/DM could have. I'm sorry to add to your roadmap, there is just so much potential in this script :D
1557362624

Edited 1557362675
GM Michael
API Scripter
It's all good.  It's just something else to do. Attribute caching is now up and running in the dev branch.  Switching preparation lists is down to 40ms and everything else is down even more.  Also, for the record, all of these tests are being performed on an Drow Underdark Land Druid with all class spells from my house rule list imported.  For this reason, users should expect even better performance than what I see.
1557465373

Edited 1557503095
GM Michael
API Scripter
1.2 Changelog Someday I'll get around to making a proper readme, but for now, here's the relevant things that came in this branch: Advanced Caching: The new system is much more efficient and caches attributes from your character sheet, so even the most expensive calls don't take that long. Homebrew Exports: I'll detail this below, it's a doozy... Cache Flushing: The user now has a new tool that will manually trigger a flush of the entire cache.  Realistically, you shouldn't need to do this very often, just when you update something major on your character sheet like a class level or your spellcasting ability score.  This can also be used as a recovery tool just in case you happen to find some corner case with the new caching code. More typo fixing: the SRD.js file has even fewer typos now!  Dimension Door, specifically, is now devoid of zero-length spaces that were murdering my parsers. Installation order is now reversible. Debug Mode: this is now exposed through the UI rather than being an internal setting that had to be manually edited in the code.  Should someone find a bug, they can now turn this on and send me the logs of the operation.  Since the cache flushes on restart, and therefore makes it hard to replicate cache bugs, this should help squash any that remain. Exporting Homebrew Spells You can now (if you're patient) export homebrew spells for use back in your own game.  Patience is key here, because it's not a quick process.  So, how do you do it?  Essentially, we're going to make a fake character, give them all the spells, export from that, and then shove that back into the API as a source file. ... and then do it nine more times. How-To Create a character sheet.  I'll call it House Spells . Open your Compendium.  Filter by spells. Begin the arduous process of dragging and dropping all those spells into House Spells.  You can skip any that are already in the SRD. Add any additional homebrew spells you allow at your table.  If you have any special alterations to existing spells, make those changes to the House Spells character sheet's spell page. Once you're done with that, run !SpellMaster --Menu to bring up the menu and press [Export Homebrew] .  This will bring up a dialog option in which you will type the character sheet name (in the example case, House Spells) followed by a spell level.  (I explain why this is per level below.)  Begin export. After waiting for a while (depends on numbers of spells at the level), the export will finish and you can navigate over to House Spells' Bio & Info  tab where you'll find yourself face-to-face with the SRD.js file with all of the spells of the level you just exported superimposed on it, overriding any conflicts. Copy that enormous document and use it to replace SRD.js in your API scripts.   Restart your API.  After it comes back up, those spells will now be valid import subjects for any players in your game when using SpellMaster's spell import. Repeat steps 5-7 until you have all the spells you care about. Why Per-Level? Suffice it to say, per-level was not my first choice, but when you're making thousands of API calls to get the properties of objects, the API grinds to a crawl, and you run into the very real risk of making Roll20 think you hit an infinite loop.  I've optimized the code on my end as much as I can, but .get() is simply too slow to support too much.  In my testing, I was able to run my fully-loaded test druid for spell levels 0-3 all at once without Roll20 killing the API.  This leads me to believe users should be fine importing all stock spells from their compendiums, but in case Level 1 of Wizard overloads this or something, just start deleting spells to reduce load and do it in chunks.  I know it's not ideal, but it does work.  If anyone has ideas for how to dodge this, I'm all ears. Edit: after sleeping on it, I have an idea. Additionally, in a perfect world, I'd like to avoid the user ever interacting with the direct source file at all to mitigate misuse of this script by bad actors, but the spell list just balloons in size so quickly that it would come to dominate the state and risk hitting the size cap.  If there's any way to hide vast amounts of data in a campaign and then read it back quickly, I'd love to know.
1557490687
The Aaron
Roll20 Production Team
API Scripter
For loading all that data without the infinite loop issue, you need to build a work queue and then use deferred operations to parse it in small chunks. Since Javascript is single threaded, you're basically implementing cooperative multitasking by returning the thread of execution to the controlling process (the api sandbox). This lets it touch its watchdog timer and not confided your script to have an infinite loop. You can look at my search script for an example:&nbsp; <a href="https://app.roll20.net/forum/post/5250301/script-search-full-text-search-for-gms-and-players-with-respect-for-permissions-and-many-query-options" rel="nofollow">https://app.roll20.net/forum/post/5250301/script-search-full-text-search-for-gms-and-players-with-respect-for-permissions-and-many-query-options</a> As for hiding data, you can create handouts in the archived state and put arbitrary data in them. You might need to break it up across multiple. If you want it hidden from the GM as well, creating macros for a player ID that doesn't exist could work (macros are only visible to the owning player). You could also create a character and make abilities for them and use the description field. &nbsp;That field doesn't appear anywhere in the interface, so only the API has access to it. =D
1557503039

Edited 1558113058
GM Michael
API Scripter
The Aaron &nbsp;said: For loading all that data without the infinite loop issue, you need to build a work queue and then use deferred operations to parse it in small chunks. Since Javascript is single threaded, you're basically implementing cooperative multitasking by returning the thread of execution to the controlling process (the api sandbox). This lets it touch its watchdog timer and not confided your script to have an infinite loop. You can look at my search script for an example:&nbsp; <a href="https://app.roll20.net/forum/post/5250301/script-search-full-text-search-for-gms-and-players-with-respect-for-permissions-and-many-query-options" rel="nofollow">https://app.roll20.net/forum/post/5250301/script-search-full-text-search-for-gms-and-players-with-respect-for-permissions-and-many-query-options</a> As for hiding data, you can create handouts in the archived state and put arbitrary data in them. You might need to break it up across multiple. If you want it hidden from the GM as well, creating macros for a player ID that doesn't exist could work (macros are only visible to the owning player). You could also create a character and make abilities for them and use the description field. &nbsp;That field doesn't appear anywhere in the interface, so only the API has access to it. =D I can't believe I forgot about defer()! XD Okay, I guess that's what happens when you code while sleep deprived.&nbsp; 1.3 has been released which includes full async export.&nbsp; My test druid was able to export in 66 seconds.&nbsp; Status updates are provided over time so the user isn't left wondering. I really like the idea of a macro for a fake player lol; that's exactly the sort of thing I'm looking for.&nbsp; Do you have any idea what the performance of that is? My table's spell file is 800KB so I can't imagine loading and parsing that would be swift, but I guess we do have access to eval(), so maybe I'm overreacting. 1.3 Single-Operation Export These instructions are pretty much the same before, just simpler. How-To Create a character sheet.&nbsp; I'll call it&nbsp; House Spells . Open your Compendium.&nbsp; Filter by spells. Begin the arduous process of dragging and dropping all those spells into House Spells.&nbsp; You can skip any that are already in the SRD. Add any additional homebrew spells you allow at your table.&nbsp; If you have any special alterations to existing spells, include them as well.&nbsp; Just make sure the name is unchanged and the exporter will take your new version and ignore the stock version. Once you're done with that, run&nbsp; !SpellMaster --Menu &nbsp;to bring up the menu and press&nbsp; [Export Homebrew] .&nbsp; This will bring up a dialog option in which you will type the character sheet name (in the example case, House Spells) followed by a spell level.Begin export. After waiting for a while (this could be a few seconds or a few minutes, depending on how much you have), the export will finish and you can navigate over to House Spells'&nbsp; Bio &amp; Info &nbsp;tab where you'll find yourself face-to-face with an updated version of the SRD.js file. Copy the new version of SRD.js and create a new API script named something like "Homebrew Spells.js" and paste it in there.&nbsp; Save the new file to trigger an automatic API restart. Disable SRD.js.&nbsp; (Theoretically, you could delete it, but I'd recommend holding onto the original version in case you need it.)&nbsp; This will trigger an automatic API restart. After it comes back up, your players will be able to import your homebrew and purchased compendium content just as they would any SRD spell.
1557504762
The Aaron
Roll20 Production Team
API Scripter
I've never tried it, but it's probably similar to loading an attribute via the api. I don't know what the constraints on size are, you'd probably just want to pick a reasonable size and subdivide to stay in it.&nbsp;
1557783733

Edited 1557783772
GM Michael
API Scripter
Minor update to 1.31.&nbsp; Fixed a bug in druid and cleric spell preparation counts. Also, over time I've been fixing typos in SRD.js so if yours is old, may want to pick up a new one.
1557928604
Ziechael
Forum Champion
Sheet Author
API Scripter
Ok great news... managed to export all 500 spells I have compendium access to with no problems... Not so great news... the output doesn't seem to have included the classes, as below: { Name: "Blade Ward", Level: 0, School: "Abjuration", IsRitual: false, CastTime: "1 Action", Range: "Self", Components: { V: true, S: true, M: false, MDetails: "" }, Duration: "1 round", Desc: "You extend your hand and trace a sigil of warding in the air. Until the end of your next turn, you have resistance against bludgeoning, piercing, and slashing damage dealt by weapon attacks.", Classes: "" },
1557956907

Edited 1557957004
GM Michael
API Scripter
Ziechael said: Ok great news... managed to export all 500 spells I have compendium access to with no problems... Not so great news... the output doesn't seem to have included the classes, as below: { Name: "Blade Ward", Level: 0, School: "Abjuration", IsRitual: false, CastTime: "1 Action", Range: "Self", Components: { V: true, S: true, M: false, MDetails: "" }, Duration: "1 round", Desc: "You extend your hand and trace a sigil of warding in the air. Until the end of your next turn, you have resistance against bludgeoning, piercing, and slashing damage dealt by weapon attacks.", Classes: "" }, Ugh, forgot about that.&nbsp; So...&nbsp; Good news: it's not my fault and you can fix it.&nbsp; Bad news: the problem is the compendium drag-and-drop for the 5e OGL sheet doesn't populate the Class field with the classes of the spell, or any field for that matter.&nbsp; If you manually enter the list of classes for a spell (ie "Druid, Sorcerer, Wizard") into the Class field and then export, it will go into the Classes field in the exported object. The only thing I can think to do on my end would be to actually hard-code all the classes for spells into my script and then do a lookup for them.&nbsp; Problem is, I'm not sure how much of a spell I'd have to include before I leave fair use and enter copyright infringement land, a place I do not &nbsp;want to go lol.
1557957158
Ziechael
Forum Champion
Sheet Author
API Scripter
I did assume as much, not to worry... I can (with reasonably ease) populate that area myself :)
1558116033

Edited 1558116859
GM Michael
API Scripter
1.4 Changelog: Cast Time Filtering, Spell Rename &amp; Delete 1.4 has been released.&nbsp; In addition to the standard fare like minor bug fixes (thanks Ziechael!) and typos in the SRD.js there are a couple new features, detailed in the OP. Cast Time Filtering : You can now filter by cast time.&nbsp; The options are Action, Bonus Action, Special, Combat (includes the first three), and Noncombat (anything left over or that is a ritual). Spell Rename &amp; Delete : You can now rename or delete spells when exporting.&nbsp; Think Wall of Force is unhealthy and should be banned?&nbsp; Think Major Image is a stupid name for a spell that has full sensory experience?&nbsp; Now you can address that.
Hey Michael, Awesome script but im confused. I'm fairly sure I followed the install correctly but when I create a spell list for my Druid I get this: I was under the assumption that it Auto populated the Druid spells. But as you can see it doesn't. Im I doing something wrong, or did you intend to have us manually add all the spells? Side note I bought some books and manually made a House Spells sheet then added the new JavaScript it created.
1558274569

Edited 1558288954
GM Michael
API Scripter
When you create a spellbook, there is a drop-down menu that asks if you want to import all spells for a class that should do what you're looking for.&nbsp; I'm away so I can't double check that it's still working (don't know why it wouldn't, that code hasn't changed recently), but try recreating the spellbook, this time making sure to specify that you want to automatically import your Druid spells.&nbsp; If it still doesn't work, let me know and I'll try to figure out what's wrong when I get home tonight. EDIT: Just got home.&nbsp; It still seems to be working on my end.
Still didn't work... ill delete it all and try again In the morning let you know
Resolved in PMs.&nbsp; Problem was a missing installation step for the export process.&nbsp; OP has been updated so this doesn't happen again.
1558476421
Ziechael
Forum Champion
Sheet Author
API Scripter
Hi Michael, really enjoying the utility this script provides. Is there something I'm doing wrong when levelling to get the new level of spells available to add etc? I refresh the cache which updates preparation limit accordingly but if a threshold is reached to unlock the next level of spells I can't see how to add them? I could delete the spellbook and recreate it I guess but would that also wipe any saved preparation lists? Finally, is it possible to have the 'add spell' option be case insensitive?... not a huge thing but would make adding spells less of a memory test :)
1558480675

Edited 1558480791
GM Michael
API Scripter
Ziechael said: Hi Michael, really enjoying the utility this script provides. Is there something I'm doing wrong when levelling to get the new level of spells available to add etc? I refresh the cache which updates preparation limit accordingly but if a threshold is reached to unlock the next level of spells I can't see how to add them? I could delete the spellbook and recreate it I guess but would that also wipe any saved preparation lists? Finally, is it possible to have the 'add spell' option be case insensitive?... not a huge thing but would make adding spells less of a memory test :) No, leveling your slots has to be updated manually.&nbsp; It doesn't automatically pull that.&nbsp; It would be a lot of extra calls on API load, and it's rare enough I didn't want to slow the rest of the script down because of it. And yes, it's possible, and a good idea, but it means updating a lot of references in a lot of places.&nbsp; Totally doable, but it's not a quick change because I'd have to regression test the whole thing before I felt safe releasing an update for it.&nbsp; In the future, I'd also like the ability to directly print out a list of your available spells for your class that would just all be import links, so that would also address it.
1558676755

Edited 1558677443
GM Michael
API Scripter
1.5 Changelog: Improved Slot Counting &amp; Knowables List 1.5 comes with two big features, both of which are simple to the user, but difficult to explain what happened on my end. Improved Slot Counting : I overhauled the way that spellbooks get created in the first place.&nbsp; Now if you use any &nbsp;of the stock classes (not counting UA), it will automatically determine ALL of your leveled spell slots, even if you are something crazy like an Arcane Trickster+Ranger+Warlock+Druid.&nbsp; Also, there's a new tool button that handles all this for you upon level-up.&nbsp; This was a BIG &nbsp;code change (I think I touched &gt;50% of my functions to make this happen), so if you see any bugs crop up, please let me know! Knowables List : Each spell level now has a little [...] button.&nbsp; Press it and your chat will display an interaction pane where you can add and remove spells of that level.&nbsp; The spells that are displayed are those that are "knowable" for your spell list, as determined by your classes.&nbsp; Fine control of them is still part of your spellbook, but if you want to get things in and out quickly, this is the way to do it.&nbsp; No more trying to guess capitalization or spelling!
1558690577
Ziechael
Forum Champion
Sheet Author
API Scripter
Great update, I've tested with both a full Cleric and an Eldritch Knight, the former worked beautifully but the EK seems to be a bit off... possibly something I've done in setup? Got a level 4 EK Made sure Arcane Fighter is checked Ensured the caster ability is populated Created the spellbook Got the following issues: Also, when I used the [...] button I just get a blank template box...
Thanks for quick feedback and fancy screenshot! Spell Slot Count: Level-Up doesn't update current slots (I've updated OP to be more clear on this).&nbsp; Having said that, it looks like there's some rounding weirdness with my slot counter. Save DC: Yep, confirmed on my end that's bugged too. EK Knowables: I don't even need to test this one on my end to know it's gonna be bugged.&nbsp; -_-&nbsp; I know what I forgot. The second and third should be pretty easy fixes.&nbsp; The first one...&nbsp; will be... fixable...
1558699052
Ziechael
Forum Champion
Sheet Author
API Scripter
No worries, happy to 'help'. The EK list hadn't had a Level up applied, it was from creation (but still probably linked to the rounding). We started using this in live games this week and the Cleric and Paladin couldn't be happier :)
1558703773

Edited 1558704256
GM Michael
API Scripter
1.51 is in.&nbsp; It addresses all three of the bugs you found. Slot Count : This is such a pain, but I think &nbsp;it's correct now.&nbsp; I had to dig out the multiclassing table in the PHB.&nbsp; If the rounding were consistent, it would be one thing, but it's not.&nbsp; When you have a half or third caster (which doesn't kick in until level &gt; n), you have to round up &nbsp;on your slots if you're doing this programmatically.&nbsp; Then when you multiclass, you round down . Save DC : The underlying issue here was incorrectly importing what stat to use for a spellcast.&nbsp; Technically, &nbsp;the spellcasting was correct; it was just being fed the wrong stat to cast with and would have been fine if the user had manually changed the casting stat to the correct one (it was always stuck on casting from Wisdom).&nbsp; Having said that, the casting stat for a spell you import should now automatically be correct and should not require manual intervention unless the user wants to do something weird.&nbsp; Having said that, any spells that got imported while this was bugged will either need to be re-imported or manually fixed.&nbsp; (Unless you want to be casting from Wisdom, in which case it's fine.) EK Knowables : Fixed.&nbsp; I don't wanna talk about it.&nbsp; -_-
1558704184
Ziechael
Forum Champion
Sheet Author
API Scripter
Seems perfect in my initial testing, great work!
Also, glad to hear your casters are liking it!&nbsp; :)
Begin the arduous process of dragging and dropping all those spells into House Spells.&nbsp; For each, you must manually fill out the Class field with a list of classes (ie "Druid, Warlock, Wizard") because the character sheet doesn't autopopulate that for some reason.&nbsp; You can skip any that are already in the SRD. Yikes.&nbsp; Is there no access to the compendium via the API?&nbsp; I'd think this would be one of the big selling points of API access.&nbsp; :-(
1558825286

Edited 1558845116
GM Michael
API Scripter
aisforanagrams said: Begin the arduous process of dragging and dropping all those spells into House Spells.&nbsp; For each, you must manually fill out the Class field with a list of classes (ie "Druid, Warlock, Wizard") because the character sheet doesn't autopopulate that for some reason.&nbsp; You can skip any that are already in the SRD. Yikes.&nbsp; Is there no access to the compendium via the API?&nbsp; I'd think this would be one of the big selling points of API access.&nbsp; :-( Unfortunately, no. It would pose copyright concerns, I'm guessing.&nbsp; This means you have to import it into your character sheet and then the API is able to parse that.&nbsp; Personally, I think it's still worth it because you only have to do this once all at the same time rather than each of your players doing a little bit over time where each time they have to go digging through rules. If there was a better way, I'd happily implement it, but outside of like...&nbsp; Encrypting the full spell list with the decryption key being the description from some random spell from a given rulebook, I can't imagine anything.
Just a heads up that a bug has been found that I don't have an immediate fix for: If a player has their character configured to whisper rolls and they cast a spell, the player and the GM may not get the same value on the roll.&nbsp; See here for details.