Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Chat Menus"

From Roll20 Wiki

Jump to: navigation, search
m (Stargate Character Stats)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{main|Complete Guide to Macros & Rolls‎}}
+
{{revdate}}{{main|Complete Guide to Macros & Rolls‎}}
  
 
[[File:Chat-menus-example-sg.png|right|thumbnail|350px|Example of a '''Chat Menus''' and its buttons.]]''(Credit for the guide goes to [[keith|KeithCurtis']] original {{forum|permalink/5927072/ forum post}})''
 
[[File:Chat-menus-example-sg.png|right|thumbnail|350px|Example of a '''Chat Menus''' and its buttons.]]''(Credit for the guide goes to [[keith|KeithCurtis']] original {{forum|permalink/5927072/ forum post}})''
  
  
'''Chat Menus''' is a Clever trick for any Roll20 users, to create a Menu for yourself, where you have shortcuts to all the [[macros]], [[API]] commands, and dice rolls you want, accessible from a single macro.  
+
'''Chat Menus''' are a method allowing any Roll20 user to create a custom menu, with shortcuts to [[macros]], [[API]] commands, and dice rolls, accessible from a single macro call, and displayed on the {{Text Chat}}-tab.  
  
 
=Creating Chat Menus=
 
=Creating Chat Menus=
{{NavMacroDocs}}Although implied by the wiki, and used by many [[API|API scripts]], '''Chat Menus''' are very easy to make using [[Complete_Guide_to_Macros_%26_Rolls#API_Command_Buttons|API buttons]] (anyone can make and use of API buttons).
+
{{NavMacroDocs}}Although implied by the wiki, and used by many [[API|API scripts]], '''Chat Menus''' are very easy to make using [[Complete_Guide_to_Macros_%26_Rolls#API_Command_Buttons|API Command Buttons]] (anyone can make use of API command buttons—it does not require a subscription).
  
If you have a bunch of commonly used macros, rather than clutter up your map area with buttons, make a button that calls a menu of buttons into the chat area. This way you can call up a huge array of options with only a single extra click. I have several of these, categorized by use. Some examples are posted below.
+
If you have a bunch of commonly used [[macros]] or [[Character#Abilities|abilities]], rather than clutter up your map area with buttons, make a button that calls a menu of buttons into the chat area. This way you can call up a huge array of options with only a single extra click. Some examples are posted below, categorized by use..
  
 
To make a Chat Menu, it's smart to use a [[Roll Template]] to structure the Chat Menu. Because the formatting of Roll Templates, the appearance of a Chat Menu can vary widely from game to game. In general, though, the code is remarkably similar:
 
To make a Chat Menu, it's smart to use a [[Roll Template]] to structure the Chat Menu. Because the formatting of Roll Templates, the appearance of a Chat Menu can vary widely from game to game. In general, though, the code is remarkably similar:
  
 +
<sub><i>Parts of constructing a chat button. The versions below show the syntax for invoking different kinds of commands.</i></sub>
 
<pre style="overflow:auto;" data-language="javascript">
 
<pre style="overflow:auto;" data-language="javascript">
[command name](~macro-name)
+
[command name](code to run)
 
</pre>
 
</pre>
  
Default button syntax to reference a [[Macro]] in the {{collections}}-tab —You probably don't need to use this for a Chat Menu. Use one of the versions below.
 
  
 
==Roll Button/Character Ability==
 
==Roll Button/Character Ability==
Normally. Roll Buttons & character abilities are referenced with <code>%{character-name|ability-name}</code>.
+
Normally. Roll Buttons (built-in buttons on a character sheet) & character abilities (macros stored on the Attributes & Abilities tab of a character journal) are referenced with <code>%{character-name|ability-name}</code>.
  
If you use the {{forum|permalink/7605679/ macro character sheet tip}} and save the Chat menus macro on the character sheet, the format as you can skip the part about referencing the character name or use <code>selected</code>/<code>target</code>:
+
<sub><i>Button syntax to reference an Ability that is resident on the same character sheet.</i></sub>
  
 
<pre style="overflow:auto;">
 
<pre style="overflow:auto;">
Line 31: Line 31:
  
  
If you want to reference a macro that is on a character sheet (an "Ability"), but you are not writing the macro on the same sheet, you can reference the ability with this format (Assuming that your referenced a sheet named "Alice"). normally it would be referenced with <code>%{Alice|ability-name}</code>:
+
If you want to reference n Ability (macro built on a sheet), but you are <i>not</i> writing the macro on the same sheet, you can reference the external Ability with this format (Assuming that a sheet named "Alice" exists). normally it would be referenced with <code>%{Alice|ability-name}</code>:
  
 +
<sub><i>Button syntax to reference an Ability on another character sheet, such as a [[Macro Character Sheet]].</i></sub>
 
<pre style="overflow:auto;">
 
<pre style="overflow:auto;">
 
[command name](~Alice|ability-name)
 
[command name](~Alice|ability-name)
 
</pre>
 
</pre>
  
Button syntax to reference an Ability on another character sheet, such as a {{forum|permalink/7605679/ Macro Character Sheet}}.
 
  
 
==Global Macro==
 
==Global Macro==
If your macro is a loose, global [[Macro]] saved in the {{collections}}-tab , the code is a little more arcane, since you need to use [[Complete_Guide_to_Macros_%26_Rolls#HTML_replacement|HTML replacements]]. Normally calling the macro would be <code>#macro-name</code>, but this is the button:
+
If your [[Macro|macro]] is saved in the {{collections}}-tab , the code needs to be altered a bit, since the parser does not recognize `#` as an actionable bit of button code. There are two methods to make the parser run this sort of macro. The easiest is to place a backtick: {{c|`}} before the macro name:
  
 +
<sub><i>Button syntax to reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the [[Complete_Guide_to_Macros_%26_Rolls#HTML_replacement|HTML replacement]] if you need to edit.</i></sub>
 +
<pre style="overflow:auto;">
 +
[command name](`#macro-name)
 +
</pre>
 +
 +
This method became available when backticks were added to allow macros to easily run in handout links. The previous method was a little more arcane, since it required [[Complete_Guide_to_Macros_%26_Rolls#HTML_replacement|HTML replacements]]. The method is detailed here for reference to deciphering older macros, and because there are conceivable cases where it might be preferable. The HTML replacements fool the parser into thinking an API command was coming, and then insert a return character, followed by the macro name:
 +
 +
<sub><i>Older button syntax to reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the [[Complete_Guide_to_Macros_%26_Rolls#HTML_replacement|HTML replacement]] if you need to edit.</i></sub>
 
<pre style="overflow:auto;">
 
<pre style="overflow:auto;">
 
[command name](!&amp;#13;#macro-name)
 
[command name](!&amp;#13;#macro-name)
 +
</pre>
 +
This is parsed into two lines once it hits the chat. The first is ignored, being an empty API call. The second is run, being a macro name that "sneaked by" onto its own line:
 +
<pre style="overflow:auto;">
 +
!
 +
#macro-name
 
</pre>
 
</pre>
  
Button syntax to reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the [[Complete_Guide_to_Macros_%26_Rolls#HTML_replacement|HTML replacement]] if you need to edit.
+
==Roll Command==
 +
You can embed a Roll Command(i.e <code>/r 3d6+5</code>) into the API button instead of a macro. Place a backtick: {{c|`}} at the start and you can write a normal chat command:
  
 +
<sub><i>Syntax for embedding a die roll into a button.</sub></i>
 +
<pre>[embedded roll](`/r d20+4)</pre>
 +
 +
If you simply have a bit of code you use over and over, but a better practice (at least I have found) is to keep as much code saved in macros as possible, so that if you use the same command in different places. That way you only have to edit the original if you later decide to make changes.
 +
 +
 +
'''Note''': Sometimes you might need to use [[HTML Entities]] to escape some characters so the commands will read them properly:
 +
<pre>[End turn](`&amp;#42;&amp;#42;I END MY TURN&amp;#42;&amp;#42;)                      Same as: **I END MY TURN**, making it bold
 +
[Reaction](`/em shouts &amp;#34;Objection&amp;#34; and gestures wildly)    Same as: /em shouts "Objection" and gestures wildly
 +
[Name](!token-mod --set name|#&amp;#63;{Female Name&amp;#63;})              Same as: !token-mod --set name|?{Female Name?}</pre>
  
 
==Repeating Sections==
 
==Repeating Sections==
 
{{forum|permalink/8867823/ This post}} shows how to make buttons work for repeating sections.
 
{{forum|permalink/8867823/ This post}} shows how to make buttons work for repeating sections.
  
==Other==
 
the following code supposedly works in some places
 
<pre style="overflow:auto;">
 
[command name](#mightwork)
 
</pre>
 
  
Note also, that you can embed a Roll Command(i.e <code>/r 3d6+5</code>) into the API button instead of a macro, if you simply have a bit of code you use over and over, but a better practice (at least I have found) is to keep as much code in macros as possible, so that if you use the same command in different places, you only have to edit the original if you later decide to change how something works. If it's just an API call (a script call, beginning with "!"), it's pretty safe to pop in as-is.
+
Here are some Screenshots. These use the [[Shaped]] Sheet, which formats buttons as in-line text links. If you prefer that to the default "Big Pink Buttons" used by most other sheets on Roll20, use {{fpl|7455586/ this tip}} to style them for the [[D&D 5E by Roll20]] template, or {{fpl|7129900/ this tip}} to style them for the [[Roll_Templates#Default|default roll template]]:
 
+
Here are some Screenshots. These use the [[Shaped]] Sheet, which formats buttons as in-line text links. If you prefer that to the default "Big Pink Buttons" used by most other sheets on Roll20, use [https://app.roll20.net/forum/permalink/7455586/ this tip] to style them for the [[D&D 5E by Roll20]] template, or [https://app.roll20.net/forum/post/7129900/css-makeover-for-default-template this tip] to style them for the [[Roll_Templates#Default|default template]]:
+
 
[[File:Chat-menus-game-utils.png|left|thumbnail|400px| the macro for this is down the page]]
 
[[File:Chat-menus-game-utils.png|left|thumbnail|400px| the macro for this is down the page]]
 
[[File:Chat-menus-game-utils-2.png|right|thumbnail|400px|]]
 
[[File:Chat-menus-game-utils-2.png|right|thumbnail|400px|]]
<br><br><br><br><!-- extra linebreaks to place codeblock after the two images -->
+
<br clear=all>
<br><br><br><br>
+
<br><br><br><br>
+
<br><br><br><br>
+
<br><br><br><br>
+
<br><br><br><br>
+
  
 
=Examples=
 
=Examples=
Examples of Chat Menus. Please share yours here
+
Chat Menu Examples. Please share yours here
 +
 
 +
===Simple===
 +
A Chat menu with couple of chat commands. Completely standalone.
 +
<pre>&{template:default} {{name=Chat Menu }} {{[Attack (d20+4)](`/r d20+4)= [Damage (1d8+2)](`/r 1d8+2)}} {{[End turn](`I END MY TURN)=[Macro Guide](https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls)}}</pre>
 +
 
 +
===Bit of Everything===
 +
Example of each kind of buttons + show other things that can be shown in a roll.
 +
 
 +
Works if you select a token(linked to a character:
 +
<pre>&{template:default} {{name=Chat Menu for @{selected|character_name} }} {{roll=[[3d6+4]] }} {{Character Stats= **HP**: @{selected|hp} / @{selected|hp|max} }} {{[Macro (#)](`#idtoken)= [Ability/Sheet Button (%)](~selected|init)}} {{[API Command (!)](!token-mod --flip showname)= [embedded roll](`/r d20+4) }} {{[Macro Guide](https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls)=[Chat Menus](https://wiki.roll20.net/Chat_Menus)}}</pre>
  
 
===Global Macro menu===
 
===Global Macro menu===
Line 81: Line 103:
  
 
===PF2E Character Roll Menu===
 
===PF2E Character Roll Menu===
A Chat menu that shows the attributes of a character, along with buttons to roll each, + initiative with thw [[PF2E]] sheet. Also shows the name of the character in the title. Must select a token connected to a sheet to work. Otherwise replace <code>selected</code>-mentions with the character's name.
+
A Chat menu that shows the attributes of a character, along with buttons to roll each, + initiative with the [[PF2E|Pathfinder 2E]] sheet. Also shows the name of the character in the title. Must select a token connected to a sheet to work. Otherwise replace <code>selected</code>-mentions with the character's name.
 
<pre style="overflow:hidden;white-space:pre-wrap;">
 
<pre style="overflow:hidden;white-space:pre-wrap;">
 
&{template:default} {{name=Chat Menu: @{selected|character_name} }} {{Rolls=[Initiative](~selected|INITIATIVE) }} {{[STR](~selected|STR) @{selected|strength}=  }} {{[DEX](~selected|DEX) @{selected|dexterity}= [Reflex](~selected|REF) }} {{[CON](~selected|CON) @{selected|constitution}= [Fortitude](~selected|FORT) }} {{[INT](~selected|INT) @{selected|intelligence}=  }} {{[WIS](~selected|WIS) @{selected|wisdom}= [Will](~selected|WILL) }} {{[CHA](~selected|CHA) @{selected|charisma}=  }}
 
&{template:default} {{name=Chat Menu: @{selected|character_name} }} {{Rolls=[Initiative](~selected|INITIATIVE) }} {{[STR](~selected|STR) @{selected|strength}=  }} {{[DEX](~selected|DEX) @{selected|dexterity}= [Reflex](~selected|REF) }} {{[CON](~selected|CON) @{selected|constitution}= [Fortitude](~selected|FORT) }} {{[INT](~selected|INT) @{selected|intelligence}=  }} {{[WIS](~selected|WIS) @{selected|wisdom}= [Will](~selected|WILL) }} {{[CHA](~selected|CHA) @{selected|charisma}=  }}
Line 97: Line 119:
 
{{[CHA](~selected|CHA) @{selected|charisma}=  }}
 
{{[CHA](~selected|CHA) @{selected|charisma}=  }}
 
</pre>
 
</pre>
 +
 +
===Change Button Looks===
 +
[https://app.roll20.net/forum/permalink/9963693/ trick] by Ziechael
 +
 +
by adding a back-tick before the button value you can get an all text only display for the buttons:
 +
<pre>/w gm &{template:default} {{name=Melee Attacks: @{selected|character_name}}} {{[PUNCH 1](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE)=[KATANA 1](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE)}}{{[PUNCH 2](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE2)=[KATANA 2](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE2)}} {{[PUNCH 3](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE3)=[KATANA 3](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE3)}}</pre>
  
 
===Stargate Character Stats===
 
===Stargate Character Stats===
Line 129: Line 157:
 
**Languages: **@{selected|npc_languages}
 
**Languages: **@{selected|npc_languages}
 
  **Senses: **@{selected|npc_senses}
 
  **Senses: **@{selected|npc_senses}
  **Resists:: **@{selected|npc_resistances}
+
  **Resists: **@{selected|npc_resistances}
 
  **Immune: **@{selected|npc_immunities}
 
  **Immune: **@{selected|npc_immunities}
 
  **Cond. Immune: **@{selected|npc_condition_immunities}}}{{description=**Abilities**
 
  **Cond. Immune: **@{selected|npc_condition_immunities}}}{{description=**Abilities**
Line 203: Line 231:
  
 
====API Menu====
 
====API Menu====
 +
 +
For use with the 5E [[Shaped]] sheet and it's API.
 +
 
'''Sample code for the Utility Macro:'''
 
'''Sample code for the Utility Macro:'''
 
<pre style="overflow:auto;">
 
<pre style="overflow:auto;">
Line 233: Line 264:
 
}}
 
}}
 
</pre>
 
</pre>
 +
 +
===Dynamic Lighting Token Menu===
 +
macro by [[keith]]
 +
 +
 +
Used with {{5E}}, creating a [[Chat Menus]] to change selected tokens' [[UDL|Dynamic Lighting]] settings, using the [[TokenMod]] API. Quick way to set torches or some common Light spells.
 +
<pre style="overflow:auto;white-space:pre-wrap;">/w gm &{template:npcaction} {{rname=Vision and Light}}{{description=**Vision**
 +
[On](!token-mod --set has_bright_light_vision|on has_night_vision|on light_angle|360) | [Off](!token-mod --set has_bright_light_vision|off has_night_vision|off light_angle|360) | [GM](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|10 light_angle|360)
 +
[Touch](!token-mod --set  has_bright_light_vision|on has_night_vision|on night_vision_distance|5 light_angle|360) | [Blindfighting](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|10 light_angle|360)
 +
[Darkvision](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|60 light_angle|360 night_vision_effect|nocturnal) | [DV90](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|90 light_angle|360 night_vision_effect|nocturnal) | [DV120](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|120 light_angle|360 night_vision_effect|nocturnal) | [DV off](!token-mod --set has_bright_light_vision|on has_night_vision|off night_vision_distance|0 light_angle|360)
 +
**Light**
 +
[Off](!token-mod --set emits_bright_light|off emits_low_light|off light_angle|360) | [On](!token-mod --set emits_bright_light|on emits_low_light|on light_angle|360) | [Spot](!token-mod --set emits_bright_light|on bright_light_distance|5 low_light_distance|0 light_angle|360) |
 +
[Candle](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|2 low_light_distance|5 light_angle|360) | [Lamp](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|15 low_light_distance|15 light_angle|360) | [Torch](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|20 low_light_distance|20 light_angle|360)
 +
[Hooded Lantern](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|30 low_light_distance|30 light_angle|360) | [Bullseye Lantern](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|60 low_light_distance|60 light_angle|90)
 +
[*Light*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|20 low_light_distance|20 light_angle|360) | [*Daylight*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|60 low_light_distance|60 light_angle|360) | [*Dancing*](!token-mod --set emits_bright_light|off emits_low_light|on bright_light_distance|0 low_light_distance|10 light_angle|360) | [*Faerie Fire*](!token-mod --set emits_bright_light|off emits_low_light|on bright_light_distance|0 low_light_distance|10 statusmarkers|purple light_angle|360)
 +
[*Gem of Brightness*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|30 low_light_distance|30 light_angle|360)}}
 +
</pre>
 +
  
 
===Repeating Section===
 
===Repeating Section===
  
Link to a repeating section roll button, of a character we are referencing by character ID.
+
Link to a [[Repeating Section]]'s roll button, of a character we are referencing by character ID.
 
<pre>
 
<pre>
 
[menutext](~-MUlgDDvkwuV3fp3DH2C|repeatingability-mwgsob0-zzdesbyljzy_roll)
 
[menutext](~-MUlgDDvkwuV3fp3DH2C|repeatingability-mwgsob0-zzdesbyljzy_roll)
 
</pre>
 
</pre>
  
===Forum Links===
+
===Forum Examples===
 
+
links examples on the forum
* {{fpl|9944446/ - combine chat menu with dropdown query}}
+
* {{fpl|9944446/ combine chat menu with dropdown query}}
 +
* [https://app.roll20.net/forum/permalink/10095337/ Chat Menu buttons and /w gm]
  
 
=Related Pages=
 
=Related Pages=
Line 255: Line 305:
  
 
=See Also=
 
=See Also=
* {{forum|post/7478947/script-menu-maker Menu Maker}} by {{user profile|459831|Scott C.}} - API to generate Chat Menus
+
* {{forum|post/7478947/script-menu-maker Menu Maker}} by [[Scott C.]] - API to generate Chat Menus
 
* {{forum|post/7474530/script-call-for-testers-universal-chat-menus Universal Chat Menus}} by [[GiGs]] - another API to generate Chat Menus
 
* {{forum|post/7474530/script-call-for-testers-universal-chat-menus Universal Chat Menus}} by [[GiGs]] - another API to generate Chat Menus
 
* '''D&D 5E - Token Action Maker''' - This script creates token actions on selected tokens for the [[D&D 5E by Roll20]] sheet, very helpful for both NPCs and Players.
 
* '''D&D 5E - Token Action Maker''' - This script creates token actions on selected tokens for the [[D&D 5E by Roll20]] sheet, very helpful for both NPCs and Players.
** {{forum|permalink/8458497 forum thread}} (Created by Kevin, modified by keithcurtis, {{user profile|157788|GiGs}}, & Bretmckee)
+
** {{fpl|8458497 forum thread}} (Created by Kevin, modified by [[keithcurtis]], [[GiGs]], & Bretmckee)
 
<br>
 
<br>
 
<br>
 
<br>
Line 264: Line 314:
 
[[Category:Tips]]
 
[[Category:Tips]]
 
[[Category:Macros]]
 
[[Category:Macros]]
 +
[[Category:Featured articles]]

Latest revision as of 17:39, 15 March 2023

Main Page: Complete Guide to Macros & Rolls‎

Example of a Chat Menus and its buttons.
(Credit for the guide goes to KeithCurtis' original forum post(Forum))


Chat Menus are a method allowing any Roll20 user to create a custom menu, with shortcuts to macros, API commands, and dice rolls, accessible from a single macro call, and displayed on the q Text Chat-tab.

Contents

[edit] Creating Chat Menus

Although implied by the wiki, and used by many API scripts, Chat Menus are very easy to make using API Command Buttons (anyone can make use of API command buttons—it does not require a subscription).

If you have a bunch of commonly used macros or abilities, rather than clutter up your map area with buttons, make a button that calls a menu of buttons into the chat area. This way you can call up a huge array of options with only a single extra click. Some examples are posted below, categorized by use..

To make a Chat Menu, it's smart to use a Roll Template to structure the Chat Menu. Because the formatting of Roll Templates, the appearance of a Chat Menu can vary widely from game to game. In general, though, the code is remarkably similar:

Parts of constructing a chat button. The versions below show the syntax for invoking different kinds of commands.

[command name](code to run)


[edit] Roll Button/Character Ability

Normally. Roll Buttons (built-in buttons on a character sheet) & character abilities (macros stored on the Attributes & Abilities tab of a character journal) are referenced with %{character-name|ability-name}.

Button syntax to reference an Ability that is resident on the same character sheet.

[command name](~ability-name)  

By keeping your macros on a sheet along with the Chat Menu macro itself, you not only gain the advantage of transportability to new campaigns, you also ensure that nothing breaks once you transport it. The macro it's calling comes right along with it.


If you want to reference n Ability (macro built on a sheet), but you are not writing the macro on the same sheet, you can reference the external Ability with this format (Assuming that a sheet named "Alice" exists). normally it would be referenced with %{Alice|ability-name}:

Button syntax to reference an Ability on another character sheet, such as a Macro Character Sheet.

[command name](~Alice|ability-name)


[edit] Global Macro

If your macro is saved in the l Collections-tab , the code needs to be altered a bit, since the parser does not recognize `#` as an actionable bit of button code. There are two methods to make the parser run this sort of macro. The easiest is to place a backtick: ` before the macro name:

Button syntax to reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the HTML replacement if you need to edit.

[command name](`#macro-name)

This method became available when backticks were added to allow macros to easily run in handout links. The previous method was a little more arcane, since it required HTML replacements. The method is detailed here for reference to deciphering older macros, and because there are conceivable cases where it might be preferable. The HTML replacements fool the parser into thinking an API command was coming, and then insert a return character, followed by the macro name:

Older button syntax to reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the HTML replacement if you need to edit.

[command name](!&#13;#macro-name)

This is parsed into two lines once it hits the chat. The first is ignored, being an empty API call. The second is run, being a macro name that "sneaked by" onto its own line:

!
#macro-name

[edit] Roll Command

You can embed a Roll Command(i.e /r 3d6+5) into the API button instead of a macro. Place a backtick: ` at the start and you can write a normal chat command:

Syntax for embedding a die roll into a button.</sub>

[embedded roll](`/r d20+4)

If you simply have a bit of code you use over and over, but a better practice (at least I have found) is to keep as much code saved in macros as possible, so that if you use the same command in different places. That way you only have to edit the original if you later decide to make changes.


Note: Sometimes you might need to use HTML Entities to escape some characters so the commands will read them properly:

[End turn](`&#42;&#42;I END MY TURN&#42;&#42;)                      Same as: **I END MY TURN**, making it bold
[Reaction](`/em shouts &#34;Objection&#34; and gestures wildly)     Same as: /em shouts "Objection" and gestures wildly
[Name](!token-mod --set name|#&#63;{Female Name&#63;})              Same as: !token-mod --set name|?{Female Name?}

[edit] Repeating Sections

This post(Forum) shows how to make buttons work for repeating sections.


Here are some Screenshots. These use the Shaped Sheet, which formats buttons as in-line text links. If you prefer that to the default "Big Pink Buttons" used by most other sheets on Roll20, use this tip(Forum) to style them for the D&D 5E by Roll20 template, or this tip(Forum) to style them for the default roll template:

the macro for this is down the page
Chat-menus-game-utils-2.png


[edit] Examples

Chat Menu Examples. Please share yours here

[edit] Simple

A Chat menu with couple of chat commands. Completely standalone.

&{template:default} {{name=Chat Menu }} {{[Attack (d20+4)](`/r d20+4)= [Damage (1d8+2)](`/r 1d8+2)}} {{[End turn](`I END MY TURN)=[Macro Guide](https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls)}}

[edit] Bit of Everything

Example of each kind of buttons + show other things that can be shown in a roll.

Works if you select a token(linked to a character:

&{template:default} {{name=Chat Menu for @{selected|character_name} }} {{roll=[[3d6+4]] }} {{Character Stats= **HP**: @{selected|hp} / @{selected|hp|max} }} {{[Macro (#)](`#idtoken)= [Ability/Sheet Button (%)](~selected|init)}} {{[API Command (!)](!token-mod --flip showname)= [embedded roll](`/r d20+4) }} {{[Macro Guide](https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls)=[Chat Menus](https://wiki.roll20.net/Chat_Menus)}}

[edit] Global Macro menu

A menu showing the GM buttons for various global macros they have saved on the l Collections-tab. Skipping the Chat menu could could roll #pcstat & #pcpp directly in the q Text Chat.

/w gm &{template:default} {{name=Macro Chat Menu }} {{[PC overview](!&#13;#pcstat)= [Passive Pers.](!&#13;#pcpp) }} {{ [Wild Magic](!&#13;#wildmagictable)= [Passive Inv.](!&#13;#investigation)}}

[edit] PF2E Character Roll Menu

A Chat menu that shows the attributes of a character, along with buttons to roll each, + initiative with the Pathfinder 2E sheet. Also shows the name of the character in the title. Must select a token connected to a sheet to work. Otherwise replace selected-mentions with the character's name.

&{template:default} {{name=Chat Menu: @{selected|character_name} }} {{Rolls=[Initiative](~selected|INITIATIVE) }} {{[STR](~selected|STR) @{selected|strength}=  }} {{[DEX](~selected|DEX) @{selected|dexterity}= [Reflex](~selected|REF) }} {{[CON](~selected|CON) @{selected|constitution}= [Fortitude](~selected|FORT) }} {{[INT](~selected|INT) @{selected|intelligence}=  }} {{[WIS](~selected|WIS) @{selected|wisdom}= [Will](~selected|WILL) }} {{[CHA](~selected|CHA) @{selected|charisma}=  }}

Same macro, but in a readable form( remove linebreaks to make it work again):

&{template:default} {{name=Chat Menu: @{selected|character_name} }} 
{{Rolls=[Initiative](~selected|INITIATIVE) }} 
{{[STR](~selected|STR) @{selected|strength}=  }} 
{{[DEX](~selected|DEX) @{selected|dexterity}= [Reflex](~selected|REF) }} 
{{[CON](~selected|CON) @{selected|constitution}= [Fortitude](~selected|FORT) }} 
{{[INT](~selected|INT) @{selected|intelligence}=  }} 
{{[WIS](~selected|WIS) @{selected|wisdom}= [Will](~selected|WILL) }} 
{{[CHA](~selected|CHA) @{selected|charisma}=  }}

[edit] Change Button Looks

trick by Ziechael

by adding a back-tick before the button value you can get an all text only display for the buttons:

/w gm &{template:default} {{name=Melee Attacks: @{selected|character_name}}} {{[PUNCH 1](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE)=[KATANA 1](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE)}}{{[PUNCH 2](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE2)=[KATANA 2](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE2)}} {{[PUNCH 3](`~selected|repeating_melee-strikes_$0_ATTACK-DAMAGE3)=[KATANA 3](`~selected|repeating_melee-strikes_$1_ATTACK-DAMAGE3)}}

[edit] Stargate Character Stats

Example of the Stargate chat menu in use

Similar to the PF2E example, except it also displays the characters current & total HP. Using the Stargate char sheet.

&{template:stargate} {{title=@{selected|character_name} }} {{subtitle=Stat blocks}} {{ HP = @{selected|hp} / @{selected|hp|max} }}{{[Initiative](~selected|init)= [Moxie](~selected|moxie) }} {{@{selected|str} [STR](~selected|str) = [Save](~selected|str_save) }} {{@{selected|dex} [DEX](~selected|dex) = [Save](~selected|dex_save) }} {{@{selected|con} [CON](~selected|con) = [Save](~selected|con_save) }} {{@{selected|int} [INT](~selected|int) = [Save](~selected|int_save) }} {{@{selected|wis} [WIS](~selected|wis) = [Save](~selected|wis_save) }} {{@{selected|cha} [CHA](~selected|cha) = [Save](~selected|cha_save) }}


Same macro, but in a readable form( remove linebreaks to make it work again):

&{template:stargate} {{title=@{selected|character_name} }}
 {{subtitle=Stat blocks}}
 {{ HP = @{selected|hp} / @{selected|hp|max} }} 
{{[Initiative](~selected|init)= [Moxie](~selected|moxie) }} 
{{@{selected|str} [STR](~selected|str) = [Save](~selected|str_save) }} 
{{@{selected|dex} [DEX](~selected|dex) = [Save](~selected|dex_save) }} 
{{@{selected|con} [CON](~selected|con) = [Save](~selected|con_save) }} 
{{@{selected|int} [INT](~selected|int) = [Save](~selected|int_save) }} 
{{@{selected|wis} [WIS](~selected|wis) = [Save](~selected|wis_save) }} 
{{@{selected|cha} [CHA](~selected|cha) = [Save](~selected|cha_save) }}

[edit] 5E

Example for D&D 5E, often specifically for the D&D 5E by Roll20-char sheet.

[edit] NPC Statblock

NPC Statblock Chat Menu for D&D 5e sheet — No API required!(Forum) by Keithcurtis

/w gm &{template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|npc_type}
**HP: **@{selected|bar1} / @{selected|hp|max} | ** AC: ** @{selected|npc_ac} | **Spd: ** @{selected|npc_speed}
**Languages: **@{selected|npc_languages}
 **Senses: **@{selected|npc_senses}
 **Resists: **@{selected|npc_resistances}
 **Immune: **@{selected|npc_immunities}
 **Cond. Immune: **@{selected|npc_condition_immunities}}}{{description=**Abilities**
[**Str @{selected|strength}** *(@{selected|strength_mod})*](~selected|npc_str) | [save](~selected|npc_str_save)
[**Dex @{selected|dexterity}** *(@{selected|dexterity_mod})*](~selected|npc_dec) | [save](~selected|npc_dex_save)
[**Con @{selected|constitution}** *(@{selected|constitution_mod})*](~selected|npc_con) | [save](~selected|npc_con_save)
[**Int @{selected|intelligence}** *(@{selected|intelligence_mod})*](~selected|npc_int) | [save](~selected|npc_int_save)
[**Wis @{selected|wisdom}** *(@{selected|wisdom_mod})*](~selected|npc_wis) | [save](~selected|npc_wis_save)
[**Cha @{selected|charisma}** *(@{selected|charisma_mod})*](~selected|npc_cha) | [save](~selected|npc_cha_save)
**Skills**
[Acrobatics](~selected|npc_Acrobatics) | [Animal Handling](~selected|npc_Animal_Handling) | [Arcana](~selected|npc_Arcana) | [Athletics](~selected|npc_Athletics|Deception](~selected|npc_Deception) | [History](~selected|npc_History) | [Insight](~selected|npc_Insight) | [Intimidation](~selected|npc_Intimidation) | [Investigation](~selected|npc_Investigation) | [Medicine](~selected|npc_Medicine) | [Nature](~selected|npc_Nature) | [Perception](~selected|npc_Perception) | [Performance](~selected|npc_Performance) | [Persuasion](~selected|npc_Persuasion) | [Religion](~selected|npc_Religion) | [Sleight of Hand](~selected|npc_Sleight_of_Hand) | [Stealth](~selected|npc_stealth) | [Survival](~selected|npc_survival)
**Actions**
[@{selected|repeating_npcaction_$0_name}](~selected|repeating_npcaction_$0_npc_action)
[@{selected|repeating_npcaction_$1_name}](~selected|repeating_npcaction_$1_npc_action)
[@{selected|repeating_npcaction_$2_name}](~selected|repeating_npcaction_$2_npc_action)
[@{selected|repeating_npcaction_$3_name}](~selected|repeating_npcaction_$3_npc_action)
[@{selected|repeating_npcaction_$4_name}](~selected|repeating_npcaction_$4_npc_action)
}} &{noerror}

[edit] Spellblock

thread(Forum) by keithcurtis

/w gm &{template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|npc_type}}}{{description=**Caster Level: @{selected|caster_level}**
**Spell Save DC: @{selected|spell_save_dc}**
**Spellcasteing Ability Mod: [[@{selected|spellcasting_ability}@{selected|pb}]]**
**Cantrips**
[@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)
[@{selected|repeating_spell-cantrip_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell)
[@{selected|repeating_spell-cantrip_$2_spellname}](~selected|repeating_spell-cantrip_$2_spell)
[@{selected|repeating_spell-cantrip_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell)
[@{selected|repeating_spell-cantrip_$4_spellname}](~selected|repeating_spell-cantrip_$4_spell)
**Level 1**
[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell)
[@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell)
[@{selected|repeating_spell-1_$2_spellname}](~selected|repeating_spell-1_$2_spell)
[@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell)
[@{selected|repeating_spell-1_$4_spellname}](~selected|repeating_spell-1_$4_spell)
**Level 2**
[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell)
[@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell)
[@{selected|repeating_spell-2_$2_spellname}](~selected|repeating_spell-2_$2_spell)
[@{selected|repeating_spell-2_$3_spellname}](~selected|repeating_spell-2_$3_spell)
[@{selected|repeating_spell-2_$4_spellname}](~selected|repeating_spell-2_$4_spell)
**Level 3**
[@{selected|repeating_spell-3_$0_spellname}](~selected|repeating_spell-3_$0_spell)
[@{selected|repeating_spell-3_$1_spellname}](~selected|repeating_spell-3_$1_spell)
[@{selected|repeating_spell-3_$2_spellname}](~selected|repeating_spell-3_$2_spell)
[@{selected|repeating_spell-3_$3_spellname}](~selected|repeating_spell-3_$3_spell)
**Level 4**
[@{selected|repeating_spell-4_$0_spellname}](~selected|repeating_spell-4_$0_spell)
[@{selected|repeating_spell-4_$1_spellname}](~selected|repeating_spell-4_$1_spell)
[@{selected|repeating_spell-4_$2_spellname}](~selected|repeating_spell-4_$2_spell)
**Level 5**
[@{selected|repeating_spell-5_$0_spellname}](~selected|repeating_spell-5_$0_spell)
[@{selected|repeating_spell-5_$1_spellname}](~selected|repeating_spell-5_$1_spell)
[@{selected|repeating_spell-5_$2_spellname}](~selected|repeating_spell-5_$2_spell)
**Level 6**
[@{selected|repeating_spell-6_$0_spellname}](~selected|repeating_spell-6_$0_spell)
[@{selected|repeating_spell-6_$1_spellname}](~selected|repeating_spell-6_$1_spell)
**Level 7**
[@{selected|repeating_spell-7_$0_spellname}](~selected|repeating_spell-7_$0_spell)
[@{selected|repeating_spell-7_$1_spellname}](~selected|repeating_spell-7_$1_spell)
**Level 8**
[@{selected|repeating_spell-8_$0_spellname}](~selected|repeating_spell-8_$0_spell)
[@{selected|repeating_spell-8_$1_spellname}](~selected|repeating_spell-8_$1_spell)
**Level 9**
[@{selected|repeating_spell-9_$0_spellname}](~selected|repeating_spell-9_$0_spell)
[@{selected|repeating_spell-9_$1_spellname}](~selected|repeating_spell-9_$1_spell)
}} &{noerror}

[edit] API Menu

For use with the 5E Shaped sheet and it's API.

Sample code for the Utility Macro:

/w gm &{template:5e-shaped} {{title=Utility Menu}} {{text_big=[Configure Shaped Options](!shaped-config)
**Import Spells**
[Spells](!shaped-spells) | [Remove All Spells](!shaped-remove-spell --all)
[Expand Spells](!shaped-expand-spells)
**Import Monsters**
[Monster](!shaped-monsters) | [Replace and Overwrite Monster](!shaped-monsters --replace)
[From Statblock](!shaped-import-statblock) | [From Token Name](!shaped-import-by-token)
**Character Creation**
[Character Builder](~Character-Builder)
**Create Token Macro Buttons**
[Attacks](!shaped-abilities --attacks) | [Actions](!shaped-abilities --actions) | [Reactions](!shaped-abilities --reactions)
[Traits](!shaped-abilities --traits) | [Racial Traits](!shaped-abilities --racialTraits)
[Class Features](!shaped-abilities --classFeatures) | [Feats](!shaped-abilities --feats)
[Legendary Actions](!shaped-abilities --legendaryA) | [Lair Actions](!shaped-abilities --lairA)
**Setup**
[Set Token to Defaults](!shaped-apply-defaults)
[Set Default Token](!token-mod --set defaulttoken) 
[Update to Current Sheet](!shaped-update-character)
[Update All-Caution](!shaped-update-character --all)
**Rests and Resets**
[Short Rest](!shaped-rest --short) | [Long Rest](!shaped-rest --long) 
**Utility**
[Health Aura On](!setattr --sel --USECOLOR|YES !aura update) | [Health Aura Off](!setattr --sel --USECOLOR|NO !aura update)
[Door Commands](!&#13;#{Macros|Doors})
[Ready Roofs](!RoofReady)
[Summon Duplicates](~Summon)
}}

[edit] Dynamic Lighting Token Menu

macro by keith


Used with D&D 5E by Roll20
Character   Sheet
, creating a Chat Menus to change selected tokens' Dynamic Lighting settings, using the TokenMod API. Quick way to set torches or some common Light spells.
/w gm &{template:npcaction} {{rname=Vision and Light}}{{description=**Vision**
[On](!token-mod --set has_bright_light_vision|on has_night_vision|on light_angle|360) | [Off](!token-mod --set has_bright_light_vision|off has_night_vision|off light_angle|360) | [GM](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|10 light_angle|360)
[Touch](!token-mod --set  has_bright_light_vision|on has_night_vision|on night_vision_distance|5 light_angle|360) | [Blindfighting](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|10 light_angle|360)
[Darkvision](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|60 light_angle|360 night_vision_effect|nocturnal) | [DV90](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|90 light_angle|360 night_vision_effect|nocturnal) | [DV120](!token-mod --set has_bright_light_vision|on has_night_vision|on night_vision_distance|120 light_angle|360 night_vision_effect|nocturnal) | [DV off](!token-mod --set has_bright_light_vision|on has_night_vision|off night_vision_distance|0 light_angle|360)
**Light**
[Off](!token-mod --set emits_bright_light|off emits_low_light|off light_angle|360) | [On](!token-mod --set emits_bright_light|on emits_low_light|on light_angle|360) | [Spot](!token-mod --set emits_bright_light|on bright_light_distance|5 low_light_distance|0 light_angle|360) | 
 [Candle](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|2 low_light_distance|5 light_angle|360) | [Lamp](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|15 low_light_distance|15 light_angle|360) | [Torch](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|20 low_light_distance|20 light_angle|360)
[Hooded Lantern](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|30 low_light_distance|30 light_angle|360) | [Bullseye Lantern](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|60 low_light_distance|60 light_angle|90)
[*Light*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|20 low_light_distance|20 light_angle|360) | [*Daylight*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|60 low_light_distance|60 light_angle|360) | [*Dancing*](!token-mod --set emits_bright_light|off emits_low_light|on bright_light_distance|0 low_light_distance|10 light_angle|360) | [*Faerie Fire*](!token-mod --set emits_bright_light|off emits_low_light|on bright_light_distance|0 low_light_distance|10 statusmarkers|purple light_angle|360)
[*Gem of Brightness*](!token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|30 low_light_distance|30 light_angle|360)}}


[edit] Repeating Section

Link to a Repeating Section's roll button, of a character we are referencing by character ID.

[menutext](~-MUlgDDvkwuV3fp3DH2C|repeatingability-mwgsob0-zzdesbyljzy_roll)

[edit] Forum Examples

links examples on the forum

[edit] Related Pages

[edit] See Also