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

(5e) Templated Skill roll query as token ability

Hello. I've been toying around the last few hours trying to learn how Roll20 handles its scripting commands in what may (or may not) be a somewhat advanced context. To streamline skill checks and keep the game screen in as much view as possible, I had the idea to create token ability which would bring up a query menu, and in turn allow the user to select a particular skill check and roll that skill. For now I have the following, which is working functionally ?{Select Skill |Acrobatics (Dex),/r 1d20+@{acrobatics_bonus} |Animal Handling (Wis),/r 1d20+@{animal_handling_bonus} |Arcana (Int),/r 1d20+@{arcana_bonus} |Athletics (Str),/r 1d20+@{athletics_bonus} |Deception (Cha),/r 1d20+@{deception_bonus} |History (Int),/r 1d20+@{history_bonus} |Insight (Wis),/r 1d20+@{insight_bonus} |Intimidation (Cha),/r 1d20+@{intimidation_bonus} |Investigation (Int),/r 1d20+@{investigation_bonus} |Medicine (Wis),/r 1d20+@{medicine_bonus} |Nature (Int),/r 1d20+@{nature_bonus} |Perception (Wis),/r 1d20+@{perception_bonus} |Performance (Cha),/r 1d20+@{performance_bonus} |Persuasion (Cha),/r 1d20+@{persuasion_bonus} |Religion (Int),/r 1d20+@{religion_bonus} |Sleight of Hand (Dex),/r 1d20+@{sleight_of_hand_bonus} |Stealth (Dex),/r 1d20+@{stealth_bonus} |Survival (Wis),/r 1d20+@{survival_bonus} } The only problem really is that this outputs in a pretty barebones manner, and I wanted the output to be formatted as a roll template (of type "simple"). Additionally I had considered trying to add a second query to toggle disadvantage, normal, advantage rolls. Essentially meaning players could make skill checks while keeping the game screen in view rather than needing to open and close their character sheets constantly. However, whenever I try to get the rolls to be templated (and I assume if I ever try to add advantage to it), everything breaks and the query basically vomits all over that chat box. Trying to use HTML entities (EG } or }) haven't resolved the issues at all. Having a background in C++ etc, I tried to instead place the query in the middle of the templated roll to initialize @rname and @mod to the relevant values before returning to the templated roll (as well as a few other configurations of the initialize first, use later concept), but it doesn't seem like variables work like that here. Is this even something that is possible to do, or is there an underlying thing with R20 that prevents templated rolls and roll queries from working simultaneously? If it is possible, would someone care to post an example of how to get one skill working so I can build out from there? I frankly don't know what else to try.
1647694367
David M.
Pro
API Scripter
Looks like 5e, so you can try this one out. I don't take credit for it (I think Oosh originally came up with it?). It uses the sheet settings for whisper type, advantage settings (toggle, query, etc), optional proficiency dice, and jack of all trades.  @{selected|wtype}&{template:simple} @{selected|rtype}?{Ability|Acrobatics, +@{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]]}} {{rname=Acrobatics}} {{mod=@{selected|Acrobatics_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]]|Animal Handling, +@{selected|Animal_Handling_bonus}@{selected|pbd_safe}[Animal]]]}} {{rname=Animal Handling}} {{mod=@{selected|Animal_Handling_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Animal_Handling_bonus}@{selected|pbd_safe}[Animal]]]|Arcana, +@{selected|Arcana_bonus}@{selected|pbd_safe}[Arcana]]]}} {{rname=Arcana}} {{mod=@{selected|Arcana_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Arcana_bonus}@{selected|pbd_safe}[Arcana]]]|Athletics, +@{selected|Athletics_bonus}@{selected|pbd_safe}[Athletics]]]}} {{rname=Athletics}} {{mod=@{selected|Athletics_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Athletics_bonus}@{selected|pbd_safe}[Athletics]]]|Deception, +@{selected|Deception_bonus}@{selected|pbd_safe}[Deception]]]}} {{rname=Deception}} {{mod=@{selected|Deception_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Deception_bonus}@{selected|pbd_safe}[Deception]]]|History, +@{selected|History_bonus}@{selected|pbd_safe}[History]]]}} {{rname=History}} {{mod=@{selected|History_bonus}}} {{r1=[[ @{selected|d20} + @{selected|History_bonus}@{selected|pbd_safe}[History]]]|Insight, +@{selected|Insight_bonus}@{selected|pbd_safe}[Insight]]]}} {{rname=Insight}} {{mod=@{selected|Insight_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Insight_bonus}@{selected|pbd_safe}[Insight]]]|Intimidation, +@{selected|Intimidation_bonus}@{selected|pbd_safe}[Intimidation]]]}} {{rname=Intimidation}} {{mod=@{selected|Intimidation_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Intimidation_bonus}@{selected|pbd_safe}[Intimidation]]]|Investigation, +@{selected|Investigation_bonus}@{selected|pbd_safe}[Investigation]]]}} {{rname=Investigation}} {{mod=@{selected|Investigation_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Investigation_bonus}@{selected|pbd_safe}[Investigation]]]|Medicine, +@{selected|Medicine_bonus}@{selected|pbd_safe}[Medicine]]]}} {{rname=Medicine}} {{mod=@{selected|Medicine_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Medicine_bonus}@{selected|pbd_safe}[Medicine]]]|Nature, +@{selected|Nature_bonus}@{selected|pbd_safe}[Nature]]]}} {{rname=Nature}} {{mod=@{selected|Nature_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Nature_bonus}@{selected|pbd_safe}[Nature]]]|Perception, +@{selected|Perception_bonus}@{selected|pbd_safe}[Perception]]]}} {{rname=Perception}} {{mod=@{selected|Perception_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Perception_bonus}@{selected|pbd_safe}[Perception]]]|Performance, +@{selected|Performance_bonus}@{selected|pbd_safe}[Performance]]]}} {{rname=Performance}} {{mod=@{selected|Performance_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Performance_bonus}@{selected|pbd_safe}[Performance]]]|Persuasion, +@{selected|Persuasion_bonus}@{selected|pbd_safe}[Persuasion]]]}} {{rname=Persuasion}} {{mod=@{selected|Persuasion_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Persuasion_bonus}@{selected|pbd_safe}[Persuasion]]]|Religion, +@{selected|Religion_bonus}@{selected|pbd_safe}[Religion]]]}} {{rname=Religion}} {{mod=@{selected|Religion_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Religion_bonus}@{selected|pbd_safe}[Religion]]]|Sleight Of Hand, +@{selected|Sleight_Of_Hand_bonus}@{selected|pbd_safe}[Sleight]]]}} {{rname=Sleight Of Hand}} {{mod=@{selected|Sleight_Of_Hand_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Sleight_Of_Hand_bonus}@{selected|pbd_safe}[Sleight]]]|Stealth, +@{selected|Stealth_bonus}@{selected|pbd_safe}[Stealth]]]}} {{rname=Stealth}} {{mod=@{selected|Stealth_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Stealth_bonus}@{selected|pbd_safe}[Stealth]]]|Survival, +@{selected|Survival_bonus}@{selected|pbd_safe}[Survival]]]}} {{rname=Survival}} {{mod=@{selected|Survival_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Survival_bonus}@{selected|pbd_safe}[Survival]]]|Strength, +@{selected|Strength_mod}@{selected|jack_attr}[STR]]]}} {{rname=Strength}} {{mod=@{selected|Strength_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Strength_mod}@{selected|jack_attr}[STR]]]|Dexterity, +@{selected|Dexterity_mod}@{selected|jack_attr}[DEX]]]}} {{rname=Dexterity}} {{mod=@{selected|Dexterity_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Dexterity_mod}@{selected|jack_attr}[DEX]]]|Constitution, +@{selected|Constitution_mod}@{selected|jack_attr}[CON]]]}} {{rname=Constitution}} {{mod=@{selected|Constitution_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Constitution_mod}@{selected|jack_attr}[CON]]]|Intelligence, +@{selected|Intelligence_mod}@{selected|jack_attr}[INT]]]}} {{rname=Intelligence}} {{mod=@{selected|Intelligence_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Intelligence_mod}@{selected|jack_attr}[INT]]]|Wisdom, +@{selected|Wisdom_mod}@{selected|jack_attr}[WIS]]]}} {{rname=Wisdom}} {{mod=@{selected|Wisdom_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Wisdom_mod}@{selected|jack_attr}[WIS]]]|Charisma, +@{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}} {{rname=Charisma}} {{mod=@{selected|Charisma_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}}} {{global=@{selected|global_skill_mod}}} @{selected|charname_output} Here's one using the npc template: @{wtype}&{template:npc} @{npc_name_flag} @{rtype}?{Ability|Acrobatics,+@{npc_Acrobatics}@{pbd_safe}[Acrobatics]]]}} {{rname=Acrobatics}} {{mod=@{npc_Acrobatics}}} {{r1=[[@{d20} + @{npc_Acrobatics}@{pbd_safe}[Acrobatics]]]|Animal Handling,+@{npc_Animal_Handling}@{pbd_safe}[Animal]]]}} {{rname=Animal Handling}} {{mod=@{npc_Animal_Handling}}} {{r1=[[@{d20} + @{npc_Animal_Handling}@{pbd_safe}[Animal]]]|Arcana,+@{npc_Arcana}@{pbd_safe}[Arcana]]]}} {{rname=Arcana}} {{mod=@{npc_Arcana}}} {{r1=[[@{d20} + @{npc_Arcana}@{pbd_safe}[Arcana]]]|Athletics,+@{npc_Athletics}@{pbd_safe}[Athletics]]]}} {{rname=Athletics}} {{mod=@{npc_Athletics}}} {{r1=[[@{d20} + @{npc_Athletics}@{pbd_safe}[Athletics]]]|Deception,+@{npc_Deception}@{pbd_safe}[Deception]]]}} {{rname=Deception}} {{mod=@{npc_Deception}}} {{r1=[[@{d20} + @{npc_Deception}@{pbd_safe}[Deception]]]|History,+@{npc_History}@{pbd_safe}[History]]]}} {{rname=History}} {{mod=@{npc_History}}} {{r1=[[@{d20} + @{npc_History}@{pbd_safe}[History]]]|Insight,+@{npc_Insight}@{pbd_safe}[Insight]]]}} {{rname=Insight}} {{mod=@{npc_Insight}}} {{r1=[[@{d20} + @{npc_Insight}@{pbd_safe}[Insight]]]|Intimidation,+@{npc_Intimidation}@{pbd_safe}[Intimidation]]]}} {{rname=Intimidation}} {{mod=@{npc_Intimidation}}} {{r1=[[@{d20} + @{npc_Intimidation}@{pbd_safe}[Intimidation]]]|Investigation,+@{npc_Investigation}@{pbd_safe}[Investigation]]]}} {{rname=Investigation}} {{mod=@{npc_Investigation}}} {{r1=[[@{d20} + @{npc_Investigation}@{pbd_safe}[Investigation]]]|Medicine,+@{npc_Medicine}@{pbd_safe}[Medicine]]]}} {{rname=Medicine}} {{mod=@{npc_Medicine}}} {{r1=[[@{d20} + @{npc_Medicine}@{pbd_safe}[Medicine]]]|Nature,+@{npc_Nature}@{pbd_safe}[Nature]]]}} {{rname=Nature}} {{mod=@{npc_Nature}}} {{r1=[[@{d20} + @{npc_Nature}@{pbd_safe}[Nature]]]|Perception,+@{npc_Perception}@{pbd_safe}[Perception]]]}} {{rname=Perception}} {{mod=@{npc_Perception}}} {{r1=[[@{d20} + @{npc_Perception}@{pbd_safe}[Perception]]]|Performance,+@{npc_Performance}@{pbd_safe}[Performance]]]}} {{rname=Performance}} {{mod=@{npc_Performance}}} {{r1=[[@{d20} + @{npc_Performance}@{pbd_safe}[Performance]]]|Persuasion,+@{npc_Persuasion}@{pbd_safe}[Persuasion]]]}} {{rname=Persuasion}} {{mod=@{npc_Persuasion}}} {{r1=[[@{d20} + @{npc_Persuasion}@{pbd_safe}[Persuasion]]]|Religion,+@{npc_Religion}@{pbd_safe}[Religion]]]}} {{rname=Religion}} {{mod=@{npc_Religion}}} {{r1=[[@{d20} + @{npc_Religion}@{pbd_safe}[Religion]]]|Sleight Of Hand,+@{npc_Sleight_Of_Hand}@{pbd_safe}[Sleight]]]}} {{rname=Sleight Of Hand}} {{mod=@{npc_Sleight_Of_Hand}}} {{r1=[[@{d20} + @{npc_Sleight_Of_Hand}@{pbd_safe}[Sleight]]]|Stealth,+@{npc_Stealth}@{pbd_safe}[Stealth]]]}} {{rname=Stealth}} {{mod=@{npc_Stealth}}} {{r1=[[@{d20} + @{npc_Stealth}@{pbd_safe}[Stealth]]]|Survival,+@{npc_Survival}@{pbd_safe}[Survival]]]}} {{rname=Survival}} {{mod=@{npc_Survival}}} {{r1=[[@{d20} + @{npc_Survival}@{pbd_safe}[Survival]]]|Strength,+@{Strength_mod}@{jack_attr}[STR]]]}} {{rname=Strength}} {{mod=@{Strength_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Strength_mod}@{jack_attr}[STR]]]|Dexterity,+@{Dexterity_mod}@{jack_attr}[DEX]]]}} {{rname=Dexterity}} {{mod=@{Dexterity_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Dexterity_mod}@{jack_attr}[DEX]]]|Constitution,+@{Constitution_mod}@{jack_attr}[CON]]]}} {{rname=Constitution}} {{mod=@{Constitution_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Constitution_mod}@{jack_attr}[CON]]]|Intelligence,+@{Intelligence_mod}@{jack_attr}[INT]]]}} {{rname=Intelligence}} {{mod=@{Intelligence_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Intelligence_mod}@{jack_attr}[INT]]]|Wisdom,+@{Wisdom_mod}@{jack_attr}[WIS]]]}} {{rname=Wisdom}} {{mod=@{Wisdom_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Wisdom_mod}@{jack_attr}[WIS]]]|Charisma,+@{Charisma_mod}@{jack_attr}[CHA]]]}} {{rname=Charisma}} {{mod=@{Charisma_mod}@{jack_bonus}}} {{r1=[[ @{d20} + @{Charisma_mod}@{jack_attr}[CHA]]]}}} {{global=@{global_skill_mod}}} {{type=Check}} {{typec=Check}} @{charname_output}