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

Chat Menu not working as expected

1682101574
CryptoCartographer
Pro
Marketplace Creator
I'm making one of my first chat menus, and I've run into a problem. I'm making a character sheet with a chat menu of options from which one can run one of several other macros. (shoutout to KeithCurtis ) However… This macro renders as expected in the chat window All of the buttons are clickable Each of the referenced macros is present in the same character sheet, and they all run as expected when invoked individually. But all of the buttons in this chat menu return this message: TypeError: Cannot read properties of undefined (reading 'substring') It was working at one point, but I added more items and somehow broke it. Can anyone see the fault in my syntax? (Line breaks added for legibility) /w GM &{template:default} {{name=@{selected|Token_name} Condition}} {{[Blinded](~Blinded) [Deafened](~Deafened) [Exhausted](~Exhausted) [Frightened](~Frightened) [Grappled](~Grappled) [Invisible](~Invisible) [Incapacitated](~Incapacitated)=[**Paralyzed**](~Paralyzed) [**Petrified**](~Petrified)[**Poisoned**] (~Poisoned) [**Prone**](~Prone) [**Restrained**](~Restrained) [**Stunned**](~Stunned) [**Unconscious**](~Unconscious)}} {{[Clear All](~Clearall)=[**Dead**](~Dead)}}
1682102920

Edited 1682102928
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hey CryptoCartographer! I see a return in the middle of the poisoned button. There cannot be a space between ] and (.
1682106473
CryptoCartographer
Pro
Marketplace Creator
That is uncareful line-breaking on my part. The original code doesn't have that return.
1682106722
CryptoCartographer
Pro
Marketplace Creator
Even if I strip it down to bare bones, I'm still getting the error. This code exhibits the same problem: &{template:default} {{name=Macro}} {{[Blinded](~Blinded)[Deafened](~Deafened)}}
1682107119
Kraynic
Pro
Sheet Author
If I copy/paste that into one of my games, it displays the template and buttons just fine.  If you just copy/paste that directly into chat in your game, does it display correctly?
Is this menu also stored on the character sheet? If it's stored elsewhere (like a Collections Macro) you need to specify the character name as well. Also using the roll button whilst editing a character sheet ability behaves differently than using the roll button once it's saved which could cause this.
1682108287
timmaugh
Forum Champion
API Scripter
It is very likely not the chat menu itself since that renders correctly, but whatever ability you are clicking on. I know you said they run correctly on their own, but that is probably when you run them from the sheet. When you run them from the sheet, you can take advantage of the shorthand character notation: @{attribute} ...rather than having to use... @{character|attribute} I believe that running the ability from a button constitutes running it without the sheet context, so you'd have to use the second formation. Make that change to one of the macros that isn't working, then try it again from your chat menu. I bet you'll get a better result.
1682109578
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
RainbowEncoder said: Is this menu also stored on the character sheet? If it's stored elsewhere (like a Collections Macro) you need to specify the character name as well. Also using the roll button whilst editing a character sheet ability behaves differently than using the roll button once it's saved which could cause this. I misread the description in the original post. This is a good observation.
1682110408
timmaugh
Forum Champion
API Scripter
Right... the buttons will "render" in that they will correctly link the "click" to triggering the ability you want to trigger... but *those* abilities are then disconnected from the context of the sheet, and they will require full character qualification.
1682113032
CryptoCartographer
Pro
Marketplace Creator
Thanks for the info. All the macros are in the same character sheet with the chat menu macro. Per your comment, I'm now addressing the "child" macro with the Character sheet name. This successfully calls a child-macro when entered in chat: %{Conditions|Blinded} "Conditions" is the name of my character sheet with all the macros I tried this abbreviated macro to call the child macro from a button in the parent chat menu: /w GM &{template:default} {{name=@{selected|Token_name} Condition}} {[Blinded](%{Conditions|Blinded})} But instead it runs the child macro directly, with no stop at the button.  timmaugh said: Right... the buttons will "render" in that they will correctly link the "click" to triggering the ability you want to trigger... but *those* abilities are then disconnected from the context of the sheet, and they will require full character qualification. That may be 
The syntax for ability buttons, including the character name is [Blinded](~Conditions|Blinded)
1682115501
CryptoCartographer
Pro
Marketplace Creator
Thank you! It works now. RainbowEncoder said: The syntax for ability buttons, including the character name is [Blinded](~Conditions|Blinded)