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

Suggestions before getting started

I'm looking to create a script that will incorporate the AD&D 1st Edition weapons vs armour class to-hit adjustments when attacking. However, I wanted some advice before I commit time to an incorrect implementation. The original table has 50 weapon entries, with AC ranging from 2 to 10, for a total of 450 data points. If I include the damage each weapon does vs small, medium, and large opponents, the total entries becomes 550. I'm just learning how to program in Javascript (my primary language of choice is Python). Normally, I would just create an SQLite database with all the entries and pull from that. However, to my understanding, Roll20 doesn't have the ability to access databases. 1. Am I incorrect in assuming database access in Roll20 is available? 2. Would a Javascript array be a better implementation? 3. Does anyone have a better suggestion for accomplishing this? Thanks.
1410299038
Lithl
Pro
Sheet Author
API Scripter
Setting up a database (even SQLite) seems like overkill to me. An array or lookup table (in JS: an object serving as a lookup table/map) would be my go-to solution. There is no database access, at least not in the sense that you can make your own. Looking up information about the campaign and the objects in it accesses Roll20's database behind the scenes. An array or an object Something like this, I think (note that I've never played AD&D 1st Edition, so the information below is simply from quick internet searches): var adjustments = { 'Battle Axe': { ac: [-5, -4, -3, -2, -1, -1, 0, 0, 1, 1, 2], damage_sm: { min: 1, max: 8 }, damage_lg: { min: 1, max: 8 } }, 'Bo Stick': { ac: [-13, -11, -9, -7, -5, -3, -1, 0, 1, 0, 3], damage_sm: { min: 1, max: 6 }, damage_lg: { min: 1, max: 3 } }, 'Dagger': { ac: [-4, -4, -3, -3, -2, -2, 0, 0, 1, 1, 3], damage_sm: { min: 1, max: 4 }, damage_lg: { min: 1, max: 3 } }, // etc... }; var weaponName = ... // User input, for example var targetAC = ... log('AC Adjustment: ' + adjustments[weaponName].ac[targetAC]); log('S/M damage: ' + adjustments[weaponName].damage_sm.min + '-' + adjustments[weaponName].damage_sm.max); log('Large damage: ' + adjustments[weaponName].damage_lg.min + '-' + adjustments[weaponName].damage_lg.max); If the system works differently than what I could infer from a quick Google search, just say so and we can help figure out a better structure! =)
Looks good; your search was fine. I'll give it a go and see what happens; I think combining it with a power card to make it "pretty" should work perfectly. Thanks for your help.