Let me preface with this that I am new to the API, javascript, and web development in general. (My background is in python and java for scientific and engineering purposes) I am trying to implement a system for a DM friend (DoubleCross if anyone is curious). I am starting by getting the basic dice mechanic functions. However as I work I have been getting issues trying to just spit out my function returns so I can just check that the basic math is falling through before I start working on implementing other parts of the system. Here's my code:
https://gist.github.com/lord-xaphan/9fc2674372a7143631e97d988b987a95
If I run this I get or similar if I try to log my function outputs:
TypeError: Cannot convert object to primitive value
at diceAction (apiscript.js:26:32)
at apiscript.js:2:23
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16)
at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8)
at checkForReady (/home/node/d20-api-server/api.js:1438:12)
at /home/node/d20-api-server/api.js:1518:9
at c (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:14:64)
at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560
at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)
at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)
It seems to come up when I am trying to log but is inconsistent as it seems to work sometimes. I am not sure as to what I am doing wrong. Sorry if it is something obvious or easily Googlable.