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

API Spell List Script?

1556278012

Edited 1556279130
GM Michael
API Scripter
Is there an existing script to handle large volumes of spells that can act similar to a character sheet?  I've got a 2 year campaign and it's starting to add up.  I'm getting close to the point of making my own system (using handouts, ASCII art, and API buttons), but I wanted to double check that there are no better options presently than the character sheet companion scripts so I don't waste time reinventing the wheel. Performance and compatibility with Homebrew spells are a must, but ideally, I'd like it to support as many of the following features as possible (because they're the one's I'd add if I do this myself)... Expand/contract spells for detail Edit spells with same granularity as existing character sheets Import/Export spells between multiple character spell lists (so homebrew can be handled easier) Support multiple spell preparation lists Fast read and write times at scale (I'd use cached strings in state) Ability to cast from spell list, utilizing multiple spell save DCs in event of multiclassing. Manual spell slot count setting Filtering based on VSM requirements, source class, level, spell slots remaining, prepared, search string
1556287229
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What you are looking for is pretty much a compendium/character sheet integration. This would be possible to do via API script, but would be on the same order as a companion script like the shaped or Pathfinder community companions. I'd probably store the data in a handout/character sheet though as this much data is likely to approach the state's size lit.
1556291061

Edited 1556291739
GM Michael
API Scripter
Well, I didn't know about the state limit, so that's good to know.  Is there a limit to the storage of individual handouts?  I'm not sure how far 2MB would go, so I'd need to put it elsewhere.  I guess spells would mostly be the text, so that limit might matter. I'd be fine if the master list of spells could be archived in a handout and just loaded on startup.
1556301956
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I have done some inquiry on this in the past. It is my understanding that the text of your handouts is loaded into browser memory at game startup, but the handouts themselves do not take up account storage. That's pretty much limited to your art and music upload libraries.
1556305792

Edited 1556305851
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
As far as I know, handouts don't have a text limit, so storing a massive JSON string in the notes/gmnotes of the handout shouldn't be a problem. You just need to make sure to keep the handout updated as spells are added/removed. I'd also recommend creating the handout with archive:true  so that it isn't easily accessible, which will help avoid accidental changes to the notes field that might invalidate the JSON.
1556372818

Edited 1556396877
GM Michael
API Scripter
Well, after altogether too much time spent writing parsers, for the record, a JSON file containing all stock 5e spells is 484KB, which comes out to be a little more than a KB a spell.  My house rules add 244, so once I finish parsing those, I'll probably be looking at around 750KB.  Still high enough to warrant archiving though. EDIT : After parsing my own house rules, it finally came out to 730KB.
1556391906
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
yep, especially when you consider that the state's 2mb limit is for the entire state object in a game, so you want to be sure to leave space for other scripts' functions
1556409686

Edited 1556409709
The Aaron
Roll20 Production Team
API Scripter
If you don't need to edit it with the script, you'd be better off just creating it as a javascript object and using it that way. Skip the JSON string all together. 
1556577781

Edited 1556578234
GM Michael
API Scripter
Current status: most of the way there , but I've run into an unexpected hitch... What on earth is causing the roll boxes to spread out like that? For the record, the sendChat message is... /gm &{template:desc} {{desc=<div align=\"left\" style=\"margin-left: 7px;margin-right: 7px\"><h4>Water Whip</h4><b>DC:</b> 19 <br><b>Spell Attack:</b> [[@{Tazeka Liranov|d20}cs>20 + 5[WIS] + 4[PROF] + 2[ATKMOD]]]|[[@{Tazeka Liranov|d20}cs>20 + 5[WIS] + 4[PROF] + 2[ATKMOD]]]<br><b>- School:</b> Evocation<br/><b>- Cast Time:</b> 1 Action<br/><b>- Range:</b> 30 feet<br/><b>- Components:</b> SM (a pint of water)<br/><b>- Duration:</b> Instantaneous<br/>- <b>Description:</b> You lash out against a creature, Make a ranged spell attack against the target. On a hit, deal [[1d12]] Slashing damage. <br/><b>- Higher Levels:</b> This spell's damage increases to [[2d12]] at 5th level, [[3d12]] at 11th level, and [[4d12]] at 17th level<br/>- <b>Ability:</b> Wisdom<br/>- <b>Classes:</b> Artificer, Bard, Cleric, Druid, Sorcerer, Warlock, Wizard<br/></div>}}
1556579055
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
That is styling from the roll template. I'd recommend trying the description field (check the name) of the npcaction template.