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

What is the Best Way To Access Table Data In a Character Sheet?

Basically I have an attack matrix that is not reducible to a function.  So my first thought was to use a multidimensional array to hold the table data.  Is this the best way? Some other ways I thought of doing this. Use hidden fields to set up the table.  eg. <input type="hidden" name="attr_physicalattackmatrixone_dac_1_wc_1" value="19"> <input type="hidden" name="attr_physicalattackmatrixone_dac_1_wc_2" value="19"> <input type="hidden" name="attr_physicalattackmatrixone_dac_1_wc_3" value="18"> . . . <input type="hidden" name="attr_physicalattackmatrixone_dac_2_wc_1" value="17"> <input type="hidden" name="attr_physicalattackmatrixone_dac_2_wc_2" value="18"> <input type="hidden" name="attr_physicalattackmatrixone_dac_2_wc_3" value="17"> . . . <input type="hidden" name="attr_physicalattackmatrixone_dac_10_wc_14" value="8"> <input type="hidden" name="attr_physicalattackmatrixone_dac_10_wc_15" value="8"> <input type="hidden" name="attr_physicalattackmatrixone_dac_10_wc_16" value="10"> Finally I was thinking I might try accessing a rollable table (really a set of rollable tables) from the API. Or there may be something I am missing.
1515169740
Finderski
Plus
Sheet Author
Compendium Curator
Is the data in the table going to change? And if does change, will the changes be the same each (i.e. there are three variations on the matrix, but variation 1 is always the same, variation 2 is different than 1, but still always the same for variation 2, and variation 3 is different than 1 & 2 but will always be the same for variation 3)?
1515196343

Edited 1515196604
Pantsworth
Sheet Author
The data will be static.  I am emulating the attack matrix tables in Gamma World 2e.  There are three tables (one for weapon attacks, one for natural attacks, and one for mental attacks.)  Each table varies from the other tables, but the values within the tables never changes.  On the weapons table. a weapon class (WC) of 4 will always need a 12 or better to hit a Defender's armor class (DAC) of 3 or higher.  From now untill the zoopremists enslave us all. I had previously used a very complicated roll template, but I think storing the data in a table will be much easier to maintain and debug.  What I have now is a hot spagetti mess.
1515239350
Finderski
Plus
Sheet Author
Compendium Curator
If you need to access the values of the matrix for macros then using input fields should work, though they don't need to be hidden—you could place them in the cells of a table and disable them so people can't change anything. If you don't need to access the values for macros and the such, no input fields necessary...just create the tables and populate the cells with the numbers.
1515257780

Edited 1515330752
The "Attacker's Hit Dice" and "Attacker's Mental Strength" tables are pretty regular, so I was able to write macros for them: [[ 1d20>[[21 - ?{DAC} - {6,11}<?{DAC} - {2,4,6,9,11,15}<?{AHD}]] ]] [[ 1d20>[[{10 + ?{DMS} - ?{AMS}, 1}kh1]] ]] The "Attacker's Weapon Class" table is very irregular, so it'll take me a little longer to write up a macro.
1515270402

Edited 1515270860
Here's a macro for the "Attacker's Weapon Class" table: <a href="https://gist.github.com/Silvyre/d765e66d33928cec03adc2db37b59cd5" rel="nofollow">https://gist.github.com/Silvyre/d765e66d33928cec03adc2db37b59cd5</a> [[ 1d20&gt;[[20 - {3,10,10,11,14,14,16,16}&lt;?{AWC} - 4 * {4,5,7,13}=?{AWC} - 3 * {6,0}=?{AWC} - 2 * {5,0}=?{AWC} - {1,2,3,7,8,9,10}=?{AWC} * ?{DAC} - {1,9,16}=?{AWC} * {2, 11 - [[{16,0}=?{AWC}]]}&lt;?{DAC} - {2,0}=?{AWC} * {3,4,11}&lt;?{DAC} - {4,5,6,13}=?{AWC} * {2, 3 + 4 * [[{7,0}=?{AWC}]], 3 + 4 * [[{7,0}=?{AWC}]], 10 - 7 * [[{13,0}=?{AWC}]]}&lt;?{DAC} - 6 * {9,11}&lt;?{DAC} * {6,0}=?{AWC} + 7 * {4,0}=?{DAC} * {16,0}=?{AWC} - {2,5,6,6,6,7,8,9,9,10}&lt;?{DAC} * {11,0}=?{AWC} - {2,7,7,7,7,8,8,9,9,9,10}&lt;?{DAC} * {12,0}=?{AWC} - {2,3,4,6,8,9}&lt;?{DAC} * {14,0}=?{AWC} - {2,9,9,9,9,9}&lt;?{DAC} * {15,0}=?{AWC}]] ]]
1515294897

