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

Referencing attacks/skills using @{selected|token_foo}

I want to install few buttons/macros in a sheet that can be accessed by a general macro.  The idea is to click on a token, hit the macro button, and it rolls the first, second or third button/macro in a repeating field on the character sheet associated with the token.  And then I can click on a different token, hit the same macro, and it will roll the first, second or third button macro in a repeating field of the character associated with that token.   Can this be done, and if so, how?  Would it be better/easier to make 3 hard coded macros in the sheet and code the button to refence them, so not to deal with the repeating field?
1600454238
GiGs
Pro
Sheet Author
API Scripter
If your buttons are named correctly, you can call them with standard ability syntax, %{selected|repeating_sectionname_$0_rollname} %{selected|repeating_sectionname_$1_rollname} %{selected|repeating_sectionname_$2_rollname} If you are creating these buttons in a character sheet, you can have a sheet worker extract the roll id, so you can use the full rowid instead of the $0 syntax. To avoid problems make sure you have no underscores in the button name, and in the section name (after the repeating_ part), and the repeating section name must be entirely lower case.
Yes, it is very possible. The details to make it a reality, however, would vary greatly depending on what character sheet you use. Personally, I'm only familiar with the 5E by Roll20 sheet. For that one you would do: %{selected|repeating_npcaction_$0_npc_action} %{selected|repeating_npcaction_$1_npc_action} %{selected|repeating_npcaction_$2_npc_action}
Its not working.... Name of the repeating field: repeating_templateweapons Name of the roll roll_weapon Whole code I am using %{selected|repeating_templateweapons_$0_roll_weapon} There is only one entry in that repeating field 
1600457149

Edited 1600457174
GiGs
Pro
Sheet Author
API Scripter
The roll_ part of button names is like the attr_ part of attribute names - its a flag to tell roll20 what kind of name this is, but it's just for roll20: users don't use it. So the name you need is %{selected|repeating_templateweapons_$0_weapon}
Yep, that fixed it.  Tell yer boss I said you need a raise.   Thanks!
1600463332
GiGs
Pro
Sheet Author
API Scripter
Yay, I'm looking forward to my raise!