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 popup questions for players

1398856875
Radek G.
KS Backer
Sheet Author
(Originaly posted in mentor forums but I realized it may be more fitting here) Hello, I'm extending Edge of the Empire character sheet (kudos to the original author) and I would like to make "roll attribute" button. Until now, I used to have macro that asks player to enter number of dice one by one (if you are not familiar there are couple kinds of dice in EotE). I would like to provide default values for those queries. However, mechanics of EotE says that player should roll [max(Attribute, Skill) - min(Attribute, Skill)] green dice and min(Attribute, Skill) yellow dice. I can't figure out how to do it. To make it less convoluted (or more?) Here is what I would like to achieve: !eed ?{Ability (Green)|(max(Attribute, Skill) - min(Attribute, Skill))}g ?{Proficiency (Yellow)|min(Attribute, Skill)}y ?{Boost (Blue)|0}b ?{Difficulty (Purple)|0}p ?{Challenge (Red)|0}r ?{Setback (Black)|0}blk I don't think this is possible directly from chat/character sheet/macro as there is no max/min function and default values for queries do not like anything but simple numbers (or am I wrong)? So I thought I will use API. I can easly calculate default values in javascript (or so I think) and I would like to send above command to chat with default values already calculated. However, it seems I cannot run another API script this way nor force roll20 to ask for values. Result of sendChat is simply text of command or error, not execution. For example following command ends with error from API: sendChat(msg.who, "/roll ?{dice|0}d20" ); but executes fine pasted directly to chat. Is this also considered as macro that I cannot use? Is there some way to make roll20 interpret sendChat command "as usual" (i.e. ask for questions and execute other API functions)? If not then is there any way asking players for input from within API? All the best, Radek.
There's currently no way to have a dice query sent by the API ask a question of a player, no. I do think that adding max() and min() to the dice roller might not be a bad idea, though.
1398881382

Edited 1398881614
Radek G.
KS Backer
Sheet Author
Thanks for the answer :) Adding min/max functions would solve original problem and would be much simplier . If I could pass max() function as default value to query ofcourse. :) I'm saying this because there is emulation of max function IIRC syntax would be something like: [[{1,5}kh1]] . However, I cannot pass result as "default" value, as it is not resolved before question is asked.
I actually just came back to suggest using kh1 and kl1. I'm not sure that adding min/max would actually work any better, since the Math functions (floor/ceil/round) are the very last things that are evaluated. So no, that wouldn't really help. I had thought that inline rolls were performed before Roll Queries, but I guess not? Hmmm...
1398882768

Edited 1398885523
Radek G.
KS Backer
Sheet Author
Unless I'm missing something (which I may) submiting something like this in chat: ?{Ability (Green)|[[{0,2}kh1]]} Asks question with default set to "[[{0,2" :( . Maybe this is because "}" also closes question block as well as inline roll values? Edit: Nope. "?{Ability (Green)|[[1d20]]}" also does not work. :(