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 in bar to roll Initiative for character

I wanted to see if I could write a macro to ether roll for all characters/tokens to be updated with different rolls on the Turn Order or in the very least pull the Initiative modifier from the player controlling a specific character sheet.  So far I had this:  /roll 1d20 +[INIT] &{tracker} Init does nothing, I was hoping it would pull the modifier. If I have to make macros for each player and just change the players name I wouldn't mind it ether, but I can't seem to figure out how to do a roll for a specific character ether.  I tried using the Wiki and didn't find what I was looking for. If I missed it please just toss me a link and I'll try to figure it out on my own. 
1589860113

Edited 1589860159
GiGs
Pro
Sheet Author
API Scripter
You get an attribute's value by using one of these @{INIT} @{Frodo|INIT} @{selected|INIT} @{target|INIT} Described here:&nbsp; <a href="https://wiki.roll20.net/Macros#Attribute_Macros" rel="nofollow">https://wiki.roll20.net/Macros#Attribute_Macros</a> These all assume the initiative attribute is called INIT .&nbsp; So you init macro should be /roll 1d20 +@{enter-character-name-here|INIT} &amp;{tracker} It's common to use selected: You can make one macro, which can be used by any pc or nocs. Just select a token they control , and run the macro. /roll 1d20 +@{selected|INIT} &amp;{tracker}
Thank you so much it clears it up. However, do you know of a way to mass select everyone? If it helps the GM of the group is a Plus member.&nbsp;
1589861025
GiGs
Pro
Sheet Author
API Scripter
I dont think you can without the API, a Pro feature, and even then have to use a script written for it. With a macro using selected, its pretty quick to just cycle through a bunch of characters. Just make your macro bar is enabled, and add the macro to it: <a href="https://wiki.roll20.net/Macros#Macro_Bar" rel="nofollow">https://wiki.roll20.net/Macros#Macro_Bar</a>
I did have that, seems like the easiest way. I even found someone adding it as an ability and selecting "Show as Token Action" which seemed similar to clicking initiative on character sheet. I read the wikia entry and tried the @{test|INIT} (My character and token name is test) However, it stating No character was found for 'test'. When I run&nbsp; @{selected|character_name} on the same character the output is "test" (minus the quotes).&nbsp; P.S. You have helped a major amount I really appreciate it!&nbsp;
1589862461
GiGs
Pro
Sheet Author
API Scripter
Thats a really weird error. Is there a space in the character name? I'd edit your character and change the name to something else, then try the macro again.
It was originally John Doe with a space and my logic was the same, the character was being interpreted as something else. Thus I changed the name to "test". I did another test where I renamed the character to "jake" and left the token name as "test" so it seems to be running based on the name of the token rather than the name of the character on the character sheet.&nbsp; No character was found for 'test' test : test|INIT No attribute was found for @{jake|INIT} jake: jake|INIT No character was found for 'test' jake: test|INIT
1589863971

Edited 1589863999
Check the settings on the token. Does it represent a character? If it does, what do you get if you select the token and type @{selected|INIT} in chat? It looks like INIT might not be what Initiative is called on your sheet?
1589864034

Edited 1589864106
GiGs
Pro
Sheet Author
API Scripter
It uses the character name, not the token name. This should work @{test|INIT} assuming two things are true: the character &nbsp;name (not token) is test , and the attribute name is INIT . So you want to check both of those - you also got "no attribute was found" on one of those messages, so check that the initiative attribute is actually called INIT. Test with a different attribute. Also, try creating a different character, dont change the name, just copy the randomly generated name.
Thank you both for much help! The attribute was initiative_bonus, I had to look up where to find it. This worked just perfectly. /r d20+ @{jake|initiative_bonus}&nbsp;
1589865674
GiGs
Pro
Sheet Author
API Scripter
great!
Just wanted to make a final comment. I re-read this post and more wiki and more forum posts. What I found was an old post from 3 years ago. Basically &amp;{tracker} cannot be linked to a character name, it just acts as "selected" Thus this line: /r d20+ @{jake|initiative_bonus} &amp;{tracker} is the same as&nbsp; /r d20+ @{selected|initiative_bonus} &amp;{tracker}&nbsp; P.S. If another poor soul came here looking for the same answer, I found a better piece of code someone else wrote. &amp;{template:default} {{name=Initiative}}{{@{selected|token_name}=[[ 1d20 + @{selected|initiative_bonus} &amp;{tracker} ]]}}
1589870758
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Comment on that last bit, the reason for this is that the tracker is token-based, not character-based. Otherwise you couldn't roll separate initiatives for tokens that all represent one character (band of goblins)