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

[Reward] Creating a Database

Okay, there is no reward other than the end result of using a database of 3.5 (open-source) spells... sorry. &nbsp; I dislike having scores of macros for all the different spells in my 3.5 game. &nbsp;I want to know if there is a way to create a database (whether in an API script or its associated JSON file). &nbsp;This way I can code in the database and call the script via (for example) "!spell acid arrow" so it will search the file, and run the following macro &{template:DnD35StdRoll} {{spellflag=true}} {{name=@{selected|character_name}}} {{subtags=casts [Acid Arrow](<a href="http://www.d20srd.org/srd/spells/acidArrow.htm" rel="nofollow">http://www.d20srd.org/srd/spells/acidArrow.htm</a>)}} {{subtags2=?{Would you like a narrative? (hit space for 'no')|Piercing what looks to be some type of small, powdered organ with a tiny dart, @{selected|character_name} shouts a command as the his hand thrusts out and an arrow made out of acid springs forth, speeding to its target.}}{{School:=Conjuration (Creation) [Acid]}} {{Level:=Sor/Wiz 2}} {{Comps:=V, S, M, F}} {{Cast Time:=1 std action}} {{Range:=Long ([[400+40*@{selected|casterlevel}]] ft.)}} {{Effect:=One arrow of acid}} {{Duration:=[[1 + {floor(@{selected|casterlevel}/3),7}kl1]] round(s)}} {{Save:=None}} {{SR:=No}} {{check=Atk Roll:}} {{checkroll=[[1d20cs&gt;20 + @{selected|bab}[BAB] + @{selected|epicattackbonus}[Epic AB] + @{selected|dex-mod}[Ability] + ?{Miscellaneous Attack Modifiers?|0}[Miscellaneous Attack Modifiers] ]] for [[2d4]] acid damage}} {{critroll=**Possible Critical** (crit confirm roll [[1d20cs&gt;20 + @{selected|bab}[BAB] + @{selected|epicattackbonus}[Epic AB] + @{selected|dex-mod}[Ability] + ?{Miscellaneous Attack Modifiers?|0}[Miscellaneous Attack Modifiers] ]]) for an extra [[2d4]] acid damage!}} {{notes=Requires a ranged touch attack (with possibility of critical damamge). There is no splash damage. Unless somehow neutralized, the acid lasts for the full duration. **DM** !tj -addstatus Acid Arrow damage:[[1 + {floor(@{selected|casterlevel}/3),7}kl1]]:-1:The acid continues to eat at your flesh for an additional 2d4 points of damage}} I really just need a small skeleton example to work from and I can go from there. Thanks in advance, Roy
1442360621

Edited 1442360643
Ada L.
Marketplace Creator
Sheet Author
API Scripter
With handout folders now available, you might try creating a handout folder to use as a "database". Read your spells macros from wherever, put them each in a handout in your spell database folder named after the spell. Then set up a chat:message event handler to process your !spell command to extract the spell name and look up the handout and get its macro.&nbsp;
good luck.
1442407413
The Aaron
Pro
API Scripter
It is possible to create something akin to what you mention. &nbsp;It has been done before for other games. &nbsp;It is quite a bit of work (data entry). &nbsp;What you most likely would want to do is create a script that is capable of executing the necessary commands for a spell, and contains a vast object with all the spells in it (create other objects to act as indexes to find the spells faster). &nbsp; Using Roll Templates from the API is not straight forward and seems to be somewhat unreliable. &nbsp;You can likely approach the same look by directly writing HTML/CSS to the log. &nbsp;Calling other API scripts is also problematic. &nbsp;Some scripts (power cards, for example) expose a function which can be called to activate them without issuing a chat command. If this is something you would like to pursue, I'd be happy to talk you through various parts of it. &nbsp;I'd recommend you start by creating an API script which casts just 2 spells, each as complicated and different as possible. &nbsp;That will give you a feel for where you'll need to be abstract and how you'll need to store them. &nbsp;When you execute the casting command, you'll need to know somethings, so plan for it: 1) Who is casting it 2) Can they cast it 3) What level are they casting it at (if this can vary) 4) If there are options within the spell, which ones are they choosing? &nbsp;(Damage type, effect type, save type, etc) 5) Who should know they are casting it (Just the player and GM, or everyone?) I find that the interface is often the hardest part. &nbsp;Honestly, this isn't a very complicated script, it's just going to have some tedious implementation details and a ton of data entry. &nbsp;=D
A big thanks to you guys. &nbsp;The data entry is going to be tedious, but I am using AutoHotKey for most of the automation of it combined with some beautiful "replace" scripts. &nbsp;Wizards puts out all the open-source 3.5 spells in RTF format, so that makes things much &nbsp;simpler. Now... starting to write the script. Aaron, I will likely bug you a bit once things start. &nbsp;I really have no &nbsp;clue how to work with the API, so I might need to be pointed at a script that does something similar, but which is reduced in size. &nbsp;Once I get the "hang of it", then the rest will be... monotonous.
1442439972

Edited 1442439994
The Aaron
Pro
API Scripter
No worries, bug me all you like. =D If you're interested in learning the API, I'd suggest picking a few minor problems and work through solving those first. &nbsp;Here some suggestions: Write a command, !roll , which takes 2 arguments ( Number of Dice, Size of Dice ) and outputs to the chat in a single whisper each die that was rolled and the total for all of them. Write a script that notices when a token is moved and tells you how far it was moved in the units of the page it was on. That will give you a feel for the sendChat() command the the event model used by Roll20. &nbsp;Additionally, your life will be made easier if you get some familiarity with&nbsp; underscore.js , which is available to API scripts. Reading other people's scripts is also a great way to get a feel for the API.
I was searching for something similar but for Pathfinder.&nbsp; I came across this post by Aaron G.&nbsp; It may help you out. There is a DB of Pathfinder spells in there.&nbsp; I tested the script out and it will pull up spell info by name (you have to type in the name).&nbsp; When I get some time I'm going to play around with modifying that script to get the output into the Pathfinder Spell template.&nbsp; Would be cool to have my players select their spells from a dropdown and pop the info in chat.&nbsp; Maybe add attack rolls for touch attacks and damage/healing dice rolls based on caster level.&nbsp; I use the Pathfinder Character Sheets so hopefully it will work.&nbsp; It will also help me as a DM by letting me see the details of exactly how my spells will destroy them.....muhahahahah.&nbsp; :) Good Luck!
1442567576
Lithl
Pro
Sheet Author
API Scripter
Kuthulu said: I was searching for something similar but for Pathfinder.&nbsp; I came across this post by Aaron G.&nbsp; It may help you out. Do not use this script. &nbsp;It fills the state variable with all of its "database" information. State is written to the API server every few seconds, and when it contains large amounts of data such as in this script, Bad Things&trade; happen. This script is partially responsible for the API throttling that we have now, because using it could potentially cause problems for the entire API server, which then translates to API problems for everyone. With the throttling that is now in place, the "API problems for everyone" should no longer happen, but achieving that safety makes that script not work as intended.
Bummer.&nbsp; Thx for the info Brian.
1442574771
The Aaron
Pro
API Scripter
You should be able to modify it to reference a static collection of spells in an internal object, and thereby still be able to use it.&nbsp;
I would love the to know how to create that "static collection of spells in an internal object." &nbsp;I have a bunch of them ready to go.
1442587859
The Aaron
Pro
API Scripter
Well, check your private messages, I sent you an example. =D
Got it. &nbsp;Thank you so much.