Edited 1515295191
Pantsworth
Sheet Author
Silvyre said: Here's a macro for the "Attacker's Weapon Class" table: <a href="https://gist.github.com/Silvyre/d765e66d33928cec03adc2db37b59cd5" rel="nofollow">https://gist.github.com/Silvyre/d765e66d33928cec03adc2db37b59cd5</a> [[ 1d20&gt;[[20 - {3,10,10,11,14,14,16,16}&lt;?{AWC} - 4 * {4,5,7,13}=?{AWC} - 3 * {6,0}=?{AWC} - 2 * {5,0}=?{AWC} - {1,2,3,7,8,9,10}=?{AWC} * ?{DAC} - {1,9,16}=?{AWC} * {2, 11 - [[{16,0}=?{AWC}]]}&lt;?{DAC} - {2,0}=?{AWC} * {3,4,11}&lt;?{DAC} - {4,5,6,13}=?{AWC} * {2, 3 + 4 * [[{7,0}=?{AWC}]], 3 + 4 * [[{7,0}=?{AWC}]], 10 - 7 * [[{13,0}=?{AWC}]]}&lt;?{DAC} - 6 * {9,11}&lt;?{DAC} * {6,0}=?{AWC} + 7 * {4,0}=?{DAC} * {16,0}=?{AWC} - {2,5,6,6,6,7,8,9,9,10}&lt;?{DAC} * {11,0}=?{AWC} - {2,7,7,7,7,8,8,9,9,9,10}&lt;?{DAC} * {12,0}=?{AWC} - {2,3,4,6,8,9}&lt;?{DAC} * {14,0}=?{AWC} - {2,9,9,9,9,9}&lt;?{DAC} * {15,0}=?{AWC}]] ]] Wow.&nbsp; That kicks butt.&nbsp; Thanks! Finderski said: If you need to access the values of the matrix for macros then using input fields should work, though they don't need to be hidden—you could place them in the cells of a table and disable them so people can't change anything. If you don't need to access the values for macros and the such, no input fields necessary...just create the tables and populate the cells with the numbers. I was planning on calling them from the API, so the input fields should work.&nbsp; Thanks for the help!
1518018519

Edited 1518023964
Pantsworth
Sheet Author
OK - this works great, but I need to adjust the formulas a bit.&nbsp; To whit, both the Attacker's and Defender's Mental Strength can go no higher than 18, or less than 3. For example:&nbsp;&nbsp; [[ 1d20&gt;[[{10 + ?{DMS} - @{currMs}, 1}kh1]] ]] needs to be something like: [[ 1d20&gt;[[{10 + {{{?{DMS},18},3}kl1}kh1 - {{{@{currMs},18},3}kl1}kh1, 1}kh1]] ]] But I can't get that to work. I can get:&nbsp; /r {{?{DMS},18}kl1} to work in chat, just not in the character sheet.&nbsp;&nbsp; EDIT:&nbsp; Got part of the way there with this: [[10 + (({{?{dms}, 0}&gt;18}) * (18 - ?{dms}) + ?{dms} ) - ( ({{ @{curr_ms}, 0}&gt;18}) * (18 - @{curr_ms}) + @{curr_ms} ) ]]&nbsp; Now I just need to figure out how to do the "not lower than 3" part.
1518030365
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm not familiar with that macro construction, Sylvire. What's going on with {2,4,6,9,11,15}&lt;?{AHD} What is represented by the list of numbers in the brackets?
1518031122

Edited 1518032811
Pantsworth
Sheet Author
He is counting the number of successes, and using that to alter the progression of the target numbers.&nbsp; I think. So if the attacker's hit dice is 3; that is greater than 2 only and would count as one success. If it were 8; that is greater than 2,4 & 6; that formula returns 3 successes, or 3
1518035541
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's arcane. Probably involves witches. Possibly quantum.
keithcurtis said: That's arcane. Probably involves witches. Possibly quantum. Definitely Quantum Witches.&nbsp; Which is the name of my fave Pink Floyd album.
Pantsworth said: OK - this works great, but I need to adjust the formulas a bit.&nbsp; To whit, both the Attacker's and Defender's Mental Strength can go no higher than 18, or less than 3. For example:&nbsp;&nbsp; [[ 1d20&gt;[[{10 + ?{DMS} - @{currMs}, 1}kh1]] ]] needs to be something like: [[ 1d20&gt;[[{10 + {{{?{DMS},18},3}kl1}kh1 - {{{@{currMs},18},3}kl1}kh1, 1}kh1]] ]] Give this a try: [[ 1d20&gt;[[{10 + {{?{DMS}, 3}kh1, {18} }kl1 - {{@{currMs}, 3}kh1, {18} }kl1, {1} }kh1]] ]] keithcurtis said: I'm not familiar with that macro construction, Sylvire. It's one of my favorites! It's a Grouped Roll incrementer that I use to account for nonlinear behaviour when modeling tables.