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 "Complete Guide to Macros & Rolls"

From Roll20 Wiki

Jump to: navigation, search
m (Images)
m (Roll Queries)
Line 103: Line 103:
  
 
* [https://app.roll20.net/forum/permalink/6053873/ Query Ordering Without Affecting Functionality] how to borrow API command syntax(works for free users) - Ziechael
 
* [https://app.roll20.net/forum/permalink/6053873/ Query Ordering Without Affecting Functionality] how to borrow API command syntax(works for free users) - Ziechael
 +
* [https://app.roll20.net/forum/permalink/5927072/ Chat Menus],by Keith - In some cases, creating a '''chat menu''' for your macros is easier or better than making a complicated Query with several options.
  
 
====Nesting====
 
====Nesting====

Revision as of 13:21, 14 October 2020

This is meant to serve as a comprehensive guide & starting point for figuring out how the q Text Chat, Dice Rolling, Macros and related things work and interact with each-other, and to list everything you can write/make appear in the q Text Chat.

This is both for Players/Game Masters who are just writing their own custom rolls or macros to be used in their game, as well as those who build Character Sheets and are creating/editing Roll Buttons for their sheets.

Contents

Basics

The q Text Chat page shows the basic commands that can be used in the chat, such as /roll(or /r) for making simple rolls, /em for emoting text, /w for whispering to someone, and /gmroll(or /gr) for sending simple rolls to the GM.

You can write in the q Text Chat normal text without using any commands like /r.

Text Formatting

You can use common Markdown to format you text, and to create hyperlinks.

See also:

Chat Commands

Main Page: q Text Chat

  • /r, /roll - for making simple rolls. Ex. /r 1d20+5
  • /w - for whispering a message to a person so only they see it. Ex. /w Alice Does the goblin know the paladin?, /w "Bob Smith" Where's the money pouch?!
  • /gr, /gmroll - to make rolls only to the GM. Ex. /gr 2d6+3
  • /em to emote as the character selected. Ex. /em takes out one of his throwing daggers and brandishes it threateningly.
  • /ooc - to message something that is Out-of-character Ex. /ooc I could really use another coffee right now.
  • /talktomyself - To turn off your chat display for all others, including the GM and the chat archive recording. Use it again to turn it back on
  • /fx - used for creating visual effects Ex. /fx beam-acid @{target|Caster|token_id} @{target|Foe|token_id}
  • GM-exclusive:
    • /desc to describe the situation Ex. The old house begins to creak and moan...
    • /as, /emas emote as any character, better version of /em Ex. /as "Sir Bearington" I'm going to eat you for breakfast.


Beyond using the various Roll Commands shown on the q Text Chat-page, here are some other examples of what you can write in the q Text Chat:

  • Macros - Start with #, and start typing the macro name, and a list of your macros will be displayed.
    • Example: writing #testmacro in the chat will roll the macro with that name
  • Roll Templates - &{template:name-of-roll-template} {{sectionname(optional)=content of roll template}}.
    • The Default Roll Template is available in any games, other templates are tied to specific Character Sheet Templates. (E.g. you can only access the specific &{template:simple} when you have D&D 5E by Roll20-sheet in the game).
    • Example: &{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{damage=[[2d6]]}}
    • This will generate a roll template using the default template, displaying "Test Attack" in the purple title, then on a new row the result of 1d20 roll, and on the third row the 2d6 roll
  • Character Abilities/Character Sheet Button - %{character name|ability or roll button name}
    • Example 1; writing %{Sam Bobbins|initiative} in the chat, will work if there exists a Character with that name, who have a Character Ability/Character Sheet Roll Button by that name
    • Example 2: selecting a Token on the map, and then writing %{selected|initiative} in the chat, will work if the token is linked to a character sheet that has an Ability or Roll button with that name.
  • API commands(available in games hosted by a pro user), - Start with ! to call the API command, and then write and parameters it can take
    • Example: writing !MassInit in the chat will trigger an API that uses MassInit as a keyword.

Dice Syntax

The Dice Reference page shows how the syntax for the Roll20 dice rolling works, and all the advanced alternatives you can use, such as rolling Fate Dice, or counting successes rather than the sum of the rolls. It also details when the green "Critical Success" and red "Critical Failure" highlights are shown.

Tricks:

Order of Operations

The Order of Operations sections highlights in what order different components resolve, which can become important when you do complicated things.

Inline Labels

If you want to include additional comments before the end of the roll (we call them "inline labels"), use square brackets. For example, /roll 2d10+5[Fire Damage] + 3d6[Ice Damage]. When these comments are applied directly after a die roll they show up as tool-tips on the dice:

/roll 2d10+5[Fire Damage] + 3d6[Ice Damage]

This is especially useful if a roll contains multiple variables and you want to look up what number comes from what attribute.

Macros

The main Macros page lists all the the other kind of options for modifying rolls that isn't covered by the Dice Reference-page. Also check the Stupid Roll20 Tricks (and some clever ones)-thread for Advanced and clever tricks that might not be linked on this page yet.

Features include:

Errors

If there is a mistake in the macro, or an attribute is missing, the roll might not work at all and only send and error message in the chat.

In some cases you can suppress error message and the roll will try to do what it can while removing the error message.

/roll 1d20 + @{selected|nonexistent_attribute} &{noerror}

Roll Queries

Sometimes you may have a roll (or a macro) which you want to change every time it is rolled. For example, you may want to roll a variable number of dice, or add a different modifier onto the roll each time you perform the action. Roll Queries allow you to prompt whoever is performing the roll to fill in a value when the roll is made. The syntax for a roll query is:

?{Prompt Message}
//Example:
/roll ?{Number of Dice}d20
//You can also include a default value:
/roll ?{Number of Dice|1}d20
// 1 would be the default

Drop-down Queries

You can specify a list of options which can be presented to the player, rather than only a free-form text field.

Syntax:

?{Name of Query|Option1|Option2|Option3|Option4|Option5}

You can also specify a different value for the result other than label like so:

?{Name of Query|Label 1, value1|Label 2, value2}

Nesting

To some degree, you can nest abilities, macros and queries.

If you start nesting queries too much, you need to star using HTML replacement keep the macros working. Once saved, these macros shouldn't be opened(if saved in the l Collections-tab's Macro section, as opening a macro that have HTML replacement will result in those being converted into regular things, breaking your macro.

  • Drop down Nester google sheet that generates the HTML replacement code needed. Scott C.

Initiative

Main section: Macros#Rolling_For_Initiative

To send a roll result directly to the Turn Tracker, first, select the Token you wish to roll initiative for, and then make a roll that includes the &{tracker}-flag. You can also increase/decrease initiative by using &{tracker:+}/&{tracker:-}.

Examples:

  • /roll 1d20 + 5 &{tracker}
  • &{template:default} {{name=Initiative}} {{Roll=[[1d20+4 &{tracker}]]}}
  • /roll 1d4 + 1 &{tracker:+} (increases the initiative by 1d4+1)
  • /roll 2 &{tracker:-} (decreases the initiative by a flat 2)
  • [[5 &{tracker:-}]] (inline roll that decreases the initiative by a flat 2)

See also: Cards#Using_Cards_for_Initiative_Order

See the Turn Tracker-page for the Token/Turn Tracker/Character Sheet related info.

Tricks using the Turn Tracker:

Chat Buttons

There are two types of buttons you can create in the Text Chat to be included in a macro/dicerolling result.

Ability Command Buttons

Ability Command Buttons can be used to call Abilities (or sheet button rolls) from a clickable button in the Text Chat. They are very closely related to API Command Buttons.

Their syntax is as follows:

[Label](~<keyword>|<ability name>)

As with Attribute and Ability calls, the keyword is your choice of selected, target or a character_name. You can also use a character_id as a keyword.

If you have an Ability Command Button saved somewhere within one of the tabs of the Character Window, you can choose to omit a keyword:

[Label](~<ability name>)

API Command buttons

API Command buttons do not actually use the API—anyone can make and use them. The Chat Menus trick by Keith, uses utilizes them to great length.

Roll Table

If you have Roll Tables on your l Collections-tab, they can be used in rolls & macros.

Example1:

Let's assume there exist a roll table with the name fumble.

You can roll a table directly in the chat input, or in a macro, simply as 1t[fumble].

Example 2: To roll your "crit-failure" table two time, you would enter /roll 2t[crit-failure]. You can change 2 to whatever number you would like. However, this currently does not work with inline rolls.

You can also roll a table inline in chat or a macro by wrapping it in double square brackets like this [[1t[table-name]]]. Currently, any number beyond 1 does not display for the inline roll, the results are show on mouseover though.


Roll Templates

Main Page: Roll Templates

You can access the Default Roll template in any game, to structure your results in the Text Chat. You simply write the template in the chat/macro( and don't use the "/roll").

Roll template default example.JPG
&{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{damage=[[2d6]]}}

You can use a Roll Template in general messages (without a command like "/desc" or "/emote") and whispers. You can't use roll templates with the "/roll" command; instead, Roll Templates are meant to be used with inline rolls. As long as they use inline rolls, you can use Roll Templates with macros, Character Abilities, and sheet authors can use them inside of their Roll Buttons on sheets.

Many character sheets have built in Roll Templates that can only be used with those specific character sheets.

Tricks:

  • Use images with Default Roll Template: If you want to dress up your default template, you can stuff an image in the name portion instead of just text
    • Example: &{template:default}{{name=[x](YOUR_IMAGE_URL#.png)}}{{test=foo}}
  • Overwriting Template Fields in Macros - Oosh

Images

Various ways to use or show images in macros or the chat.

Advanced

The Stupid Roll20 Tricks (and some clever ones) contains a large amount of tricks and examples of clever uses for macros etc. that is a must to check out.

Here under are mentioned a limited number of the list's tricks(more could be listed or copied entirely to the wiki):

Token

Main Section: Macros#Token

The selected-keyword will allow you to pull information from the element that is currently selected on the screen when the roll/macro is executed. So for example, if you want to pull the value of Bar 1 from the selected Token during a roll, you can do:

/roll 1d20 + @{selected|bar1}

You can use "bar1", "bar2", or "bar3". In addition, you can also pull an attribute from the Character linked to that token, if there is one:

/roll 1d20 + @{selected|Intelligence}

You can pull the Name of the currently selected tokens by using the "token_name" variable.

/em @{selected|token_name} fires his gun!

If the selected token has a character journal linked to it, you can pull the Name from the character journal instead, using the "character_name" variable.

/em @{selected|character_name} blocks with his shield!

You can also trigger abilities from the linked character journal by using the ability name as a variable.

%{selected|Attack}

Finally, we've introduced a third argument for variables, allowing you to pull the "max" of a bar or attribute:

/roll 1d20 + @{Guard|Intelligence|max}
/roll 1d20 + @{selected|bar2|max}


You can also use target with macros referring to tokens, see Macros#Advanced_Usage_for_Targeted_Attribute_Calls

Token Actions

Token Actions are specially-designated macros and character abilities (with tokens representing a character) which appear whenever a token is selected on the screen. They appear in a bar along the top of your screen, and the contents of the bar are context-sensitive. When you select a token, all macro token actions will be shown, as well as ability token actions for the token's linked character (if applicable).

API

API commands start with ! and then the name of the API command, and then write any other parameters for the API. The specific API script need to be installed in the game for this to work.

Example 1: writing !wd [[4d6+2]] in the chat will trigger the Script:Wild Dice script to make a custom roll output, rolling 3 normal d6 dice, and one Wild Die, presenting it in a table. If the Wild Die comes up as a "1", it, and the value of the highest dice is removed form the roll total. This is not something that can be done with macros alone, which is why this API was created.

Wild-Dice-result-v3-4.png

Example 2:

writing !group-init in the chat will trigger the GroupInitiative(must be installed) API that uses group-init as a keyword. This particular API command would roll initiative order for all selected tokens, if the API is configured to know what stats to roll.

Example 3:

writing &{template:default} {{name=Cthulhu}} !modattr --silent --charid @{target|character\_id} --sanity|-{{Sanity damage=[[2d10+2]]}} --corruption|{{Corruption=Corruption increases by [[1]]}}!!! {{description=Text}} in the chat, and selecting a Token on the map, will decrease sanity by 2d10+2 and increase corruption by 1 for the character selected.

This is the ChatSetAttr API, which can be used standalone with the !modattr command, but more notably, can be incorporated into regular macros, resulting in you being able to both make rolls and have the result change the stats.

API Command Buttons

They have simple Markdown formatting:

[Attack Roll](!attackroll)

You can also send them into the chat for others to use, but them needs to use HTML Replacement like with #Nesting:

[Attack Roll](!attackroll &#64;{target|token_id} &#91;[1d6+&#63;{Bonus|0}]&#93;)

API Command buttons do not actually use the API — anyone can make and use them. The Chat Menus trick by Keith, uses utilizes them to great length.

Tricks:

Relevant API

APIs that have lots of commands or have lot to do with dice rolling.

  • Script:ChatSetAttr - can be used inline & mixed in with other macros
  • PowerCards - API made to display stats in variety of way in the chat, essentially a sophisticated, API-based version of the Default Roll Template with massive amount of features. It can be used to call other API like ChatSetAttr or TokenMod
  • InsertArg & XRay script that gives you a way to interact with information in the game and feed it to the chat and/or other scripts, or to build your own output on the fly.
  • TokenMod API that can edit any info on tokens. If token's are linked to a character, the changes to token bars extends to the character sheet.
  • Combat Master Alpha Manages many facets of combat. It allows for API and Macro calls at various timing points (beginning of each round, beginning of each turn, when a condition is assigned, when a condition is removed).
  • Token Action Maker
  • Rollable Table Macros - a simple script that gets an item from a rollable table and enters its name as a chat message rather than showing it as a rollable table result
  • Script:Star Wars: Fantasy Flight Games - Dice Roller - API for rolling the custom dice system used in the game

Character Sheet Creation

Info and links to things that are only relevant or usable for when you're Building/Editing Character Sheets. Consult the rest of the guide for general details.

Roll Button

The rest of this guide will help in creating more complicated macros, but the main Button#Roll_Button-page have some concrete examples of how macros are implemented in character sheets.

Sheetworkers

With the info from Macros, fairly complex outputs to the q Text Chat can be made, but to be able to construct complex and dynamic results based on various factors on your character sheet, you will need to use JavaScript to write Sheet Worker Scripts that modify & construct your roll output dynamically.

Roll Template

When you create/edit a character sheet, you can make your own Roll Templates to make your roll output look like you want, and to do some conditional things such as only showing some sections in case of a critical roll in another sections.

See Roll_Templates#Creating_a_Roll_Template for more.

Roll_Templates#Helper_Functions describes what functions you can build into your sheets.

Related Pages

  • Complete Guide to Macros & Rolls‎
    • q Text Chat - where the roll results appear, & info on the common chat commands
    • Dice Reference - Comprehensive list of how the Roll20 dice-rolling syntax works, and list the features available
    • Macros - How to create macros, and other info on how the Roll20 qText Chat works, like referencing stats on character sheets, roll queries, nesting macros & initiative
    • Roll Templates - a method of formatting roll results in the chat, with some extra functions
    • API(Pro Only) - API commands can be used in the qText Chat

TODO

  • add image examples of macros used, input + output
  • at least one example for each mentioned concept
  • Roll Template examples
  • List rest of the examples from "Stupid Tricks" thread