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

Ability Command Button fail: "TypeError: Cannot read properties of undefined (reading 'substring')"

Hello! I am creating some ability command buttons, and trying to make an inline damage button, but I am running into an issue. My first ability is this: Ability name: Make-Melee-Attack /desc @{character_name} strikes! [[@{MeleeAttack}d10>[[6-?{Modifier?|0}]]]] result points [Damage](~Damage) This works as desired, in terms of output, and generates a clickable button*. This is the other relevant ability: Ability name: Damage [[@{Strength}d10>[[6-?{Modifier?|0}]]]] damage dealt When run on its own, this also works as desired. However, when using the clickable in-line button generated by Make-Melee-Attack, the following error occurs: TypeError: Cannot read properties of undefined (reading 'substring') What am I doing wrong?
The button is lacking a reference to a sheet to load the ability from - for example, (~character|ability), where "character" is the name of the sheet with the ability. You can also call for the name on any given sheet with @{character_name} or the ID with @{character_id}, both of which work as references.
I should clarify at this juncture, that both abilities are one the same sheet. So...the examples in the documentation are flat-out wrong? It's never possible to make a functional action button with the format "[Label](~AbilityName)", because the generated button is not associated with the sheet that generated it? Bizarre. [Damage](~@{character_name}|Damage) appears to work, though. Assuming I'm not missing another issue down the line...
1732868374
GiGs
Pro
Sheet Author
API Scripter
When you print a button to the chat window, it does not know which sheet it came from. You need to follow Tuo's suggested and include a reference to the character in the button. If the examples in the documentation omit this, then yes, they are flatout wrong.
The documentation isn't wrong per se. However it only works with saved abilities. When using a saved ability it will insert the character id as a keyword if none is provided. If you are in editing mode and using the 'Test ability' button that behaves differently and doesn't perform the required text insertion to make them work.
RainbowEncoder said: The documentation isn't wrong per se. However it only works with saved abilities. When using a saved ability it will insert the character id as a keyword if none is provided. If you are in editing mode and using the 'Test ability' button that behaves differently and doesn't perform the required text insertion to make them work. This seems to be correct. The behavior differs between the "test ability" while the editor is open, and the "use ability" while the editor is not open. I did not test for this.