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 .
×

Can't work out how to get the character that selected a macro

I hope this is a simple question, but I couldn't find an answer after searching. Is it possible to get an attribute of the character that click on a macro? When a player clicks a macro I'd like to get the attribute from the character that they are currently playing as (rather than use selected).
1627789097
timmaugh
Roll20 Production Team
API Scripter
Fetch (in the 1-click) can use the speaker... @(speaker.attribute) And let you return a default if it isn't found (if the player chats as themselves): @(speaker.atttibute[default value] Note that as this is a meta-script, it will work in the command lines for other scripts. Also note that since it is a meta-script, it will run after the Roll20 parsing (ie, after a roll query is executed. If you need more control over the timing, you can also install ZeroFrame... Which would also let you use the same syntax in things like roll templates. Post back with your actual command line if you want specific help.
Thanks for the Help. I'm very new to Dice macros, but what I'm trying to do is some macro to insist on minimise and maximise 1 Dice for Tachyon Squadron (A Fate Core game with a mostly good character sheet but seems to be missing this rule.) So syntax for maximising a roll is pretty simple "/roll 4dfdl1+1 ?{Modifier|0}"   but ideally I'd like to add an option for the speaker to choose one of their attributes (about 10 of them) as a drop down list. I haven't been able to get the syntax above to work. Should I used curly braces instead of ordinary? I assume that's a formatting thing for the forums.
1627801807

Edited 1627801835
vÍnce
Pro
Sheet Author
Tim's suggestion uses API scripts (Pro level perk...) Maybe you could make macros that use the character's name directly in all attribute calls? example, one macro if you are rolling as Beth and another if you are rolling as Bob #beth /roll Beth: 4dfdl1+@{beth|attribute_0}+@{beth|attribute_1}+@{beth|attribute_2}+@{beth|attribute_3} #bob /roll Bob: 4dfdl1+@{bob|attribute_0}+@{bob|attribute_1}+@{bob|attribute_2}+@{beth|attribute_3}
1627824021
timmaugh
Roll20 Production Team
API Scripter
Oh, yeah... Too tired when I posted. I missed the lack of the Pro sticker. Sorry 
Thanks for the help. Obviously I can't implement the approach I wanted as a non-pro user.
1627876045
Oosh
Sheet Author
API Scripter
Even with Pro, there's a fundamental issue with what you're trying to do - Players click buttons, Characters don't. While you can use the API to grab a Character controlled by the Player doing the clicking, this only works properly if the players have permission on a single character sheet - otherwise you'll need to either make an assumption (introducing potential broken macros) or prompt the player (annoying, as it will happen all the time). There's no "default character id" for a Player, API scripts find a character by searching every single Character object in the Campaign, and filtering them down to any which contain the Player's ID in the "controlled by" key. If the players will only ever be controlling a single character sheet, just use Vince's solution. Create the macro as a "@{selected|" macro, then give each player there own version with their character name in place of "selected". Notepad, or any other text editor, should let you replace all with Ctrl-H to do this extremely quickly and easily.