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

Difference between revisions of "Useful Macros"

From Roll20 Wiki

Jump to: navigation, search
m (Conditional Statements (Math Only))
m (D20 Based Systems)
 
(35 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 +
''Main Article:'' '''[[Macros]]
 +
{{NavMacroDocs}}
 
== Useful Macros for Players ==
 
== Useful Macros for Players ==
 
+
Work in progress (use for general systems only, if system specific add to that page!) also check this thread {{forum|post/1747672/post-your-macros-here/ Post your macros here}}.
Work in progress (use for general systems only, if system specific add to that page!)
+
__TOC__
 
+
 
=== D20 Based Systems ===
 
=== D20 Based Systems ===
  
Generic Roller:
+
Generic d20 Roller:
  
"20": '''/me rolls a [[1d20+?{modifier|0}]] for ?{reason|no reason}.'''
+
<pre>/me rolls a [[1d20+?{modifier|0}]] for ?{reason|no reason}!</pre>
  
 
When clicked, this macro will prompt the user to enter a number, which represents the skill modifier to be added to a d20 roll.<br />
 
When clicked, this macro will prompt the user to enter a number, which represents the skill modifier to be added to a d20 roll.<br />
Then it will ask the user to explain why this die was rolled.
+
Then it will ask the user to explain why this dice was rolled.
  
 
For example, if the player is making a SWIM check with a swimming skill of 4, they'd type 4, enter, swimming, enter.<br />
 
For example, if the player is making a SWIM check with a swimming skill of 4, they'd type 4, enter, swimming, enter.<br />
Line 25: Line 26:
 
'''Quick Calculations Macro:''' <pre>**=** [[?{Calculator}]] </pre>      //the double asterisks simply make the = bold. The only Part you really need is in the brackets.<br />
 
'''Quick Calculations Macro:''' <pre>**=** [[?{Calculator}]] </pre>      //the double asterisks simply make the = bold. The only Part you really need is in the brackets.<br />
  
'''Easy Roll Good Attributes Macro:''' <pre> &{template:default} {{name= Ability Scores}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}}  
+
'''Easy Roll Good Attributes Macro:''' <pre>&{template:default} {{name= Ability Scores}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}}</pre>
{{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} </pre>   //Note, This will work for any character sheet. This macro re-rolls 1's and drops the lowest<br />
+
//Note, This will work for any character sheet. This macro re-rolls 1's and drops the lowest<br />
 
//If you're not having luck getting these to work, make sure the entire thing is one continuous line. It CAN have spaces, it CAN NOT have new lines / separate lines.
 
//If you're not having luck getting these to work, make sure the entire thing is one continuous line. It CAN have spaces, it CAN NOT have new lines / separate lines.
  
 
'''Quick Whisper to GM:'''  <pre>/w gm ?{Message}</pre>
 
'''Quick Whisper to GM:'''  <pre>/w gm ?{Message}</pre>
  
 +
 +
'''fast way to whisper anyone in game.''' <pre>/w ?{Whisper|name1|name2|name3|name4|name5} ?{what do you wish to say}</pre>
 +
-Jeremy--[[User:439264|439264]] ([[User talk:439264|talk]])
  
 
'''Roll quick die of all sizes (In case you want to get rid of your 30 die macros):''' <pre> &{template:default} {{name=Dice}} {{d4 = [[d4]]}} {{d6 = [[d6]]}} {{d8 = [[d8]]}} {{d10 = [[d10]]}}
 
'''Roll quick die of all sizes (In case you want to get rid of your 30 die macros):''' <pre> &{template:default} {{name=Dice}} {{d4 = [[d4]]}} {{d6 = [[d6]]}} {{d8 = [[d8]]}} {{d10 = [[d10]]}}
Line 45: Line 49:
 
''For GM-Controlled Tokens:''<br />
 
''For GM-Controlled Tokens:''<br />
 
"GM_INIT":  
 
"GM_INIT":  
'''/emas @{selected|token_name} rolls a [[1d20+?{modifier|0}&{tracker}]] for initiative!'''<br />
+
<pre>/emas @{selected|token_name} rolls a [[1d20+?{modifier|0}&{tracker}]] for initiative!</pre>
 
+
<br />
 
Make sure to select "Token Action" before saving!
 
Make sure to select "Token Action" before saving!
  
Line 55: Line 59:
  
 
''For Player-Controlled Tokens:''<br />
 
''For Player-Controlled Tokens:''<br />
"Initiative": '''@{selected|token_name} rolls a [[1d20+@{selected|init}&{tracker}]] for initiative!'''<br />
+
"Initiative":
 +
<pre>/em @{selected|token_name} rolls a [[1d20+@{selected|initiative_bonus}&{tracker}]] for initiative!</pre><br />
  
 
Make sure to select "Token Action" before saving!<br />
 
Make sure to select "Token Action" before saving!<br />
Line 69: Line 74:
 
This does the same thing, but then adds the initiative bonus as a decimal after the initial roll (in cases of a tie, the higher initiative bonus is sorted to go first.)
 
This does the same thing, but then adds the initiative bonus as a decimal after the initial roll (in cases of a tie, the higher initiative bonus is sorted to go first.)
  
Initiative: '''[[1d20+@{Initiative}+(@{initiative}/100)&{tracker} ]]'''
+
Initiative:  
 +
<pre>[[1d20+@{Initiative}+(@{initiative}/100)&{tracker} ]]</pre>
  
 +
-by Phnord Prephect--[[User:186177|186177]] ([[User talk:186177|talk]]) 19:15, 18 December 2013 (EST)
  
 +
Alternative to "Improved Version:"
  
 +
This does the same thing as the above, but does not require the user to input the initiative value twice. It still ads the initiative bonus as a decimal after the initial roll.
  
-by Phnord Prephect--[[User:186177|186177]] ([[User talk:186177|talk]]) 19:15, 18 December 2013 (EST)
+
Initiative:
 +
<pre>[[1d20 +(101*?{Initiative}/100)&{tracker} ]]</pre>
  
 
=== Shadowrun v4/v5 (D6 based) ===
 
=== Shadowrun v4/v5 (D6 based) ===
Line 80: Line 90:
 
Generic roll that asks player / gm how many dice to throw to determine hits:
 
Generic roll that asks player / gm how many dice to throw to determine hits:
 
<br /><br />
 
<br /><br />
/r ?{Modifier|0}d6>5
+
<pre> /r ?{Modifier|0}d6>5 </pre>
 
<br /><br />
 
<br /><br />
 
Add as a macro and enable "in bar" so that the shortcut shows up below the player profiles.  
 
Add as a macro and enable "in bar" so that the shortcut shows up below the player profiles.  
Line 86: Line 96:
 
--[[User:110534|110534]] ([[User talk:110534|talk]]) 06:27, 7 February 2014 (EST)
 
--[[User:110534|110534]] ([[User talk:110534|talk]]) 06:27, 7 February 2014 (EST)
 
<br />
 
<br />
/roll {@{Character Name|Attribute}d@{Character|Physique}}>4
+
<pre> /roll {@{Character Name|Attribute}d@{Character|Physique}}>4 </pre>
 
<br /><br />
 
<br /><br />
 
-- Below added by Steven G <br />
 
-- Below added by Steven G <br />
 
These can all be added as macros on the third tab of the character sheet in the right hand column (Abilities):<br /><br />
 
These can all be added as macros on the third tab of the character sheet in the right hand column (Abilities):<br /><br />
 
Dodge roll (because the button on the char sheet disappears sometimes)<br />
 
Dodge roll (because the button on the char sheet disappears sometimes)<br />
/r (@{reaction} + @{Intuition} - (@{woundmod} - ?{Modifier|0}))d6>5 <br /> <br />
+
<pre> /r (@{reaction} + @{Intuition} - (@{woundmod} - ?{Modifier|0}))d6>5 </pre><br /> <br />
 
Damage soak roll<br />
 
Damage soak roll<br />
/r (@{body} + @{armor} - (@{woundmod} + ?{AP|0}))d6>5<br /><br />
+
<pre>/r (@{body} + @{armor} + ?{AP|0}))d6>5</pre><br /><br />
 
Roll to resist mind control<br />
 
Roll to resist mind control<br />
/r (@{willpower} + @{Logic} - (@{woundmod} + ?{Force|0}))d6>5 <br/><br />
+
<pre>/r (@{willpower} + @{Logic} - (@{woundmod} + ?{Force|0}))d6>5 </pre><br/><br />
 
Resist Drain for Shamanistic tradition<br />
 
Resist Drain for Shamanistic tradition<br />
/r (@{willpower} + @{Charisma} - @{woundmod})d6>5 <br /><br />
+
<pre>/r (@{willpower} + @{Charisma})d6>5 </pre><br /><br />
 
Resist Drain for Hermetic tradition<br />
 
Resist Drain for Hermetic tradition<br />
/r (@{willpower} + @{Logic} - @{woundmod})d6>5 <br ><br />
+
<pre>/r (@{willpower} + @{Logic})d6>5</pre> <br ><br />
  
 
--Brian B.
 
--Brian B.
Line 105: Line 115:
 
Shadowrun 5th - A general roll macro that asks for attributes, skills, positive modifier, and negative modifier as well as the limit
 
Shadowrun 5th - A general roll macro that asks for attributes, skills, positive modifier, and negative modifier as well as the limit
  
/me gets [[(?{Attribute|1}+?{Skill|0}+?{Positive Modifiers|0}-?{Penalty|0})d6sdkh?{Limit|1}>5]] Successes!
+
<pre>/me gets [[(?{Attribute|1}+?{Skill|0}+?{Positive Modifiers|0}-?{Penalty|0})d6sdkh?{Limit|1}>5]] Successes!</pre>
 +
 
 +
A shadowrun macro for use with the shadowrun advanced sheet that the GM can use to roll initiate and add it to the tracker without opening each character page
 +
 
 +
<pre>@{selected|gmroll}&{template:shadowrun} {{name=@{selected|token_name}}} {{roll_name=for Initiative}} {{val1=Reaction}}{{val1_num=[[@{selected|rea_total}]]}}{{val2=Intuition}}{{val2_num=[[@{selected|int_total}]]}}{{val3=Bonus}}{{val3_num=[[@{selected|initiativebonus}]]}}{{wounds_num=[[@{selected|wound_total}]]}}{{initiative=true}}{{initiative=[[@{selected|initiativeattribute}+@{selected|initiativebonus}-[[@{selected|wound_total}]]+[[{@{selected|initiativedice},(@{selected|edgn}*5)}kh1]]d6 &{tracker}]]}}</pre>
  
 
== Other Macro Related Information ==
 
== Other Macro Related Information ==
Line 113: Line 127:
 
These are a list of common pitfalls when creating complex macros or dice rolls.
 
These are a list of common pitfalls when creating complex macros or dice rolls.
 
====Subtracting a Negative Attribute====
 
====Subtracting a Negative Attribute====
When subtracting an attribute it is best to put parentheses around the attribute. What this is preventing from happening is a double subtraction instead of the subtraction of a negative. For example let's say our THAC0 attribute is negative two.
+
When subtracting an attribute it is best to put parentheses around the attribute. What this is preventing from happening is a double subtraction instead of the subtraction of a negative. For example, let's say our THAC0 attribute is negative two:
/r 1d20-@{THAC0} translates into /r 1d20--2, which is bad syntax and will fail.
+
<pre>/r 1d20-@{THAC0}</pre> translates into <pre>/r 1d20--2</pre> which is bad syntax and will fail.
/r 1d20-(@{THAC0}) translates into /r 1d20-(-2), which is good syntax and will give you the desired result.
+
<pre>/r 1d20-(@{THAC0})</pre> translates into <pre>/r 1d20-(-2)</pre> which is good syntax and will give you the desired result.
  
 
=== Conditional Statements (Math Only) ===
 
=== Conditional Statements (Math Only) ===
Using the multiplicative properties of 0(absorption) and 1(identity) you can write conditional statements for integer values(and to some extent floating point values too)
+
Using the multiplicative properties of 0 (absorption) and 1 (identity), you can write conditional statements for integer values (and to some extent floating point values too). An example of this is the formula "''if x greater than or equal to A, then T; else F,''" where T and F are some values. If x or A are dice rolls, surround them with [[]] inside these formulas.
  
An example of this is the formula "if x greater than or equal to A, then T; else F," where T and F are some values.
+
'''This can be written as a macro, for example:'''
If x or A are dice rolls, surround them with [[]] inside these formulas.
+
 
+
This can be written as a macro with
+
 
<pre>
 
<pre>
[[{{x,something-less-than-A}>A}*(T-F) + F]]
+
[[{{x,false-value-compared-to-A}>A}*(T-F) + F]]
 
</pre>
 
</pre>
  
Example 1:
+
'''Here in this formula, these variables stand for the following:'''
 +
* '''x''' is the value we are comparing to A to find out if the comparison is true (x is greater than or equal to A) or false (x is not greater than or equal to A).
 +
* '''False-value-compared-to-A''' is a value which must not be true in the comparison to A. This is because this formula uses the format for [[Dice_Reference#Target_Number_.2F_Successes_.28B.2CF.29_-_CP|counting successes]] in a [[Dice_Reference#Grouped_Rolls|grouped roll]]. Roll20 treats > as either greater than or equal to while < is treated as less than or equal to, and as such, should never be the same value as A.
 +
* '''A''' is the value we are comparing to X, as previously mentioned.
 +
* The greater than sign ( '''>''' ) can be swapped for the less than sign ( '''<''' ), but make sure that '''False-value-compared-to-A''' is now greater than the value of '''A'''. If you need to see if x is equal to A, see '''Example 4: "x equals A"'''.
 +
* The statement portion itself, '''{x,false-value-compared-to-A}>A''', will only return two values regardless of what values appear inside. If the statement is true, the output of it will be 1 (any number multiplied by 1 is still the original number). If it is false, the output is 0 (any number multiplied by 0 is equal to 0).
 +
* '''T''' is the value we want the statement to output as a value if the statement is true. A true case will result in '''''1 * (T-F) + F''''' which is equal to '''''T + F - F''''', which results in the value of T.
 +
* '''F''' is the value we want the statement to output as a value if the statement is false. A false case will result in '''''0 * (T-F) + F''''' which is equal to '''''0 + F''''', which results in the value of F.
 +
 
 +
 
 +
'''Example 1:'''
 
<pre>
 
<pre>
[[{{3,0}>2}*(2) + 3]]
+
[[ { {3,0}>2 }*(4) + 3 ]]
 
</pre>
 
</pre>
  
Example 2:
+
'''Example 2:'''
 
<pre>
 
<pre>
[[{{[[1d4]],0}>2}*(2) + 3]]
+
[[ {{ [[1d4]],0 }>2 }*(4) + 3 ]]
 
</pre>
 
</pre>
  
The above examples will multiply (2) with however many times the statement '{X}>2' was true and add +3 to the result.  
+
The above examples will multiply ''(4)'' with however many times the statement ''{x}>2'' was true and add ''+ 3'' to the result.  
For example 1 that is true 1 times, since 3 > 2, but 0 < 2. This will result in 1*2+3 = 5.
+
* Example 1 is true one time, since ''3 > 2'', but ''0 < 2''. This will result in '''''1 * 4 + 3 = 7'''''.
For example 2 that is true 0-1 times, depending on the result of the 1d4. This will result in either 0*2+3 = 3 or 1*2+3=5.  
+
* Example 2 has a value that will be true one out of four times, depending on the result of the ''1d4''. Even though ''2'' is not greater than ''2'', the statement will still be considered true. This will result in either '''''0 * 4 + 3 = 3''''' or '''''1 * 4 + 3 = 7'''''.
 +
 
 +
 
 +
'''Example 3:'''
 +
This can be used so that when x is greater than A, the statement is true. When X is equal to or less than A, the statement is false. This is assuming A is an integer (a whole number, not a fraction).  
  
Similarly, "x greater than A, then T; else F" is written
 
 
<pre>
 
<pre>
[[{{x,something-less-than-A}>[[A+1]]}*(T-F) + F]]
+
[[{{x,false-value-compared-to-A}>[[A+1]]}*(T-F) + F]]
 
</pre>
 
</pre>
(Assuming A is an integer)<br>
+
 
Alternatively, you can multiply one minus the (x==A) check below with the (x>=A) check above, like so:
+
As an alternative way of doing the above example, you can multiply one minus the (x==A) check below with the (x>=A) check above. This example will allow you to use non whole numbers as well if necessary and will round down accordingly, like so:
 
<pre>
 
<pre>
[[({{x,something-less-than-A}>A})*(1-{0,floor(1-abs(x-A))}dl1)*(T-F)+F]]
+
[[({{x,false-value-compared-to-A}>A})*(1-{0,floor(1-abs(x-A))}dl1)*(T-F)+F]]
 
</pre>
 
</pre>
"x equals A" is simpler.
+
 
 +
'''Example 4: "x equals A"'''
 
<pre>
 
<pre>
 
[[({0,floor(1-abs(x-A))}dl1)*(T-F) +F]]
 
[[({0,floor(1-abs(x-A))}dl1)*(T-F) +F]]
 
</pre>
 
</pre>
  
Now for some identities: "x less than A" is the inverse of "x greater than or equal to A," so the conditional can be written as "x greater than or equal to A, then F; else T" using the formulas above. Similarly with "x less than or equal to A" and "x greater than A," as well as with "x not equal to A" and "x equal to A."
+
'''Now for some identities:'''
 +
 
 +
Let's say you have a situation in which you only want x to be less than A, but not equal to A. "''x less than A''" is the inverse of "''x greater than or equal to A,''" so the conditional can be written as "''x greater than or equal to A, then F; else T''". This can be done using the formulas above slightly modified, as shown below.
 +
 
 +
'''Example 5: "x less than A"'''
 +
<pre>
 +
[[{{x,false-value-compared-to-A}>A}*(F-T) + T]]
 +
</pre>
 +
 
 +
'''Example 6: "x greater than A"'''
 +
<pre>
 +
[[{{x,false-value-compared-to-A}<A}*(F-T) + T]]
 +
</pre>
 +
Similarly, this can be done with "''x less than or equal to A''", "''x greater than A,''", "''x not equal to A''", and "''x equal to A.''"
 +
 
 +
'''4th Edition, Use Case Example for At Will Powers to auto increase damage at level 21:'''
 +
 
 +
'''Character-name''' is the name of a character in your game, and '''Level''' is an number. This will output a value of 2 if the character is level 21 or higher, and a value of 1 if the character is level 20 or lower. This example also assumes the 4e character sheet is filled out as well.
 +
<pre>
 +
[[{{@{Character-Name|Level},0}>21}*(2-1) + 1 [Epic Tier] ]]@{weapon-1-dice}
 +
</pre>
  
 
=== Custom Power Cards ===
 
=== Custom Power Cards ===
 
<br />
 
<br />
[[Custom Power Cards]] are not macros, they are an API script for apply html and css to output of a macro in the chat pane.<br />
+
[[Custom Power Cards]] are not macros: they are an API script for applying html and css to the output of a macro in the chat pane.<br />
  
 
'''Sample of a standard macro and its output.'''
 
'''Sample of a standard macro and its output.'''
Line 182: Line 227:
 
[[File:AttackMacroPowerCard.jpeg]]
 
[[File:AttackMacroPowerCard.jpeg]]
  
For more information see: [[Custom Power Cards]]
+
For more information see: [[Script:PowerCards]]
  
-Stephen S.--[[User:135636|135636]] ([[User talk:135636|talk]]) 03:57, 2 March 2014 (EST)
+
==See Also==
 
+
* '''[[Complete Guide to Macros & Rolls]]'''
: [[Category:Tips]]
+
** [[:Category:Macros|Other pages about Macros]]
 +
<br />
 +
[[Category:Tips]]
 +
[[Category:Macros]]

Latest revision as of 05:09, 22 August 2022

Main Article: Macros

[edit] Useful Macros for Players

Work in progress (use for general systems only, if system specific add to that page!) also check this thread Post your macros here(Forum).

Contents

[edit] D20 Based Systems

Generic d20 Roller:

/me rolls a [[1d20+?{modifier|0}]] for ?{reason|no reason}!

When clicked, this macro will prompt the user to enter a number, which represents the skill modifier to be added to a d20 roll.
Then it will ask the user to explain why this dice was rolled.

For example, if the player is making a SWIM check with a swimming skill of 4, they'd type 4, enter, swimming, enter.
The results will look something like:

Phnord rolls a 17 for swimming!

If the user enters nothing for both prompts, the results will look something like:

Phnord rolls a 13 for no reason!

-Phnord Prephect--Phnord P. (talk) 21:01, 18 December 2013 (EST)

Quick Calculations Macro:
**=** [[?{Calculator}]] 
//the double asterisks simply make the = bold. The only Part you really need is in the brackets.
Easy Roll Good Attributes Macro:
&{template:default} {{name= Ability Scores}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}} {{[[4d6r1dl1]]}}

//Note, This will work for any character sheet. This macro re-rolls 1's and drops the lowest
//If you're not having luck getting these to work, make sure the entire thing is one continuous line. It CAN have spaces, it CAN NOT have new lines / separate lines.

Quick Whisper to GM:
/w gm ?{Message}


fast way to whisper anyone in game.
/w ?{Whisper|name1|name2|name3|name4|name5} ?{what do you wish to say}

-Jeremy--Jeremy K. (talk)

Roll quick die of all sizes (In case you want to get rid of your 30 die macros):
 &{template:default} {{name=Dice}} {{d4 = [[d4]]}} {{d6 = [[d6]]}} {{d8 = [[d8]]}} {{d10 = [[d10]]}}
 {{d12 = [[d12]]}} {{d20 = [[d20]]}} {{d100 = [[d100]]}} 

[edit] Pathfinder

useful Pathfinder macros here: Macros - Pathfinder Examples

[edit] Useful Macros for GMs

Work in progress (use for general systems only, if system specific add to that page!)

Initiative roller for d20 systems:

For GM-Controlled Tokens:
"GM_INIT":

/emas @{selected|token_name} rolls a [[1d20+?{modifier|0}&{tracker}]] for initiative!


Make sure to select "Token Action" before saving!

For GM use only; see below for players.
To use, select the token. Hit the button (GM INIT). When prompted, enter the total initiative modifier for the token. Token will automatically be added to turn order.


For Player-Controlled Tokens:
"Initiative":

/em @{selected|token_name} rolls a [[1d20+@{selected|initiative_bonus}&{tracker}]] for initiative!

Make sure to select "Token Action" before saving!
Make sure to select "Visible to Players: All Players" before saving!

For Player Use:
To use, have an Attribute in Journal Entry linked to that token called 'initiative', which represents that characters total initiative modifier. Select token, hit the button "Initiative". Token will automatically be added to turn order.


Improved Version:

This does the same thing, but then adds the initiative bonus as a decimal after the initial roll (in cases of a tie, the higher initiative bonus is sorted to go first.)

Initiative:

[[1d20+@{Initiative}+(@{initiative}/100)&{tracker} ]]

-by Phnord Prephect--Phnord P. (talk) 19:15, 18 December 2013 (EST)

Alternative to "Improved Version:"

This does the same thing as the above, but does not require the user to input the initiative value twice. It still ads the initiative bonus as a decimal after the initial roll.

Initiative:

[[1d20 +(101*?{Initiative}/100)&{tracker} ]]

[edit] Shadowrun v4/v5 (D6 based)


Generic roll that asks player / gm how many dice to throw to determine hits:

 /r ?{Modifier|0}d6>5 



Add as a macro and enable "in bar" so that the shortcut shows up below the player profiles.

--Moritz J. (talk) 06:27, 7 February 2014 (EST)

 /roll {@{Character Name|Attribute}d@{Character|Physique}}>4 



-- Below added by Steven G
These can all be added as macros on the third tab of the character sheet in the right hand column (Abilities):

Dodge roll (because the button on the char sheet disappears sometimes)

 /r (@{reaction} + @{Intuition} - (@{woundmod} - ?{Modifier|0}))d6>5  


Damage soak roll

/r (@{body} + @{armor} + ?{AP|0}))d6>5


Roll to resist mind control

/r (@{willpower} + @{Logic} - (@{woundmod} + ?{Force|0}))d6>5 


Resist Drain for Shamanistic tradition

/r (@{willpower} + @{Charisma})d6>5 


Resist Drain for Hermetic tradition

/r (@{willpower} + @{Logic})d6>5


--Brian B.

Shadowrun 5th - A general roll macro that asks for attributes, skills, positive modifier, and negative modifier as well as the limit

/me gets [[(?{Attribute|1}+?{Skill|0}+?{Positive Modifiers|0}-?{Penalty|0})d6sdkh?{Limit|1}>5]] Successes!

A shadowrun macro for use with the shadowrun advanced sheet that the GM can use to roll initiate and add it to the tracker without opening each character page

@{selected|gmroll}&{template:shadowrun} {{name=@{selected|token_name}}} {{roll_name=for Initiative}} {{val1=Reaction}}{{val1_num=[[@{selected|rea_total}]]}}{{val2=Intuition}}{{val2_num=[[@{selected|int_total}]]}}{{val3=Bonus}}{{val3_num=[[@{selected|initiativebonus}]]}}{{wounds_num=[[@{selected|wound_total}]]}}{{initiative=true}}{{initiative=[[@{selected|initiativeattribute}+@{selected|initiativebonus}-[[@{selected|wound_total}]]+[[{@{selected|initiativedice},(@{selected|edgn}*5)}kh1]]d6 &{tracker}]]}}

[edit] Other Macro Related Information

Work in progress (use for general systems only, if system specific add to that page!)

[edit] Common Macro/Dice Issues

These are a list of common pitfalls when creating complex macros or dice rolls.

[edit] Subtracting a Negative Attribute

When subtracting an attribute it is best to put parentheses around the attribute. What this is preventing from happening is a double subtraction instead of the subtraction of a negative. For example, let's say our THAC0 attribute is negative two:

/r 1d20-@{THAC0}
translates into
/r 1d20--2
which is bad syntax and will fail.
/r 1d20-(@{THAC0})
translates into
/r 1d20-(-2)
which is good syntax and will give you the desired result.

[edit] Conditional Statements (Math Only)

Using the multiplicative properties of 0 (absorption) and 1 (identity), you can write conditional statements for integer values (and to some extent floating point values too). An example of this is the formula "if x greater than or equal to A, then T; else F," where T and F are some values. If x or A are dice rolls, surround them with [[]] inside these formulas.

This can be written as a macro, for example:

[[{{x,false-value-compared-to-A}>A}*(T-F) + F]]

Here in this formula, these variables stand for the following:

  • x is the value we are comparing to A to find out if the comparison is true (x is greater than or equal to A) or false (x is not greater than or equal to A).
  • False-value-compared-to-A is a value which must not be true in the comparison to A. This is because this formula uses the format for counting successes in a grouped roll. Roll20 treats > as either greater than or equal to while < is treated as less than or equal to, and as such, should never be the same value as A.
  • A is the value we are comparing to X, as previously mentioned.
  • The greater than sign ( > ) can be swapped for the less than sign ( < ), but make sure that False-value-compared-to-A is now greater than the value of A. If you need to see if x is equal to A, see Example 4: "x equals A".
  • The statement portion itself, {x,false-value-compared-to-A}>A, will only return two values regardless of what values appear inside. If the statement is true, the output of it will be 1 (any number multiplied by 1 is still the original number). If it is false, the output is 0 (any number multiplied by 0 is equal to 0).
  • T is the value we want the statement to output as a value if the statement is true. A true case will result in 1 * (T-F) + F which is equal to T + F - F, which results in the value of T.
  • F is the value we want the statement to output as a value if the statement is false. A false case will result in 0 * (T-F) + F which is equal to 0 + F, which results in the value of F.


Example 1:

[[ { {3,0}>2 }*(4) + 3 ]]

Example 2:

[[ {{ [[1d4]],0 }>2 }*(4) + 3 ]]

The above examples will multiply (4) with however many times the statement {x}>2 was true and add + 3 to the result.

  • Example 1 is true one time, since 3 > 2, but 0 < 2. This will result in 1 * 4 + 3 = 7.
  • Example 2 has a value that will be true one out of four times, depending on the result of the 1d4. Even though 2 is not greater than 2, the statement will still be considered true. This will result in either 0 * 4 + 3 = 3 or 1 * 4 + 3 = 7.


Example 3: This can be used so that when x is greater than A, the statement is true. When X is equal to or less than A, the statement is false. This is assuming A is an integer (a whole number, not a fraction).

[[{{x,false-value-compared-to-A}>[[A+1]]}*(T-F) + F]]

As an alternative way of doing the above example, you can multiply one minus the (x==A) check below with the (x>=A) check above. This example will allow you to use non whole numbers as well if necessary and will round down accordingly, like so:

[[({{x,false-value-compared-to-A}>A})*(1-{0,floor(1-abs(x-A))}dl1)*(T-F)+F]]

Example 4: "x equals A"

[[({0,floor(1-abs(x-A))}dl1)*(T-F) +F]]

Now for some identities:

Let's say you have a situation in which you only want x to be less than A, but not equal to A. "x less than A" is the inverse of "x greater than or equal to A," so the conditional can be written as "x greater than or equal to A, then F; else T". This can be done using the formulas above slightly modified, as shown below.

Example 5: "x less than A"

[[{{x,false-value-compared-to-A}>A}*(F-T) + T]]

Example 6: "x greater than A"

[[{{x,false-value-compared-to-A}<A}*(F-T) + T]]

Similarly, this can be done with "x less than or equal to A", "x greater than A,", "x not equal to A", and "x equal to A."

4th Edition, Use Case Example for At Will Powers to auto increase damage at level 21:

Character-name is the name of a character in your game, and Level is an number. This will output a value of 2 if the character is level 21 or higher, and a value of 1 if the character is level 20 or lower. This example also assumes the 4e character sheet is filled out as well.

[[{{@{Character-Name|Level},0}>21}*(2-1) + 1 [Epic Tier] ]]@{weapon-1-dice}

[edit] Custom Power Cards


Custom Power Cards are not macros: they are an API script for applying html and css to the output of a macro in the chat pane.

Sample of a standard macro and its output.

  • Standard macro that will include an emote, plus my attack and damage rolls it would look like this:
Macro Name:
dagger
Macro Body:
/me rams his dagger home
/roll 1d20+10 vs AC
/roll 1d4+9 Damage
  • The output would look like:
AttackMacro.JPG

Sample of a standard macro action with Custom Power Cards.

  • With Custom Power Cards the macro would be constructed as an API command using Custom Power Cards markup tags:
Macro Name:
dagger

Macro Body:
!power --emote|@{selected|token_name} rams his dagger home --name|Short Sword --leftsub|Melee --rightsub|Main Hand --attack|[[1d20+10]] --defense|AC --damage|[[1d4+9]] --dmgtype|piercing
  • The output would look like:

AttackMacroPowerCard.jpeg

For more information see: Script:PowerCards

[edit] See Also