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

Pathfinder character sheet attributes do not populate 'max'.

1442560760

Edited 1442560980
Hi all, I'm working on a custom version of the Ammo module, which is originally found at&nbsp; <a href="https://gist.github.com/shdwjk/79a60b8d2ee58e87604" rel="nofollow">https://gist.github.com/shdwjk/79a60b8d2ee58e87604</a>... . &nbsp;I realize that there is a new version in the roll20-api-scripts repository now, at&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/blob/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/</a>... . &nbsp;I'm trying to make it more generic (i.e. to make it a generic "adjust this counter" script, as opposed to being very specifically tied to ammunition). &nbsp;The version that I'm working on is visible here:&nbsp; <a href="https://github.com/rbroemeling/roll20-api-scripts/" rel="nofollow">https://github.com/rbroemeling/roll20-api-scripts/</a>... . I ran into a bug though: on the Pathfinder character sheet, the attributes don't seem to be populating 'max' correctly. &nbsp;That is, dumping the 'attr' object right after the findObjs() call on line 159: attr = findObjs({_type: 'attribute', _characterid: chr.id, name: args[2]})[0]; log(attr); ... results in a hash that has an empty "max" value, like this: {"name":"repeating_class-ability_1_used","current":3,"max":"","_id":"-JzRGLh5lzZmPqKvMspW","_type":"attribute","_characterid":"-JzOcuw2Jpn0k85RkDgw"} On the character sheet itself, 'max' for that attribute is populated via the dice formula: 2 + @{CHA-mod} + (@{class-0-level} * 2) ... and on the character sheet, the 'max' for that attribute correctly calculates and displays "6", as expected for a level 1 bard with a +2 CHA modifier: Anyone have any idea what I am doing wrong or suggestion for how to fix this issue? Thanks!
1442567275
Lithl
Pro
Sheet Author
API Scripter
I don't believe autocalc fields will populate the attributes, by design. You'll have to grab the max formula and either parse it to perform the calculation yourself, or lean on the dice engine to do it for you by providing a callback to the sendChat function.
1442591836

Edited 1442591867
Aha. &nbsp;Thanks, Brian -- yeah, I expected that I was missing something fundamental like that. &nbsp;That makes it a lot harder to deal with -- I think that I'd have to modify the _max-calculation field in some way anyway, since it needs to reference other character attributes and a plain call to the die roller won't do that. &nbsp;i.e. /roll 2 + @{CHA-mod} + (@{class-0-level} * 2) ... won't do what I want it to, it has to be: /roll 2 + @{CHARACTER_NAME|CHA-mod} + (@{CHARACTER_NAME|class-0-level} * 2) That seems pretty easy to do, actually, so I'll look into it. &nbsp;Thanks!
... the fact that rolls are asynchronous is challenging to deal with -- but even before I deal with that, I'm finding that it is impossible to use a character attribute in an API dice roll (one sent via sendChat). &nbsp;Anytime that I try to do so, I get a firebase error message. Just using sendChat() like so: sendChat('Remaining', autoCalcFormula, function(results) { log(results); }); This works when autoCalcFormula is very simple (for example "/roll 1d20"). &nbsp;When autoCalcFormula involves a character attribute, however (for example "/roll 1d20 + @{CHARACTER_NAME|level}" or "/roll 1d20 + @{CHARACTER_NAME|CHA-mod}", it explodes and dies with a firebase error. The firebase error being returned is: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "[" or [ |\t] but "0" found. ... am I missing something fundamental, or is this a straight-up bug with the sendChat() API roll functionality? Possibly, I should just parse the autoCalcFormula string myself (building my own number for the "max" value), but that seems non-optimal... if I can do it with the roll engine it seems like it should work better in the long run.
1442627237
Lithl
Pro
Sheet Author
API Scripter
And that's the error you're getting when autoCalcFormula is "/roll 1d20 + @{Remi|level}"?
Hi Brian, Yeah -- that's the error that I get when any attribute is being mentioned in the formula, actually. &nbsp;So with a character named "Nil", all of the following give the same error: /roll [[2 + @{Nil|CHA-mod} + (@{Nil|class-0-level} * 2)]] /roll 2 + @{Nil|CHA-mod} + (@{Nil|class-0-level} * 2) /roll 1d20 + @{Nil|CHA-mod} /roll 1d20 + @{Nil|level} /roll 1d20 + [[@{Nil|level}]] Just as a sanity test, I was able to get it working, but only when there are no character attributes involved. &nbsp;i.e. this very trivial roll works: /roll 1d20 Thanks!
I've filed this as a bug in the Bug Reports & Technical Issues &nbsp;forum. Ref:&nbsp; Unable to use character attributes in Roll20 API sendChat() rolls This issue is surprisingly frustrating, as it causes a lot of problems when trying to work with attributes (if any attribute that you are trying to get at is AutoCalc on the character sheet, this bug makes it impossible to get at it).
1442750880
The Aaron
Pro
API Scripter
What happens if you try: sendChat('', '[[2 + @{Nil|CHA-mod} + (@{Nil|class-0-level} * 2)]]',function(msg){ });
1442760831

Edited 1442760856
Hi Aaron, That die string results in the same error: // Code: var module = 'Custodian'; var roll_string = '[[2 + @{Nil|CHA-mod} + (@{Nil|class-0-level} * 2)]]'; log('Testing: ' + roll_string); sendChat(module, roll_string, function(results) { log(results); }); // API Log Output: "Testing: [[2 + @{Nil|CHA-mod} + (@{Nil|class-0-level} * 2)]]" /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "[" or [ |\t] but "0" found. // Chat Output: NONE Thanks! Remi