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

So i'm trying to make a Chat Menu for one of my NPC sheets that gives me quick access to all it's ability macros that are tied to it's sheet. The ability macro works without a problem on it's own, but when used through the Chat Menu, it gives me the TypeError: Cannot read property 'substring' of undefined, and I can't figure out why.

This is the ability macro.

/w gm &{template:default} {{name=Close the Gap}} {{Claw1=* Hit: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]+1[Weapon Focus]-2[Two-Weapon Fighting] ]] * Crit Confirm: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]+1[Weapon Focus]-2[Two-Weapon Fighting] ]] * Damage: * [[ 1d6+@{Kotokaze|str-mod}[STR] ]] Slashing}} {{Claw2=* Hit: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]+1[Weapon Focus]-2[Two-Weapon Fighting] ]] * Crit Confirm: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]+1[Weapon Focus]-2[Two-Weapon Fighting] ]] * Damage: * [[ 1d6+@{Kotokaze|str-mod}[STR] ]] Slashing}} {{Slam=* Hit: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]-2[Two-Weapon Fighting] ]] * Crit Confirm: * [[ 1d20+@{Kotokaze|melee-total}[Attack Bonus]-2[Two-Weapon Fighting] ]] * Damage: * [[ 2d6+@{Kotokaze|str-mod}[STR] ]] Bludgeoning + [[ 1d8+@{Kotokaze|str-mod}[STR] ]] Bludgeoning from Off-hand}}

Here is the Chat Menu, which only has the above ability in it for now as I am testing.

/w gm &{template:default} {{name=Test}} {{Test=[Close the Cap](~Close the Gap)}}

What am I doing wrong?

May 18 (4 years ago)
Kraynic
Pro
Sheet Author

Once the chat menu is in chat, the button isn't automatically associated with that sheet anymore.  I would try changing your button to:

{{Test=[Close the Cap](~Kotokaze|Close the Gap)}}

Assuming that is the sheet name that holds the ability macro...

Ah thanks. I feel stupid for not realizing that now. Thank you very much.

May 18 (4 years ago)

Edited May 18 (4 years ago)
Kraynic
Pro
Sheet Author

One thing you could do is to create a "character" called NPC Macros (or something like that).  You could then change your initial macro to use @{selected| instead of the name of the character.  Then it would call stats from the sheet associated with whatever token you have selected at the moment.  Then your button would be (~NPC Macros|Close the Gap), but would be usable on any npc that has the Close the Gap abilility.  You could even build generic chat menu macros on the NPC Macros sheet, move them to the top of the list so they are easy to find, then you copy/paste those attack/manuever lists as needed to an npc ability macro listing.  Set it as a token action, and any and all tokens associated with that sheet will have the button for that menu.

Using a macro sheet like that will allow you to only write the individual macros once, and you just copy/paste menus to different npc or PC depending on what macros/menus you end up creating) sheets as needed.  I also use sheets like this for GM macros.  I'll have a bunch of hidden group macros (skill rolls that may need to be hidden sometimes, print out a list of languages everyone knows, etc.) on a "character" with the menu being in the collections tab and set as a token action so that I can trigger them from any token.  Some may use the @{selected|, while others may be hard  coded with character names to roll (or display info) for all characters in the group at once.

Ah, that sounds cool. I just started to mess with macros today, so still learning.