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

Script error message

I am currently trying to figure out why my macro involving spawndefaulttoken, select manager, token mod, encounter helper, and zeroframe is reading an error. My desired outcome is to be able to spawn creature tokens from my journal onto the board and create an encounter with one macro, similar to Nick O. video. If anyone could help me figure this out that would be amazing. The current macro looks like this:  !{{  !Spawn --name|?{Which Monster|COMMONER|Guard|Noble} --qty|?{How Many} --placement|surround --tokenName|?{Encounter Name}  (^)!eh add ?{Encounter Name}{^&select ?{Encounter Name}*}{^&delay .3}  (^)!forselected token-mod --set name|?{Which Monster|Commoner|Guard|Noble} {^& select ?{Encounter Name}*}  }} This script continues to give me an error message of:    TypeError: Cannot read properties of undefined (reading 'who') TypeError: Cannot read properties of undefined (reading 'who') at handleInput (apiscript.js:34190:43) 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:1826: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:461
1732905711

Edited 1732905723
GiGs
Pro
Sheet Author
API Scripter
I don't know what's causing your iassue since I don't use that combination of scripts, butr I do notice something to check: Any script launching line must START with !, it cannot have any characters before it (including a space). So I weonder what those (^) are doing, but I'm wary of them.
Nick O. has a video talking about this macro he made from youtube. He says the (^) are suppose to delay the eh (encounter helper) and token-mod scripts until Spawndefaulttoken completes its program. I can try editing it out and see what happens.
1732934064
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
GiGs said: I don't know what's causing your iassue since I don't use that combination of scripts, butr I do notice something to check: Any script launching line must START with !, it cannot have any characters before it (including a space). So I weonder what those (^) are doing, but I'm wary of them. They are inside curly braces. I'm assuming the metascript must be accounting for the internal line breaks.
1732934107
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Can you link the Nick Olivo video?
1732939158
timmaugh
Pro
API Scripter
Hey, Ozzy... that syntax looks generally correct, but I can take a closer look if this suggestion doesn't fix it for you (based on your error, I think I know what this is)... When a message is sent to the scripts in your game, an object is created with certain properties. When a script calls another script (like ZeroFrame calling Spawn), that object is missing a few properties (selected tokens, the "playerid" property, and the "who" property). SelectManager *can* give all of these back, however, it only comes "pre-configured" to give back the selected tokens. To make your macro work, I believe you have to configure SelectManager to give back the "who" property. But , since there are only a few, rare scripts that require these properties to be turned off (for SelectManager), you might as well turn both properties on. So, to configure SelectManager to give back both the "who" and "playerid" properties of the message object, run this command one time in your game: !smconfig +who +playerid Then try your command again. It should work. (If it doesn't, post back and we'll figure it out.)
Thank you so much Timmaugh sir! That was exactly the problem I was having. Once I applied the config you suggested it worked like a charm, thank you very much for your help. I greatly appreciate what you do for the community