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 List to Call Game Macros

I have built some Jukebox Chat Menu Macros for various groups of sound effect and would like to create a "Master Jukebox" chat menu that will list buttons for the group macros. The two scripts I tried using are below:      /w GM &{template:general} {{color=green}} {{name=Jukebox }} {{ [**Combat**](~#Jukebox-Combat) }} | {{ [**Maps**](~#Jukebox-Maps)  }}       /w GM &{template:general} {{color=green}} {{name=Jukebox }} {{ [**Combat**](#Jukebox-Combat) }} | {{ [**Maps**](#Jukebox-Maps)  }} When I run either macro, the buttons come up, but when I select the first I get the error:  TypeError: Cannot read properties of undefined (reading 'substring') When I run the second option nothing happens when I click the button. This seems like it should be simple, but I can't seem to get it to work. Any help is greatly Appreciated! ~ Max
1718463618

Edited 1718463692
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Maxwell! Try this format: [**Combat**](!
#Jukebox-Combat)  The trick here is that the code after the exclamation point is the HTML replacement for a return. so you send: !
#Jukebox-Combat but chat resolves that code into a return and what actually resolves in chat when the button is pressed is: ! -- does nothing. The script interpreter thinks this is a script command #Jukebox-Combat -- new line, starting with the macro This is an old trick, but there is a catch. If you ever re-open the macro for editing, the HTML will resolve and break the macro. It becomes: [**Combat**](! #Jukebox-Combat)  Which will break. There are two ways to get around this: 1) Keep a pristine copy of such macros in a text editing document or Roll20 journal 2) (Better) Stop using macros, and start using abilities, stored on a character sheet They do not resolve the HTML, and have the extra benefit of being portable. You can move them between games by moving the macro character sheet (also called a macro mule). More information:  Macro Character Sheet More information about chat menus and how to format different commands:  Chat Menu
Thanks very much Keith, as I've researched different scripting I often see you helping many folks. I have read about the mules and haven't tried that yet. I will give it a go!
1718484315

Edited 1718485448
Hi Keith, Two more quick questions, at least for now... Is there a way to use a hyperlink style rather than the larger buttons? Also, I get this error message every time I use the chat menu to play a sound:  No ability was found for %{!roll20AM --audio,play|Vibro Blade} Is there any way to prevent the error message?
Maxwell said: One more quick question, at least for now... Is there a way to use a hyperlink style rather than the larger buttons? There are two ways that don't use an API script: HTML Styles in Chat  - adding html code into the button to make it display the way you want in chat.  Must be done for each macro/button. Something like this:  [**Combat**](!
#Jukebox-Combat" style="text-decoration: none; background: none; border: none; padding: 0px; color: #ce0f69; )  Inline Links in Chat  - using Stylus to affect the appearance of links in chat. Only affects the browser/screen of the player who adds the extension and code, but will work for all buttons.
1718488707
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Maxwell said: Hi Keith, Two more quick questions, at least for now... Is there a way to use a hyperlink style rather than the larger buttons? Also, I get this error message every time I use the chat menu to play a sound: No ability was found for %{!roll20AM --audio,play|Vibro Blade} Is there any way to prevent the error message? %{!roll20AM --audio,play|Vibro Blade} is not a valud Roll20 construction. % indicates an ability (macro stored on a character sheet) which means it needs to reference a sheet and ability: %{characetrname|abilityname} It can get more or less complicated than that depending on where you are using it, but if you supply context (i.e. the full macro), we might be able to help you refine it. The Chat Menu link I gave above goes into more depth about how to call macros and abilities from inside of command buttons. And Jarren's post above answer your other question. I use both methods they linked.
Thanks Keith, Here is the format of the macro: /w GM &{template:general} {{color=green}} {{name=Jukebox }} } {{**Combat**}} {{ [Arrow Barrage](~!roll20AM --audio,play|Arrow Barrage) }} I don't think it will matter but this is a 1e D&D game using the AD&D 1e Character Sheet.
Maxwell said: Thanks Keith, Here is the format of the macro: /w GM &{template:general} {{color=green}} {{name=Jukebox }} } {{**Combat**}} {{ [Arrow Barrage](~!roll20AM --audio,play|Arrow Barrage) }} I don't think it will matter but this is a 1e D&D game using the AD&D 1e Character Sheet. If you're directly calling an API command, you don't need the tilde. A tilde is used to call an Ability on a character sheet. /w GM &{template:general} {{color=green}} {{name=Jukebox }} } {{**Combat**}} {{ [Arrow Barrage](!roll20AM --audio,play|Arrow Barrage) }} To add in HTML styling it will look like this (untested): /w GM &{template:general} {{color=green}} {{name=Jukebox }} } {{**Combat**}} {{ [Arrow Barrage](!roll20AM --audio,play|Arrow Barrage" style="text-decoration: none; background: none; border: none; padding: 0px; color: #ce0f69;) }}
1718506459

Edited 1718511302
vÍnce
Pro
Sheet Author
keithcurtis said: This is an old trick, but there is a catch. If you ever re-open the macro for editing, the HTML will resolve and break the macro. It becomes: Didn't this get "fixed" with the new Jumpgate update?&nbsp; I thought I saw something about that in the beta thread... <a href="https://app.roll20.net/forum/permalink/11894938/" rel="nofollow">https://app.roll20.net/forum/permalink/11894938/</a> Lavi said: Hello from the Tabletop team! Sharing some updates from today's release (you can always reference this in our change log ) - Improved error reporting on Tabletop to show error alerts [in response to a couple forum posts mentioning freezing up error] - Removed legacy Voice &amp; Video Chat from Jumpgate games - Fixed a couple Jumpgate related bugs including: - Editing a macro no longer escapes the html encoding - The Freehand tool properly displays disabled state when on the Dynamic Lighting layer - Resizing the right hand bar on Tabletop now updates the play space accordingly - Fixed issue preventing Apply Token Defaults from applying token defaults - Tokens no longer snap on resize or rotate for Gridless maps - Updated Tutorial Translations with more optimized language
1718512251
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
vÍnce said: keithcurtis said: This is an old trick, but there is a catch. If you ever re-open the macro for editing, the HTML will resolve and break the macro. It becomes: Didn't this get "fixed" with the new Jumpgate update?&nbsp; I thought I saw something about that in the beta thread... <a href="https://app.roll20.net/forum/permalink/11894938/" rel="nofollow">https://app.roll20.net/forum/permalink/11894938/</a> Lavi said: Hello from the Tabletop team! Sharing some updates from today's release (you can always reference this in our change log ) - Improved error reporting on Tabletop to show error alerts [in response to a couple forum posts mentioning freezing up error] - Removed legacy Voice &amp; Video Chat from Jumpgate games - Fixed a couple Jumpgate related bugs including: - Editing a macro no longer escapes the html encoding - The Freehand tool properly displays disabled state when on the Dynamic Lighting layer - Resizing the right hand bar on Tabletop now updates the play space accordingly - Fixed issue preventing Apply Token Defaults from applying token defaults - Tokens no longer snap on resize or rotate for Gridless maps - Updated Tutorial Translations with more optimized language I believe this is correct, but haven't tested and didn't want to assume this is a Jumpgate game.
1718512786
vÍnce
Pro
Sheet Author
I get that.&nbsp; Just hoping we no longer have to worry about HTML substitutions getting converted accidentally by roll20. ;-)
1720296623

Edited 1720296686
Question about creating a macro mule, do all macros need to be built on the Attributes &amp; Abilities tab? If so, can you make them token actions for the selected token instead of the mule? For creating a mule for a spell book, can I use the spells section of the sheet and still have it pull aspects (e.g level)from the player's sheet instead of the mule so it can auto calc any variable effects?&nbsp; I should probably note that this is for a 1e D&amp;D campaign using Vince's awesome new character sheet.
1720301672
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Maxwell said: Question about creating a macro mule, do all macros need to be built on the Attributes &amp; Abilities tab? If so, can you make them token actions for the selected token instead of the mule? For creating a mule for a spell book, can I use the spells section of the sheet and still have it pull aspects (e.g level)from the player's sheet instead of the mule so it can auto calc any variable effects?&nbsp; I should probably note that this is for a 1e D&amp;D campaign using Vince's awesome new character sheet. Hi Maxwell! A universal token macro has to be built on the Collections tab if it is to be available to all tokens, otherwise it is local to the parent sheet. The collections tab token macro can just be a simple call to the Macro Mule Ability though. For your second question, it could probably be done, but would take far more effort and special case coding than it would be worth, i.e. the native spellcasting functions on the sheet would befar more efficient. Can you explain a little bit more about what you are trying to achieve with this second question. We might be able to suggest alternatives.
1720360094

Edited 1720360185
Thanks Keith, I guess the piece I'm not clear on, is what would the script look like to call an ablility from the mule and what script would be in the universal token macro? For the second part, spell list ~ Vince posted some detail on the Universal Chat Menu API. If works like a charm to pull attacks, spells, etc.
1720373073

Edited 1720373101
vÍnce
Pro
Sheet Author
Maxwell said: For the second part, spell list ~ Vince posted some detail on the Universal Chat Menu API. If works like a charm to pull attacks, spells, etc. For anyone following along;&nbsp; I simply made an API suggestion on the 1e game thread for a mod that handles creating chat menus with ease. An API Mod like GiG's Universal Chat Menu can be used to create chat menus for repeating sections like Attacks, Spells, or whatever. Highly recommend this mod!
1720373779
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
First some clarification of terms. Typically, when we use the word "script" on the forum, it refers to Javascript code in a Mod. We also say "API script" for historical reasons. Whether it is an Ability or a Macro, we typically refer to that as a "Macro" or "macro code". A Macro is macro code stored on the Collections Tab, an Ability is macro code stored on a character sheet. That out of the way, in the macro mule Ability would use the syntax "selected" to refer to any selected token. That makes it refer to the token selected while issuing the command instead of a token associated with the macro mule. Here is an example of a token action that reports on the current health of a selected token. This would be stored as an ability on a Macro Mule: @{selected|token_name} has @{selected|hp} hit points. Instead of making that a token action on every sheet, you create a macro on the Collections tab that calls the macro mule Ability, being sure to check the box that makes it a token action, and giving permission to "All Players". If the name of your Macro Mule was "Macros" and the Ability on the Macro Mule was called "HP-Report", that would look like this: %{Macros|HP-Report} % means it is calling an Ability, not a Macro (# is used for Macros) Brackets enclose the identification on which Ability is to be run The pipe separates the name of the macro mule character and the name of the Ability. You can find out more information about Macro Mules here on the wiki, and how to organize them into helpful menus in the chat box, here .
Thanks so much Keith. I appreciate your willingness to help those of us who are learning on the fly!