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 .
×

Complete(ish) documentation for writing formulas/powers in 4e character sheet?

1411691435

Edited 1411693294
There are a lot of really great threads on here with help about how to write powers, actions, and rolls for the 4e character sheet. However, it's all a bit hit or miss (if you'll pardon the pun). I'm a software developer; is there a technical reference somewhere that fully specifies how the macros work? One page that documents all of the possible elements that could be referred to would be awesome. Maybe this already exists, but I haven't found it yet. I'm also trying to understand whether I can have variables in macros, for use in things like: Calculating half-damage programmatically. Dynamically using "he" or "she" in spell/power descriptions based on the character's gender. Styling output from the power roll macros (e.g., using italics for descriptions.) Can I use ability checks in power rolls? (e.g., for the "Suggestion" ability, actually roll the arcana check? I tried referencing it but had no luck.) Thanks!
1411694068
Lithl
Pro
Sheet Author
API Scripter
Anything you can put into chat, you can put into a macro (including the 4e power macros) The dice engine supports division as well as grouping to enforce order of operations. It also includes a floor() function to round down. So, for example, an implement daily attack dealing 2d10+INT damage and half damage on miss, you could use [[floor((2d10 + @{intelligence-mod}) / 2)]] to represent the half damage. (Of course, an actual character will probably have additional bonuses to apply!) This is not possible, unfortunately. Of course, since your power macros are going to be per-character, this shouldn't be an issue unless your character is changing genders on a regular basis... You can use /me at the start of a line to make the contents of that line an emote (the entire line will be bold, italic, centered, orange, and the sentence will begin with the character's name). Anyone with GM power can use /desc at the start of a line to make the contents of that line a description (the entire line will be bold, italic, centered, black, and the character's name will not be displayed with it). There's no means to style just part of a line, and your options for styling an entire line are limited. Absolutely! %{Mr. Bearington|arcana} will roll arcana for the character "Mr. Bearington".
1411695191

Edited 1411695230
Brian said: Anything you can put into chat, you can put into a macro (including the 4e power macros) The dice engine supports division as well as grouping to enforce order of operations. It also includes a floor() function to round down. So, for example, an implement daily attack dealing 2d10+INT damage and half damage on miss, you could use [[floor((2d10 + @{intelligence-mod}) / 2)]] to represent the half damage. (Of course, an actual character will probably have additional bonuses to apply!) This is not possible, unfortunately. Of course, since your power macros are going to be per-character, this shouldn't be an issue unless your character is changing genders on a regular basis... You can use /me at the start of a line to make the contents of that line an emote (the entire line will be bold, italic, centered, orange, and the sentence will begin with the character's name). Anyone with GM power can use /desc at the start of a line to make the contents of that line a description (the entire line will be bold, italic, centered, black, and the character's name will not be displayed with it). There's no means to style just part of a line, and your options for styling an entire line are limited. Absolutely! %{Mr. Bearington|arcana} will roll arcana for the character "Mr. Bearington". Thank you for the reply! 1: Yes, my question wasn't how to do the math, but how to preserve the roll from the hit roll for the miss roll. For example, suppose I did: Hit: [[3d8+@{power-8-damage}]] fire damage Miss: [[(3d8+@{power-8-damage) / 2}]] fire damage In that case, the Miss: line would actually be a separate roll , when what I really want is to re- use the value from the Hit: line in the Miss: line. 2,3: Awww, shucks. Oh well! No big deal. 4: %{Mr. Bearington|arcana} looks to me like it just prints the arcana value, not rolling a check. Am I mistaken? (And, I have to do something like "[[@{Mr. Bearington|Arcana}]] to do it inside a power roll macro - still not clear on the % vs. @ semantics, hence my wondering if there is a spec somewhere.
Following up to myself on point 4: While I can't figure out how to access other rolls from within the power macros themselves, I can replicate the same result by doing something like: [[1d20+@{Arcana}]] This page on the wiki was somewhat helpful to me: <a href="https://wiki.roll20.net/Character_Sheets" rel="nofollow">https://wiki.roll20.net/Character_Sheets</a>
1411698465
Lithl
Pro
Sheet Author
API Scripter
Peter B. said: 1: Yes, my question wasn't how to do the math, but how to preserve the roll from the hit roll for the miss roll. For example, suppose I did: Hit: [[3d8+@{power-8-damage}]] fire damage Miss: [[(3d8+@{power-8-damage) / 2}]] fire damage In that case, the Miss: line would actually be a separate roll , when what I really want is to re- use the value from the Hit: line in the Miss: line. No, there's no way to do that. (Note that 1, 2, and 3 could all be accomplished with the API, but that requires that the campaign owner have a Mentor account.) Peter B. said: 4: %{Mr. Bearington|arcana} looks to me like it just prints the arcana value, not rolling a check. Am I mistaken? (And, I have to do something like "[[@{Mr. Bearington|Arcana}]] to do it inside a power roll macro - still not clear on the % vs. @ semantics, hence my wondering if there is a spec somewhere. That would be because I read the wrong value. Whoops! %{Character Name|-arcana-Check} should be the correct one (note the dash before "arcana"). The difference between % and @ is that @ denotes an attribute, while % denotes an ability. An ability is a macro that is specific to a single character, while a macro (denoted with #) is specific to a player. (The GM can also create macros that multiple players can use.)