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

Automatic naming for a universal skill macro

1668531885

Edited 1668533730
Hey folks, Hoping this is a simple one. I've got a universal skill macro that let's the player choose their stat & skill for a roll. I want the rname field to display the stat & skill names, but I'm not seeing an elegant way of doing it. Suggestions? &{template:simple} {{rname=Check}} {{r1=[[1d20+[[?{Attribute|None,0|Strength,@{selected|strength_mod}|Dexterity,@{selected|dexterity_mod}|Constitution,@{selected|constitution_mod}|Intelligence,@{selected|intelligence_mod}|Wisdom,@{selected|wisdom_mod}|Charisma,@{selected|charisma_mod}}]] + [[?{Skill|None,0|Acrobatics,@{selected|acrobatics_prof}|Animal Handling,@{selected|animal_handling_prof}|Arcana,@{selected|arcana_prof}|Athletics,@{selected|athletics_prof}|Deception,@{selected|deception_prof}|History,@{selected|history_prof}|Insight,@{selected|insight_prof}|Intimidation,@{selected|intimidation_prof}|Investigation,@{selected|investigation_prof}|Medicine,@{selected|medicine_prof}|Nature,@{selected|nature_prof}|Perception,@{selected|perception_prof}|Performance,@{selected|performance_prof}|Persuasion,@{selected|persuasion_prof}|Religion,@{selected|religion_prof}|Sleight of Hand,@{selected|sleight_of_hand_prof}|Stealth,@{selected|stealth_prof}|Survival,@{selected|survival_prof}}]] ]]}} {{always=1}} {{r2= [[1d20+[[?{Attribute}]] + [[?{Skill}]] ]]}} {{charname=@{selected|character_name}}}
1668534869
timmaugh
Forum Champion
API Scripter
Attributes are parsed before roll queries, so you can't use a roll query as a component part of an attribute retrieval. And Roll queries can only represent/return one value. It's easy enough to do in Fetch, since Fetch would happen after the roll query. The issue (if it is an issue for you) would be the capitalization of the name of the attribute you returned. Muler gets around the capitalization issue by letting you map your query return over to a new value. With Muler you could establish two mules -- one for the skill and one for the stat. The stat one would look like: None=0 Strength=@(selected.strength_mod) Dexterity=@(selected.dexterity_mod) ...etc... That way when your roll query returned "Strength" (for instance), you could use that in your template header, and use the roll query to drive a Mule retrieval which pointed at the appropriate modifier elsewhere in your template. Note that both methods would require deferring the inline roll to let the metascripts do their thing.
1668535648

