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 property 'substring' of undefined

November 08 (4 years ago)

Edited November 08 (4 years ago)

I don't know what is wrong with my macro, in fact I am sure it used to work fine years ago when I first made it, but maybe something has changed in Roll20 since then and there is something happening that I am not accounting for.

Anyway, here is the macro in question: 


[[floor((@{MR}-(@{Total Damage Received}))/2)+[[floor((@{MR}-(@{Total Damage Received})) / 10) + 1]]d6cs>6sd]]


The macro was made as a token macro, so the token is being selected (it has to be for the macro to be visible) and I have checked the two parameters dozens of times. They are both named correctly and the token is attached to them properly too.

November 09 (4 years ago)
David M.
Pro
API Scripter

When you say a "token macro": Is it in an Ability (on the Attributes & Abilities tab), or a Collections macro with Show as Token Action checked? If the latter, you will need to use @{selected|AttributeName} syntax. If the former, your @{AttributeName} syntax should work.

November 09 (4 years ago)

The token is connected to a character sheet which has the two variables as attributes on the "Atributes and abilities" page. When I called it a token macro, I meant just a macro that has "show as token action" checked off.

November 09 (4 years ago)

Edited November 09 (4 years ago)
Oosh
Sheet Author
API Scripter

@{MR} and @{Total Damage Received} are Attributes, but I think David was asking about that actual code ^^^ you posted. Are you running that from the Attributes & Ablities tab (i.e the right hand column, next to the Attributes) or is it from the Collections tab on the sidebar? The "Token Action" option is available in both kinds of macros.

If it's not saved on the character sheet under Attributes & Abilities, you'll need to provide the name of the sheet you want the Attributes pulled from.

@{bob|MR}

or

@{selected|MR}