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

[help] fetch " Cannot read properties of undefined (reading 'substring')" error

I have been trying to use fetch but every time i use it i get this error over mod output console TypeError: Cannot read properties of undefined (reading 'substring') at handleInput (apiscript.js:2664:35) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:169:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:169:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1763:12 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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400 i've been testing it  with this script !token-mod {{ --ids @(Gneiss Rhoyod.token_id) --set width|3m height|3m}} it works if i just use this !token-mod {{ --set width|3m height|3m}} but i need fetch for other things
1725368322
timmaugh
Pro
API Scripter
Hey Adam... that error typically means that you've mixed Roll20 and Fetch syntax, so Roll20 is going to try to parse it in its way -- but you didn't give the vertical pipe character to separate the token reference from the property you wanted to return. To put a fine point on it... Roll20 wants curly braces enclosing the text and a vertical pipe: @{Gneiss Rhoyod|token_id} While Fetch wants parentheses enclosing the text, and will take either a vertical pipe or a period: @(Gneiss Rhoyod.token_id) If you mix those and use a period with the curly braces, Roll20 thinks you're trying to use Roll20 syntax, and it looks for vertical pipe (which isn't there), and you get the error you're seeing. Now, what you have entered (above) works for me in my test game. You have parentheses and a period, and Fetch does the parsing. Did you free-type that into the post? That is, is it possible that in your game you actually have curly braces and the period?
the script is copy-pasted directly so i have the same thing, i have found the problem: it doesn't work on jumpgate beta, muler has the same problem
1725372951
timmaugh
Pro
API Scripter
Ah, yeah. I know full script support isn't promised to Jumpgate until ... mid-September, I want to say... so I'm waiting to see how that settles out before I start making updates. Beacon sheets are in the same boat, so there are a lot of moving parts, currently, to the roadmap of future script development.
on further investigation zeroframe seems to be the culprit, fetch works fine without it