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

API Command Buttons in Text Chat; How do I reference 'the one who pushed'?

1426536520
Gen Kitty
Forum Champion
I have some ideas for some buttons I would like to code up, but I have a semi-major stumbling block: How do I get the name of the entity which pushed the button? I'm 99% sure @{selected} is out, as is @{target}. Something tells me the answer is going to be "You can't", but it shouldn't be because I know there's a way to know; Powercards has a 'Powercard sent by NAME' tooltip -- and that's what I'll be using as a fallback, but it would really be nice to get that name as a usable variable!
1426537364
The Aaron
Pro
API Scripter
You have to get it from the API, via the message object's playerid property.
Would help to know what the buttons are for and what you have so far.
1426538280
Gen Kitty
Forum Champion
Meeeeeeeeeh. FINE. I'll go beg HoneyBadger for YET ANOTHER FEATURE. ^_^
1426538759
Gen Kitty
Forum Champion
Oh, hey, I should have reloaded before replying... First button is this: [Ready Check](!power --name|Readycheck) Very roughdraft/first pass work here. Ideally, the title would be 'Name is ready!' For now, I'm just relying on the playercolor and hovertip. I'm not sure what I'll be doing for other buttons. I had a vague wish last night during the game for a button that would let me present a series of rollqueries for a skills encounter I was running, and I would have wanted the Name to be there too. I wish I could be more helpful, but I also know that getting the concept of 'me' is important for achieving the full potential of the API command buttons. I'm honestly a little surprised we don't already have a 'me' for use alongside selected and target.
Ah, cool. I am leaving for work here in a couple minutes. So just ping me in the PowerCard thread before 7am eastern tomorrow and I'll add an %%info_charm%% or something. That'll be really simple to add.
I mean, the way the buttons work, you are sending code which the person who clicks on the button will actually execute. So if you include @[selected} in the actual button code, then when they press the button it will look for what they have selected when they press it. I'm not sure if that's what you're after or not.
1426540429
Gen Kitty
Forum Champion
Riley, @{selected} requires a token be selected. That's great for TokenAction macros. But this is a button in chat, with nothing TO select. And I can't use @{selected} to get me a player name either, only a token name or a character name.
Absolutely, what GenKitty said. @{me} or @{this} would be awesome.