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

Is it possible to put an "if" in a macro without using the API?

Hello everyone. I'm trying to modify some macros a fellow player shared with me for my Pathfinder First Edition character. We're using the Roll20 sheet for our campaign. The macros look more or less like this: [[1d20+@{knowledge_arcana}]] (Arcana, [[@{knowledge_arcana_ranks}]] Ranks) [[1d20+@{knowledge_dungeoneering}]] (Dungeoneering, [[@{knowledge_dungeoneering_ranks}]] Ranks) [[1d20+@{knowledge_engineering}]] (Engineering, [[@{knowledge_engineering_ranks}]] Ranks) [[1d20+@{knowledge_geography}]] (Geography, [[@{knowledge_geography_ranks}]] Ranks) [[1d20+@{knowledge_history}]] (History, [[@{knowledge_history_ranks}]] Ranks) [[1d20+@{knowledge_local}]] (Local, [[@{knowledge_local_ranks}]] Ranks) [[1d20+@{knowledge_nature}]] (Nature, [[@{knowledge_nature_ranks}]] Ranks) [[1d20+@{knowledge_nobility}]] (Nobility, [[@{knowledge_nobility_ranks}]] Ranks) [[1d20+@{knowledge_planes}]] (Planes, [[@{knowledge_planes_ranks}]] Ranks) [[1d20+@{knowledge_religion}]] (Religion, [[@{knowledge_religion_ranks}]] Ranks) As you can see this macro will send to the chat a roll for each Knowledge skill with its corresponding ranks to see if the skill is trained or not. My question is, is it possible to use an "if" or other operator to make so that the macro tells you whether the skill is Trained or Untrained, instead of telling you how many ranks the character has invested in it? Thank you in advance for your help and time.
1648347597

Edited 1648347673
GiGs
Pro
Sheet Author
API Scripter
I should probably leave this to someone more familiar with the system, but it kinda depends. Normally the answer is no, you can't include an if (and that's probably the case here), but you can sometimes fake it by building an expression that accounts for it in roll20 math. Does this sheet have a checkbox for trained/untrained, or is anyone with 0 ranks automatically untrained? And how do you want the output to look, if so? Also, your skill list look like it us easily converted into a rolltemplate with prettier output. Something like &{template:default} {{name=@{character_name}'s skills}} {{Arcana ([[@{knowledge_arcana_ranks}]] Ranks) = [[1d20+@{knowledge_arcana}]]}} Just add other skills on the end in the format {{title = result}} (you want {{ at the start, = to separate toitle from value, and }} to end it). It all needs to be on the same line. This uses the default rolltemplate, but your sheet might have different templates to you that are prettier.
Since you appear to be dealing purely with attributes there is an additional way to handle such an if operation. Using the Prefix trick you can use the value of an attribute to select a different attribute. If a trained/untrained attribute exists that could be used to select between two custom attributes with Trained and Untrained text. If need be you could more exhaustively use the number of ranks to switch between Trained and Untrained text. Either way it would look something like @{prefix}@{character_name}|IsTrained@{knowledge_arcana_trained}} With IsTrained0 having the value "Untrained" and IsTrained1 (and higher duplicates if using ranks) having the value "Trained"
Thanks both of you, @GiGs and @RainbowEncoder, but I don't know if those methods would work. There is no "value" on the sheet for Trained/Untrained, simply a skill with 0 ranks is untrained, otherwise is trained.