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

TypeError: Cannot read properties of undefined (reading 'substring') but everything is defined well enough(?)

So, I'm trying to set a macro for Lancer that helps roll dice for the Overcharge mechanic, it's a simple menu with some buttons that then run a second macro that rolls a dice depending on the button pressed, simple enough, however, when I use the buttons, I get the error in the title. Both macros work on their own, but as soon as I try to use the buttons to execute the secondary macros, the error pops up, I've triple checked the syntax over an over, and can't seem to find any errors.

The first macro goes like this:

&{template:default}{{name=Overcharge}}{{
Receive an extra quick action, but take Heat as well.
[1st Overcharge](~charge1)
[2nd Overcharge](~charge2)
[3rd Overcharge](~charge3)
[4+ Overcharges](~charge4)
}}

The secondary ones all goe like this:

&{template:default}{{name=1st Overcharge}}{{
Take +[[1]] Heat.
}}

The only thing that changes in the secondary macros is the [[1]] thing to [[1d3]], [[1d6]] and [[1d6+4]] respectively.

I seriously don't know what is happening with them and why they refuse to work together, they are supposed to be simple enough to not have any issues, I've even copy/pasted the names of the secondary macros in order to make sure they are the exact same, thank you everyone in advance.

July 24 (1 year ago)

Edited July 24 (1 year ago)

Nevermind I think I found the issue, though it's kind of weird. Apparently having this sort of macros in the collection tab and setting them as a token actions causes them to have this error. I made them into character macros and they started working just fine. It's pretty weird and I don't get why the problem exists, either way if someone finds a way to set them up as general macros, I would greatly appreciate it, since I don't want to have all my macros bundled together in characters.


Edit: I had also made a general macro for regular dice rolls that literally just was a few roll queries asking for # of dice, #of sides and modifier, executing it as a general macro only prints #General-Dice (the name of the macro), instead of the actual roll :). In summary, general macros are trash, just make a character template, nest all your macros in there instead and duplicate the template everytime you need a new character.

July 24 (1 year ago)
GiGs
Pro
Sheet Author
API Scripter

Was either one inside a query?

If not that, I'm not sure what the issue could be.

July 24 (1 year ago)
Gauss
Forum Champion

Chat Menus don't play nice with Collection tab macros without some extra work. 
In this particular case you were using the code for Ability macros (~macroname) rather than Collection tab macros (`#macroname)
Here is some reading about that. 

Collection tab macros have a couple limitations and as a result I generally avoid them and use Ability macros. I only use Collection tab macros to call Ability macros. 

In the future I recommend using a Macro Mule. It avoids all the Collection tab macro issues. 

Was either one inside a query?

If not that, I'm not sure what the issue could be.

No they weren't that's why the issue felt so weird to me, it didn't make sense in my eyes.

In this particular case you were using the code for Ability macros (~macroname) rather than Collection tab macros (`#macroname)

Here is some reading about that. 

Ah, that explains it I think, either way, good thing I thought about this sort of stuff beforehand so I'm not working directly with real characters, but making templates for PCs and NPCs that I'll duplicate later, and I'm putting all the macros inside them that way they have all the macros they need. I'll just be nesting all my macros inside the templates.