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

Macro Coding Syntax

December 09 (8 years ago)
Hello All

I am new to the site, and trying to setup a couple of macro's and I am having a hard time understanding the commands and general syntax for coding the macro's.  (Trying to stay out of the API).  Is there any documentation on the general calls and commands, etc.

Thanks!
Mike
December 09 (8 years ago)

Edited December 09 (8 years ago)
Hi, Mike F.

To learn more about macros, I recommend reading through some of the pages listed on the Main Page the Roll20 Wiki, namely:

You may also want to learn about Roll Templates.
December 10 (8 years ago)
Cool Thanks Silvyre!
December 10 (8 years ago)
If you have any specific questions about macros, the community is always more than willing to help out. Good luck!
December 10 (8 years ago)
Andrew R.
Pro
Sheet Author
I suggest you start with the Default Roll Template and inline roll syntax. I use it for all the monster Journal entries in my 13th Age campaign and it's easy. Recommended!
December 10 (8 years ago)
Hi guys, 

really appreciate the feedback and starting to get some macro's to work.  Is there a listing anywhere of what attributes you can call when using commands like "selected" and "target"

For example, I would like to setup a macro that shows the following... anything nulled below would not be visable in chat window
<Character Name> attacks <Target Name> with his <Weapon1>
Attack 15
//1d20+@{Selected|str-mod} versus <target|AC>
//if successful show damage roll
and strikes for <value> Damage
// /r [[  @selcted|weapon1damage}  ]]

so final results would look something like

BillyBob attacks Birdman with his Mace
Attack roll 15
and strikes for 6 Damage

Thanks!

December 10 (8 years ago)
Hi guys, Just so you understand what I am running into in general... I am trying to use the wiki examples to reverse engineer them into what I want but I get the following error for 90% of them:
TypeError: Cannot read property 'substring' of undefined

Here's the macro (straight off the website):
&{template:DnD35Attack} {{name=@{character_name}}} {{subtags=swings a @{weapon1name} }} {{pcflag=true}} {{attack1=A1: [[ @{weapon1attackcalc} ]] }} {{critconfirm1=Crit!: [[ @{weapon1attackcalc} ]] }} {{fumbleroll=Fumble: [[ d20 ]] }} {{damage1=D1: [[ @{weapon1damage} ]] }} {{critdmg1=+ [[ @{weapon1crit} ]] }} {{fullattackflag= [[?{Full Attack?|No, 0d1|Yes, d1} ]] }} {{attack2=A2: [[ @{weapon1attackcalc}-5 ]] }} {{critconfirm2=Crit!: [[ @{weapon1attackcalc}-5 ]] }} {{damage2=D2: [[ @{weapon1damage} ]] }} {{critdmg2=+ [[ @{weapon1crit} ]] }} {{attack3=A3: [[ @{weapon1attackcalc}-10 ]] }} {{critconfirm3=Crit!: [[ @{weapon1attackcalc}-10 ]] }} {{damage3=D3: [[ @{weapon1damage} ]] }} {{critdmg3=+ [[ @{weapon1crit} ]] }} {{attack4=A4: [[ @{weapon1attackcalc}-15 ]] }} {{critconfirm4=Crit!: [[ @{weapon1attackcalc}-15 ]] }} {{damage4=D4: [[ @{weapon1damage} ]] }} {{critdmg4=+ [[ @{weapon1crit} ]] }}
December 10 (8 years ago)

Edited December 10 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Mike F said:

Hi guys, 

really appreciate the feedback and starting to get some macro's to work.  Is there a listing anywhere of what attributes you can call when using commands like "selected" and "target"

There's no Roll20 generic listing, as you can call any attribute or ability using selected and target, and what attributes and abilities beyond things like character_name are available is completely dependent on the user and the character sheet being used.. The links that Silvyre posted are where this info is posted, specifically in the Macros wiki page.

If you are having problems figuring out the naming convention of attributes/abilities in the sheet you are using. Check out the sheet's wiki page. The 3.5 one is located here: https://wiki.roll20.net/Dungeons_and_Dragons_3.5

The error that you are getting is most likely caused by an incorrect attribute/ability call that it can't resolve.
December 10 (8 years ago)
Cool thanks- everytime I feel like I am getting somewhere I run into something new... lol