To Do List: Add handout configuration option Add FX integration Dec 11th, 2017 ~ 10:43 am eastern Version: 3.5.1 Link: <a href="https://gist.github.com/Sky-Captain-13/452330a3d926b32da49c" rel="nofollow">https://gist.github.com/Sky-Captain-13/452330a3d926b32da49c</a> Bugfix: Fixed issue with alterbar and soundfx commands which contained a _ or - April 11th, 2017 ~ 9:20 am eastern Version: 3.4.4 Link: <a href="https://gist.github.com/Sky-Captain-13/452330a3d9" rel="nofollow">https://gist.github.com/Sky-Captain-13/452330a3d9</a>... Bugfix: Fixed Silvyre's bug with multiple [^RollIDs] in the same tag/content. April 10th, 2017 ~ 7:40 am eastern Version: 3.4.3a - Guilty Spark Bugfix: Re-wrote logic for searching and replacing RollID's and the different options when multiple instances were used in the same line, such as [^R.base] [^R.ones] [^R.total] Update: --titlefontshadow| can be used to add shadows or colored outlines around the name of the powercard using the CSS text-shadow properties. This defaults to either a black outline or white outline based on player color and can be removed using --titlefontshadow|none Update: --titlebackground| can possibly be used to add images (untested), using the css background properties. It defaults to a linear gradient from white to transparent which can be removed with --titlebackground|none. Adding an image this way to the top of the powercard is entirely untested and not supported. I only added it to fade the color from light to dark. April 9th, 2017 ~ 10:30 am eastern Version: 3.4.2 Bugfix: Fixed missing borders on single row powercards with or without a titlebox. April 9th, 2017 ~ 10:30 am eastern Version: 3.4.1 Minor Update: If --name is not defined in the powercard, the title/background block will not be displayed. Bugfix: Command buttons now work in chat and not just whispers. March 21st, 2017 ~ 8:45 am eastern Version: 3.4.0 Major Update: You can now send a command to the AlterBars script written by me as well. This means you can use PowerCards to apply damage to a target automatically. Much like the soundfx option, you have to replace the -- in the alterbar commands with a single underscore. --alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dmg] _show|GM The sample macro below shows how to apply damage to the target of an attack based on their AC, using the D&D 5e OGL sheet armor class attribute npc_ac: !power {{
--name|Shortbow
--Attack:|[[ [$Atk] 1d20+5]] vs @{target||npc_ac} AC
--?? $Atk < @{target||npc_ac} ?? !Missed|**You missed!**
--?? $Atk >= @{target||npc_ac} ?? soundfx1|_play|ArrowHits
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? Hit:|[[ [$Dmg] 1d8+3]] piercing damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dmg] _show|GM
--?? $Atk.base == 20 ?? Critical Hit:|[[ [$CritDmg] 2d8+3]] piercing damage
--?? $Atk.base == 20 ?? alterbar2|_target|@{target||token_id} _bar|1 _amount|-[^CritDmg] _show|GM
}}
February 21st, 2017 ~ 12:20 am eastern Version: 3.3.1 Link: <a href="https://gist.github.com/Sky-Captain-13/452330a3d9" rel="nofollow">https://gist.github.com/Sky-Captain-13/452330a3d9</a>... Bugfix: The script was rounding rolls with decimal points when used in a conditional. [[ [$Roll] 0d0 + 0.5 ]] would return as 1 instead of 0.5 in a conditional, meaning ?? $Roll == 0.5 ?? would never return as true. TLDR... decimal points weren't working properly. February 11th, 2017 ~ 10:00 am eastern Version: 3.3.0 Major Update: Added the --soundfx tag which integrates with the Roll20 Audio Master Scott C. script available as a one-click install script. To use this tag, you need to use the R20AM commands, but replace the -- of their tags with an underscore. To use multiple soundfx tags, just append a number to the end. --soundfx|_play|Bite --?? $Atk >= @{target|AC} ?? soundfx1|_play|Shortbow Minor Update: Included error catching from Shaangor . January 16th, 2017 ~ 9:50 am eastern Version: 3.2.23 Minor Update: Added double dash fix from TheAaron for urls. Should solve the old issue with double dashes in token and character id's too. November 23rd, 2016 ~ 5:00 pm eastern Version: 3.2.22 Update: Added getAttrRefValues function written by Sines . This allows you to use autocalculated attributes on character sheets with target charms. Such as the armor class attribute on most D&D character sheets. Note: This update is untested by me. I simply added the function as is into the script. PowerCards... What are they? They are simply macro's formatted using --tags that are interpreted by the script to apply html and css to contents of the macro. This string is then sent to the chat window via the API using /direct to allow the html and css formatting to work. This has the benefit of reducing the spam in the chat window (while admittedly creating a new kind of spam) and reduces the number of macros needed. This script can turn this... ... or this ... ... into this! Using the Script Note: You must be a PRO level subscriber to Roll20 to utilize API scripts. Step 1: Copy the script into the API section of your campaign and save it. Step 2: Create macros/abilities for your monsters, characters, magic items, or whatever else you want to use it for. D&D 4e Example: !power {{
--emote|HoneyBadger resorts to the simple attack he learned when he first picked up a weapon.
--format|atwill
--name|Melee Basic Attack
--leftsub|At-Will
--rightsub|Standard Action
--Attack|[[1d20 + 4 [Strength Mod] + 3 [Longsword Prof.]]] vs AC
--Hit|[[1d8 + 4 [Strength Mod]]] slashing damage
}} D&D 5e Example: !power {{
--emote|HoneyBadger slashes at his foe with a longsword.
--format|atwill
--name|Melee Attack
--leftsub|Action
--rightsub|Reach 5 ft.
--Attack|[[1d20 + 3 [Strength Mod] + 2 [Proficiency]]] | [[1d20 + 3 [Strength Mod] + 2 [Proficiency]]] vs AC
--Hit|[[1d8 + 3 [Strength Mod]]] slashing damage
}}
These two macro's show up as... Using Tags Tags are used to tell the script how to identify the Content that follows and help tell the script what to do in some cases. For example, the --name| tag is used to set the name at the top of the power card. Tag Format Examples: GOOD: --Tag|Content GOOD: --Effect|This is an effect. GOOD: --A Custom Tag|This is a custom tag. BAD: effect | This is a bad tag. BAD: -BadTag| This is also a bad tag. Tag Options: These are used to further customize the appearance and features of the power cards. Hidden Tag : Adding an exclamation mark ! at the start of a tag will hide that tag and not display it in the power card, but it will show the contents of the tag in the power card. This is useful for adding blocks of text without a tag. Example: --!Tag|Content Indent: Adding a caret mark ^ followed by a number will indent that entire line and its contents slightly. The indentation option ranges from a minimum of zero (used to reset the indent to default) to a maximum of nine, though at nine, you will not have very much room for content at all. Example: --^1Tag|Content The indent tag option can be used in conjunctions with the hidden tag option, but the exclamation mark must be first. Example: --!^1Tag|Content Repeat: To repeat a tag and its contents, add a hash mark followed by the number of times you want the content to repeat. You can also use roll queries to add a pop-up in roll20 to determine the number of times to repeat the tag when you click the macro (see second example). Example: Tag#4|Content Example: Attack#?{Number of attacks|1}|[[1d20+4]] Using the repeat tag will generate unique rolls for each inline roll in each repeated tag. Same Name: This tag option is used to enable the use tags with the same name. Unlike repeating tags, the content is unique to each tag of the same name. To use this tag, add an asterisk * followed by a number (cannot use the same numbers). Example: Tag *1|Content Example: Tag *2|Content Hides Tag & Content: Add a $ in front of the tag to hide the tag and the content. Using ?{Hit delete to show|$} makes this configurable on the fly. Example: --$Tag|Content Example: --?{Hit delete to show Hex damage|$}Hex:|[[1d6]] necrotic damage Reserved Tags: These tags are reserved for specific use by the script and cannot be used for anything else. charid - Gets the character_id of the character triggering the macro. Combines with --emote to create a custom look to emotes. Usage: --charid|@{character_id} emote - Creates an emote on top of the power card. Set CUSTOM_EMOTES to false in script to return to standard Roll20 orange emotes. If you have charid and emote together in the macro to use the power card styled emotes, you can put an exclamation mark in front of the emote to not show the avatar for that macro. Example: --emote|This emote would have an avatar. Example:--emote|!This emote would not have an avatar. format - An option for GM's to make setting text and background colors easier. See the Format Tag section below for more detailed information. Example: --format|atwill Example: --format|encounter name - The name of the power, skill, ability, etc. being used or whatever else you can think of. Appears at the very top of the card. title - Sets a tooltip on the colored title box. Useful for hiding information that would otherwise clutter the chat window. leftsub - Creates a smaller subtitle beneath the name of the power card, left of the diamond if used in conjunction with rightsub. rightsub - Creates a smaller subtitle beneath the name of the power card, right of the diamond if used in conjunction with leftsub. txcolor - Sets the color of the text in the title box using hex code (#000000). bgcolor - Sets the background color of the title box using hex code (#000000). erowtx - Sets the text color of even numbered rows in the body of the power card using hex code (#000000). erowbg - Sets the background color of even numbered rows in the body of the power card using hex code (#000000). orowtx - Sets the text color of odd numbered rows in the body of the power card using hex code (#000000). orowbg - Sets the background color of odd numbered rows in the body of the power card using hex code (#000000). whisper - Sends the title box and body of the power card to the designated target. For example --whisper|GM would send the power card to the GM. target_list - Creates a list of targets in conjunction with multiple uses of the @{target|Nth Target|token_id} roll query for each possible target. Example: --target_list|@{target|1st Target|token_id} | @{target|2nd Target|token_id} | @{target|3rd Target|token_id} A method for replacing text in the powercard with information from the target_list objects will be added later. titlefont - Sets the font of the title of the power card. subtitlefont - Sets the font of the subtitles beneath the title of the power card. bodyfont - Sets the font of the body of the power card. Word of caution, this absolutely will alter the font of the inline rolls as well. corners - Defaults to 5... set to 0 to remove rounded corners or higher to round them even more. titlefontsize - Sets the size of the name of the powercard subtitlefontsize - Sets the size of the text of leftsub and rightsub bodyfontsize - Sets the size of the text in the body of the powercard border - Can be used to set the size style color of borders using this format: --border|1px solid #000 tokenid - This tag lets you use the token image instead of character avatar for custom emotes. Must be used with either: @{selected|token_id} @{target|self|token_id} hroll - This tag allows you to make as many hidden rolls as needed without them showing up on the powercard. Combined with a RollID, you can reference these rolls later without showing the math. Example: !power {{--hroll|[[ [$Atk] 1d20 + 10 ]]
--Attack:|[^Atk.total] or [! [^Atk.total] !] vs AC}} soundfx - This tag sends an api command to the Roll20 Audio Master (R20AM) script available as a one-click script install. Follow the link for more information on how to use R20AM. --soundfx|_play|Bite --?? $Atk >= @{target|AC} ?? soundfx1|_play|Shortbow Inline Roll Options: Add this before the die roll you want to modify and make sure there is a space between the [[ brackets and the roll option. Such as follows: [[ [NH] 1d4 + @{DEX Mod] [Dex Mod] ]] You can use multiple roll options by separating them with a vertical pipe character such as: [[ [nh|trkr] 1d20]] [NH] - Disables inline roll highlighting for crit success and crit failure. [TRKR] - Adds an entity to the Turn Order Tracker. If the powercard macro does not have --tokenid or --charid, it will use the Display Name of the player that triggered the macro. If you use --charid, it will look for a token that is representing the character and use that id, but fall back to the character name if there are no tokens representing the character. [TXT] - Causes an inline roll to show up as text only instead of as an inline roll. [XPND] - This inline roll option expands the roll into the full formula/expression instead of just the result. [[1d20 + @{Dex Mod}]] becomes [(18) + 3 = 21] instead of [21] Examples: GOOD: [[ [NH] 1d6]] BAD: [[[NH] 1d6]] Text Formatting: You can use the options below to format text in the content of a tag. These can be combined in any number of ways. **Bold** //Italics// __Underline__ ~L, ~C, ~R aligns text in between those tags to the (L)eft, (C)enter, and (R)ight. ~L This text would be left aligned. ~L ~C This text would be centered. ~C ~R This text would be right aligned. ~R ~~~ inserts a horizontal rule. ^^ adds a line break ^*Indents the first line of a paragraph in the content of a tag. @@url@@ - Naked url, requires that ALLOW_URLS to be set to true in the script. @@url||test@@ - Hidden url, requires that ALLOW_HIDDEN_URLS to be set to true in the script. Must have double bars in between the url and the text. $$#400|This text will be in dark red.$$ The Format Tag The --format tag is one of the more heavily revamped tags in the 2.0 version of power cards. Instead of specifying a game system as it did in the past, it instead can be used to specify the text and background colors of the macro in one tag. The GM of the campaign must create a handout and name it exactly PowerCard Formats so that the script can find the information and parse the formatting info as needed. You absolutely must follow the format shown in the example below to get the --format tag to work properly. This image is an example of the D&D 4e power usage colors. I recommend setting this handout as viewable by all players so that they can see what options are available for them to use in their own power card macros. Target Info Charms This new feature lets you grab info from a character sheet or token by using --target_list|@{target|1st Target|token_id} | @{target|2nd Target|token_id} | etc to create the list of targets and then adding target info charms into the content of your powercard such as %%token_name%% to get the name of the token. The types of charms are broken down into two categories: token charms and attribute charms. Token charms area set list that grab information like bar values and the name of the token. Attribute charms can be any attribute on a character sheet and they are case sensitive. AC is not the same as aC, Ac, or ac. Finally... and this is very important ...all charms referring to a target must be in the same tag. You cannot have charms split between tags. If you want to create a kind of stat sheet, use line breaks ^^ to create new lines. Good Examples !power --name|Single Target Attack --target_list|@{target| |token_id} --Attack|[[1d20+5]] | [[1d20+5]] vs %%AC%% Armor Class (%%token_name%%) --Hit|[[1d8+3]] slashing damage !power --name|Scorching Burst | Nine Targets --target_list|@{target|1st|token_id} | @{target|2nd|token_id} | @{target|3rd|token_id} | @{target|4th|token_id} | @{target|5th|token_id} | @{target|6th|token_id} | @{target|7th|token_id} | @{target|8th|token_id} | @{target|9th|token_id} --Attack#?{Number of targets|1}|[[1d20+5]] vs %%Reflex%% Reflex (%%token_name%%) --Hit|[[1d8+3]] fire damage For a multi-attack power like Scorching Burst in D&D 4e, you create the macro as above and just click nine times and then when the pop up for number of targets appears, type in the actual number of targets in the area and hit enter. The script will ignore the rest of the targets in the list. For example, in the snip below... I clicked nine tokens pretty quickly. Only the first four mattered since those were my actual targets. Then I typed in the number of targets and hit enter when the pop up appeared. !power --name|Stats --target_list|@{target|1st Target|token_id} --Target|%%token_name%% ^^ **Hit Points:** %%bar3%%/%%bar3_max%% ^^ **Defenses:** AC %%AC%%, Fort %%Fortitude%%, Reflex %%Reflex%%, Will %%Will%% Bad Example !power --name|Bad Example --target_list|@{target| |token_id} --Target|%%token_name%% --Attack|[[1d20+5]] | [[1d20+5]] vs %%AC%% Armor Class --Hit|[[1d8+3]] slashing damage to %%token_name%% In the example above, the %%AC%% and second %%token_name%% charms would not be replaced with the proper info. Token Charms %%token_name%% %%bar1%% %%bar1_max%% %%bar2%% %%bar2_max%% %%bar3%% %%bar3_max%% Sample Attribute Charms %%Strength%% %%Strength Mod%% %%Fortitude% %%Reflex%% %%Will%% %%HP%% %%Hit Points%% Other Charms %%who%% - gets the DisplayName of whomever triggered the macro/powercard ConditionalsConditionals are simple logic using either the base value of a die roll or the total value of the entire inline roll. They can only be used at the start of a tag right now, but will eventually be able to be used in the content of a tag to selectively show or hide information. Conditionals are used by wrapping them in double question marks at the start of a tag, telling the script which roll to use, whether to use the base value or total, how to compare it, and to what to compare it to. For example... a basic crit macro for a D&D 4e basic melee attack with a long sword: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 4 [Str Mod] + 3 [Weapon Proficiency] ]] vs AC --Hit:|[[ 1d8 + 4 [Str Mod] ]] slashing damage --?? $Atk.base == 20 ?? Critical Hit:| Add [[1d8]] slashing damage }} Structure of a Conditional ?? LeftValue vs RightValue ?? LeftValue and RightValue can be a number, a roll id ($Roll), or a roll query ( ?{target|AC} ), or even an attribute call ( @{attribute} ). vs can be one of the following operands: <, <=, ==, >=, >, <> (not equal), % (evenly divisible), ~% (not evenly divisible) Very important!! You must have a space between each part of the conditional. No spaces will cause an undefined variable crash. Roll $ID's must be defined in an inline roll as a label in front of the roll you want to use later. It must be in single square brackets and must start with a dollar sign ($). Next, you will want to determine if you are going to check the base value of the roll of the total value of the entire inline roll. For example if you use [[ [$Atk] 1d20 + 4 ]] and roll a 10 on the d20, the base value will be 10 and the total value will be 14. Add .base to the $ID for the base value and .total for the total value ($ID.base or $ID.total). The symbol can be one of the following: <, <=, ==, >=, >, <>, %, and ~%. They are in order: less than, less than or equal to, equal to, greater than or equal to, greater than, not equal to, modulo, and negated modulo (see below). Modulo Symbol The modulo symbol, added in version 3.0.2, is a percentage sign % and can be used to divide the left side by the right side. By itself, modulo will return true if the left side is evenly divisible by the target number. This can be used to show something if it is an even number (?? $ID.base % 2 ??). Adding the tilde ~ in front of the module will negate or reverse the outcome. So if you do ~% 2 instead, it will be true if the number is odd. Extending Conditionals Conditionals can also be extended to test for multiple values, but keep the following in mind... any conditional with AND will stop immediately when it finds a false statement and any conditional with OR will stop immediately when it finds a true statement. Here is an example of an extended conditional with complex logic for a D&D 5e melee attack: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + 2 [Proficiency] ]] vs AC --?? $Atk.base == 1 OR $Atk.total < @{target|AC}?? !Miss:|You missed. --?? $Atk.total >= @{target|AC} AND $Atk.base <> 1 AND $Atk.base <> 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk.base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }} Stacking Conditionals You can also stack conditionals one after the other and they will be executed in that order, left to right. It basically works like AND, but may be a little cleaner to read. May be more useful after conditionals can be used in the content of a tag and not just the tag itself. Contributors The following members of the Roll20 community have greatly aided with the creation and enhancement of this script either through their scripting expertise or their suggestions to improve features of the script and their relentless bug hunts! Alex L. Brian Chris N. Rob J. The Aaron GenKitty Sean G Janick H. Previous Discussion Thread <a href="https://app.roll20.net/forum/post/2165711/script-p" rel="nofollow">https://app.roll20.net/forum/post/2165711/script-p</a>...