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

[BUG] trying to update an attribute in a newly created character's journal doesn't work

December 19 (11 years ago)

Edited December 19 (11 years ago)
Fabio M.
KS Backer
Hello,

I've already been raising this question elsewhere, but in the meantime I was able to do some other tests, and I really cannot think of any reason why it's not working... Short of a bug (or some really dumb mistake I'm making that I cannot see, that is).

It is quite easy to replicate: create a character journal, create an attribute in it named STR. Put a token on the page and assign the character's journal to it.
Select the token, type !spawn.

The code creates a new character journal, copies into it the attributes and abilities from the character journal assigned to the selected token, assigns the newly created journal to the selected token, get the current value of the STR attribute from the new journal, adds 10 to it, puts the new value back into the current STR attribute.

This is the error I receive when the code tries to execute the last line (oAttrib.set("current", attrib);):

/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function f(a){throw a;}var j=v ^ Error: Firebase.child failed: First argument must be a non-empty string and can't contain ".", "#", "$", "[", or "]". at Error () at Ha (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:12:204) at G.W.H (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:126:213) at TrackedObj._doSave (

The new journal is in fact created and assigned to the selected token. The attribute is taken from the new journal. But then I cannot put it back.

If I comment out the line where I assign the new journal ID (sheetID = character.id;) and the operation on the attribute is run on the original journal, all is fine.

Edit: Dev server

Any ideas?

Code: Gist .
December 20 (11 years ago)
Gauss
Forum Champion
I have filed a bug report with the Devs regarding this.
December 21 (11 years ago)
Fabio M.
KS Backer
Thanks.
December 26 (11 years ago)
Fabio M.
KS Backer
Any news on this? I mean, is it a confirmed bug? Thanks!
December 26 (11 years ago)
Gauss
Forum Champion
While I try to screen bugs for the Devs to provide the most information possible I cannot confirm API bugs (I do not mess with the API) so I simply report them to the Devs.
February 06 (11 years ago)

Edited February 06 (11 years ago)
Chad
Sheet Author
This definitely happens with the first access to a newly created object. I don't know why though. Here is the log of the newly created object:

"Object Created:"
{"_id":"-JF7TiSVJBIASKQ8cxQP","_pageid":"-JEPVW09YWGDxBXQWCyv","left":1225,"top":712,"width":70,"height":70,"rotation":0,"layer":"objects","isdrawing":false,"flipv":false,"fliph":false,"imgsrc":"https://s3.amazonaws.com/files.d20.io/images/2899512/hCM47Rg9qaw9ZZ7mxcEafw/thumb.png?1390874492","name":"MMRangeObject","gmnotes":"Aura tracking object for MoveManager. This is safe to delete.","controlledby":"","bar1_value":"","bar1_max":"","bar1_link":"","bar2_value":"","bar2_max":"","bar2_link":"","bar3_value":"","bar3_max":"","bar3_link":"","represents":"","aura1_radius":"30","aura1_color":"#666688","aura1_square":false,"aura2_radius":0,"aura2_color":"#CC8888","aura2_square":false,"tint_color":"transparent","statusmarkers":"","showname":false,"showplayers_name":false,"showplayers_bar1":false,"showplayers_bar2":false,"showplayers_bar3":false,"showplayers_aura1":true,"showplayers_aura2":false,"playersedit_name":true,"playersedit_bar1":true,"playersedit_bar2":true,"playersedit_bar3":true,"playersedit_aura1":true,"playersedit_aura2":true,"light_radius":"","light_dimradius":"","light_otherplayers":false,"light_hassight":false,"light_angle":"","light_losangle":"","sides":"","currentSide":0,"lastmove":"","_type":"graphic","_subtype":"token","_cardid":""}

And here is the log of the same object found by the next function run (With several seconds wait between the two runs of the functions, so there was certainly time for the object to be created.):

"Found existing object"
[{"_id":"-JF7TiSVJBIASKQ8cxQP","_pageid":"-JEPVW09YWGDxBXQWCyv","left":1225,"top":712,"width":70,"height":70,"rotation":0,"layer":"objects","isdrawing":false,"flipv":false,"fliph":false,"imgsrc":"https://s3.amazonaws.com/files.d20.io/images/2899512/hCM47Rg9qaw9ZZ7mxcEafw/thumb.png?1390874492","name":"MMRangeObject","gmnotes":"Aura tracking object for MoveManager. This is safe to delete.","controlledby":"","bar1_value":"","bar1_max":"","bar1_link":"","bar2_value":"","bar2_max":"","bar2_link":"","bar3_value":"","bar3_max":"","bar3_link":"","represents":"","aura1_radius":"30","aura1_color":"#666688","aura1_square":false,"aura2_radius":0,"aura2_color":"#CC8888","aura2_square":false,"tint_color":"transparent","statusmarkers":"","showname":false,"showplayers_name":false,"showplayers_bar1":false,"showplayers_bar2":false,"showplayers_bar3":false,"showplayers_aura1":true,"showplayers_aura2":false,"playersedit_name":true,"playersedit_bar1":true,"playersedit_bar2":true,"playersedit_bar3":true,"playersedit_aura1":true,"playersedit_aura2":true,"light_radius":"","light_dimradius":"","light_otherplayers":false,"light_hassight":false,"light_angle":"","light_losangle":"","sides":"","currentSide":0,"lastmove":"","_type":"graphic","_subtype":"token","_cardid":""}]

Yet an attempt to SET that found object resulted in an error:

/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function f(a){throw a;}var j=v ^ Error: Firebase.child failed: First argument must be a non-empty string and can't contain ".", "#", "$", "[", or "]". at Error () at Ha (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:12:204) at G.W.H (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:126:213) at TrackedObj._doSave (

All subsequent runs of exactly the same function, after SaveScript is pressed, work perfectly.
February 06 (11 years ago)
Fabio M.
KS Backer
Yes, I have the same results. Here is the other post covering this problem: link.