Edited 1668535765
Gauss
Forum Champion
There is no easy way to do what you are asking without creating yet another query. It would have to be separately named from the query that normally selects the skill because you cannot have two different outputs from one query.  I suggest looking at the Token Action Mod (API) script. It creates a macro (for 5e by Roll20) that uses a single query (pasted below) By the looks of it instead of treating each element of the roll as a query it has one query, with each skill fully set up.  The problem with this is that you cannot vary the ability used. If that isn't a problem for you I'd use the macro below. @{wtype}&{template:simple}  @{rtype}?{Ability|Acrobatics,+@{Acrobatics_bonus}@{pbd_safe}[Acrobatics]]]}} {{rname=Acrobatics}} {{mod=@{Acrobatics_bonus}}} {{r1=[[@{d20} + @{Acrobatics_bonus}@{pbd_safe}[Acrobatics]]]|Animal Handling,+@{Animal_Handling_bonus}@{pbd_safe}[Animal]]]}} {{rname=Animal Handling}} {{mod=@{Animal_Handling_bonus}}} {{r1=[[@{d20} + @{Animal_Handling_bonus}@{pbd_safe}[Animal]]]|Arcana,+@{Arcana_bonus}@{pbd_safe}[Arcana]]]}} {{rname=Arcana}} {{mod=@{Arcana_bonus}}} {{r1=[[@{d20} + @{Arcana_bonus}@{pbd_safe}[Arcana]]]|Athletics,+@{Athletics_bonus}@{pbd_safe}[Athletics]]]}} {{rname=Athletics}} {{mod=@{Athletics_bonus}}} {{r1=[[@{d20} + @{Athletics_bonus}@{pbd_safe}[Athletics]]]|Deception,+@{Deception_bonus}@{pbd_safe}[Deception]]]}} {{rname=Deception}} {{mod=@{Deception_bonus}}} {{r1=[[@{d20} + @{Deception_bonus}@{pbd_safe}[Deception]]]|History,+@{History_bonus}@{pbd_safe}[History]]]}} {{rname=History}} {{mod=@{History_bonus}}} {{r1=[[@{d20} + @{History_bonus}@{pbd_safe}[History]]]|Artificer's Lore - History,+@{Artificer's_Lore}@{pbd_safe}[Artificer's Lore - History]]]}} {{rname=Artificer's Lore - History}} {{mod=@{Artificer's_Lore}}} {{r1=[[@{d20} + @{Artificer's_Lore}@{pbd_safe}[Artificer's Lore - History]]]|Insight,+@{Insight_bonus}@{pbd_safe}[Insight]]]}} {{rname=Insight}} {{mod=@{Insight_bonus}}} {{r1=[[@{d20} + @{Insight_bonus}@{pbd_safe}[Insight]]]|Intimidation,+@{Intimidation_bonus}@{pbd_safe}[Intimidation]]]}} {{rname=Intimidation}} {{mod=@{Intimidation_bonus}}} {{r1=[[@{d20} + @{Intimidation_bonus}@{pbd_safe}[Intimidation]]]|Investigation,+@{Investigation_bonus}@{pbd_safe}[Investigation]]]}} {{rname=Investigation}} {{mod=@{Investigation_bonus}}} {{r1=[[@{d20} + @{Investigation_bonus}@{pbd_safe}[Investigation]]]|Medicine,+@{Medicine_bonus}@{pbd_safe}[Medicine]]]}} {{rname=Medicine}} {{mod=@{Medicine_bonus}}} {{r1=[[@{d20} + @{Medicine_bonus}@{pbd_safe}[Medicine]]]|Nature,+@{Nature_bonus}@{pbd_safe}[Nature]]]}} {{rname=Nature}} {{mod=@{Nature_bonus}}} {{r1=[[@{d20} + @{Nature_bonus}@{pbd_safe}[Nature]]]|Perception,+@{Perception_bonus}@{pbd_safe}[Perception]]]}} {{rname=Perception}} {{mod=@{Perception_bonus}}} {{r1=[[@{d20} + @{Perception_bonus}@{pbd_safe}[Perception]]]|Performance,+@{Performance_bonus}@{pbd_safe}[Performance]]]}} {{rname=Performance}} {{mod=@{Performance_bonus}}} {{r1=[[@{d20} + @{Performance_bonus}@{pbd_safe}[Performance]]]|Persuasion,+@{Persuasion_bonus}@{pbd_safe}[Persuasion]]]}} {{rname=Persuasion}} {{mod=@{Persuasion_bonus}}} {{r1=[[@{d20} + @{Persuasion_bonus}@{pbd_safe}[Persuasion]]]|Religion,+@{Religion_bonus}@{pbd_safe}[Religion]]]}} {{rname=Religion}} {{mod=@{Religion_bonus}}} {{r1=[[@{d20} + @{Religion_bonus}@{pbd_safe}[Religion]]]|Sleight Of Hand,+@{Sleight_Of_Hand_bonus}@{pbd_safe}[Sleight]]]}} {{rname=Sleight Of Hand}} {{mod=@{Sleight_Of_Hand_bonus}}} {{r1=[[@{d20} + @{Sleight_Of_Hand_bonus}@{pbd_safe}[Sleight]]]|Stealth,+@{Stealth_bonus}@{pbd_safe}[Stealth]]]}} {{rname=Stealth}} {{mod=@{Stealth_bonus}}} {{r1=[[@{d20} + @{Stealth_bonus}@{pbd_safe}[Stealth]]]|Survival,+@{Survival_bonus}@{pbd_safe}[Survival]]]}} {{rname=Survival}} {{mod=@{Survival_bonus}}} {{r1=[[@{d20} + @{Survival_bonus}@{pbd_safe}[Survival]]]}}} {{global=@{global_skill_mod}}} {{type=Check}} {{typec=Check}} @{charname_output}
1668544553
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Gauss said: I suggest looking at the Token Action Mod (API) script.  Token Action Maker. It's available through One-Click install. It handles skill rolls fairly well, though IIRC, it breaks in a few very special cases (ex. rogues with Reliable Talent).
1668621856

Edited 1668621880
I love Token Action Maker, but in this case we really need the stats and skills decoupled as that's how we play. In the end my friend came up with a workaround. In the simple template, if the roll query returns both an integer and a string, it will use just the integer value in the r1 & r2 fields, and the full int + string value in mod. This displays all the needed info in the output and seems to calculate correctly. Weird hack, but if it works... &{template:simple} {{r1=[[1d20+[[?{Attribute|None,0 No Attribute|Strength,@{selected|strength_mod} Str|Dexterity,@{selected|dexterity_mod} Dex|Constitution,@{selected|constitution_mod} Con|Intelligence,@{selected|intelligence_mod} Int|Wisdom,@{selected|wisdom_mod} Wis|Charisma,@{selected|charisma_mod} Cha}]] + [[?{Skill|None,0 No Skill|Acrobatics,@{selected|acrobatics_prof}|Animal Handling,@{selected|animal_handling_prof} Animal Handling|Arcana,@{selected|arcana_prof} Arcana|Athletics,@{selected|athletics_prof} Athletics|Deception,@{selected|deception_prof} Deception|History,@{selected|history_prof} History|Insight,@{selected|insight_prof} Insight|Intimidation,@{selected|intimidation_prof} Intimidation|Investigation,@{selected|investigation_prof} Investigation|Medicine,@{selected|medicine_prof} Medicine|Nature,@{selected|nature_prof} Nature|Perception,@{selected|perception_prof} Perception|Performance,@{selected|performance_prof} Performance|Persuasion,@{selected|persuasion_prof} Persuasion|Religion,@{selected|religion_prof} Religion|Sleight of Hand,@{selected|sleight_of_hand_prof} Sleight of Hand|Stealth,@{selected|stealth_prof} Stealth|Survival,@{selected|survival_prof}} Survival]]]]}} {{always=1}} {{r2= [[1d20+[[?{Attribute}]] + [[?{Skill}]] ]]}} {{charname=@{selected|character_name}}} {{mod=?{Attribute} / ?{Skill}}}