To Do List: Add RPND to show SUM = EXPRESSION Add PowerCards Status List as option for handout name Work on adding Handout configuration options Look at FX Integration Add --whisper|all option October 4th, 2016 ~ 4:00 am eastern Version: 3.2.21 Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Minor Update: Moved when status icons and info are added into the powercard to support usage of powercard formatting options like ^^ for line breaks. This means you can use all the bold, underline, links and more in the PowerCards Status List handout if you're using that to store your status information like this... dazed|half-haze|You grant combat advantage. ^^ You can take either a **standard action**, a **move action**, or a **minor action** on your turn (you can also take free actions). You can't take immediate actions or opportunity actions. You can't flank an enemy. July 20th, 2016 ~ 9:00 am eastern Version: 3.2.20 Minor Update: Added --whisper|all per request from Silvyre. Script will send powercard to all online players only. I have no idea what would happen if it tried to whisper offline players as well. The script uses the _displayname attribute of the Player object to determine who to send the whisper to. July 19th, 2016 ~ 10:00 pm eastern Version: 3.2.19 Bugfix: Change to fix concatenation errors when using multiple scripts. (per TheAaron) March 29th, 2016 ~ 10:00 am eastern Version: 3.2.18 Minor Update: Added RPND which is a reverse of XPND. [[ [rpnd] 1d20 + 4 ]] will show up as Total = Roll + Mods (YAGKR... =^_^= ) Minor Update: Added PowerCards Status List as an allowed name for the handout used to define status icon names and information. (YAGKR... =^_^= ) February 20th, 2016 ~ 10:00 am eastern Version: 3.2.17a Update: PowerCard Status List now accepts a third option to include a description of the status effect. Though this was created for D&D 4e conditions... I'm sure you'll find some other use for it as well. If you do not include the description and just use dazed|half-haze, the script will ignore that and print anything you put in that tag. Usage: dazed|half-haze|You grant combat advantage. You can take either a standard action, a move action, or a minor action on your turn (you can also take free actions). You can't take immediate actions or opportunity actions. You can't flank an enemy. --Dazed|[+dazed] The above will show, in chat, the full description of dazed as set in the PowerCards Status List handout. February 19th, 2016 ~ 9:30 am eastern Version: 3.2.16 Minor Update: Roll ID's will now get the table id number from a rollable table and can be accessed as the base number of a roll id. [[ [$Tbl] 1t[RandomWeather] ]] Tbl.base will get the tableidx rolled on the table, including the weight. So if you have a table with three items weighted item1 (10), item2 (5), and item3 (1), you'll get a number between 0 and 15, with item1 on the table being covered by number 0-9, item2 by 10-14, and item3 by 15. February 17th, 2016 ~ 6:30 pm eastern Version: 3.2.15 Update (GenKitty Request): Added an option to create a list of status icons and conditions and display them in a powercard. You can either use the actual status icon name or create a handout named PowerCard Status List and define an alias for each status icon, such as dazed|half-haze or blinded|bleeding-eye Usage : --Dazed:|[+dazed] or [+half-haze] The creature is unable to act normally. A dazed creature can take no actions, but has no penalty to AC. Example in use... February 14th, 2016 ~ 1:06 pm eastern Version: 3.2.14a Minor Update (Silvyre's Request): Added option to count number of ones in a roll using a Roll ID. To display the number of ones rolled use: [[ [$Roll] 10d10 ]] [^Roll.ones] February 14th, 2016 ~ 1:00 pm eastern Version: 3.2.14 Major Bugfix: Fixed a major bug that would crash the script if you ran any powercard with inlinerolls that did not create a mods or mods.success property in msg.inlinerolls. February 13th, 2016 ~ 1:30 pm eastern Version: 3.2.13 Update: Added the Skills5e reserved tag to PowerCards. This tag will automatically print a list of your character's skills, drawn from the attributes of the D&D 5e Community character sheet. It will not work with the OGL or the Shaped 5e character sheets. Update: Added an option to display number of successes or test against number of successes using Conditionals. [^RollID.ss] will display the number of successes from that roll. [^RollID.base] is always a sum of all the rolls, no modifiers. Base has nothing to do with successes at all. [^RollID.total] is always a sum of the successes of all rolls in the inline roll, not just the RollID used. So if you use multiple roll ID's in the same inline roll as below, it will always be the total result of all the rolls. The use of .ss is to break out successes from individual rolls within a multi-roll inline roll like this: [[ [$R1] 3d6>3 + [$R2] 3d6>3 ]]. The use of ^R1.ss will only show the successes from the first roll. November 22nd, 2015 ~ 12:30 pm eastern Version: 3.2.12 Bugfix: Content hidden by conditionals will not be processed. This really only affects the [trkr] roll option that sends a token to the turn order tracker. Example: -- ?? ?{Send to Init|Yes|No} == Yes ?? Initiative:|[[ [trkr] 1d20 ]] If you select no, the token will not be added to the turn order tracker, nor will its existing initiative be modified. Update: You can now display the base value of a Roll ID by adding [^Roll ID] to your PowerCard. This cannot be used as a stored variable to do math with however. Example: --Damage:| [[ [$Physical] 1d8 + [$Fire] 1d6 + [$Necrotic] 2d6 ]] ([^Fire] fire, [^Necrotic] necrotic) would show up as Damage: [19] (4 fire, 9 necrotic) If you want to include a modifier as part of the base value, you must wrap the roll and modifier in curly brackets like this: [[ [$Physical] {1d8 + 3 [Str Mod] } + [$Fire] {2d6 + 3} ]] Bugfix: As part of the above update, I was able to get Roll ID's to work with multiple dice and their base sum. Before the bugfix, $ID.base would only use the last number rolled, regardless of the number dice rolled. Example: If you rolled [[ [$Fire] 3d6 + 10 ]] and rolled a 3, 3, 5... [^Fire] would only show the five and any conditionals trying to use $Fire.base would only test against the value of five instead of eleven, the sum of the dice only. This would be most useful for system that use multiple dice for a roll that may or may not have modifiers applied, but also bases things like critical success off the base rolls. Like using 3d6 for attacks rolls in D&D instead of 1d20. You would be able to do the following, which did not work before. -- Attack:| [[ [$Atk] 3d6 + 3 [Str Mod] ]] vs AC -- ?? $Atk.base >= 18 ?? Critical Hit:|You got a critical hit! November 20th, 2015 ~ 4:30 pm eastern Version: 3.2.11 Bugfix: You can now use self as part of multiple target whispers. Example: --whisper|self,gm Courtesy of TheAaron Minor Bugfix: Added a blank line semi-colon at the start of the script to help reduce possible errors of a missing semi-colon in another script. Will not have any affect if you have no other scripts. Added after reading about it in one of TheAaron's other posts somewhere. Update / Bugfix: Conditionals now properly test for both text and numbers. However, you're only going to get text from a roll query or attribute call and not an inline roll. So for example, in my D&D 5e game, I set up an attribute (AttackRoll ) on my character sheet and put ?{Attack|Standard, 1d20|w/Advantage, 2d20kh1|w/Disadvantage, 2d20kl1} in that attribute. I can now reference it via @{AttackRoll}. If I select Standard, it returns 1d20 and Advantage returns 2d20kh1. These conditionals are case sensitive. Yes does not equal yes or yEs or YEs or any combination other than Yes. Example: -- ?? @{AttackRoll} == 2d20kh1 ?? Advantage|I have advantage! Example: -- ?? ?{Flanking?|Yes|No} == Yes ??Flanking:|I am flanking! Courtesy of Nate W. July 31st, 2015 ~ 8:45 pm eastern Version: 3.2.10 Bugfix: Passing a message to PowerCard.Process does not require a player object any longer and will not crash the script without one. What this allows you to do is write a script for whatever you want and send a message to PowerCard.Process (formatted like a powercard macro) and display it in chat. If you have questions about this and what you can do with it, just ask in the thread. July 27th, 2015 ~ 8:15 am eastern Version: 3.2.9 Bugfix: Line 63 updated with TheAaron's latest fix for floor() and ceil() issues. Bugfix: Corrected default Roll20 emote display error, where it would clip the first word from the emote. July 23rd, 2015 ~ 12:45 am eastern Version: 3.2.8 (The Aaron Line 63 Update) Major Bugfix: This update fixes a number of crashes due to sendChat interaction with the API. June 10th, 2015 ~ 6:00 am eastern Version: 3.2.7 Bugfix: Adjusted padding and margins on rows and inline rolls to make them all line up properly. This includes right aligned content using ~R formatting which may or may not include inline rolls as well. Bugfix: Negative numbers work in math only inline rolls now. [[-4]] will not crash the script. June 9th, 2015 ~ 10:00 am eastern Version: 3.2.6 Bugfix: Conditionals will now work with any combination of numbers, inline rolls, and roll id's. See valid examples below. ?? 1 < 2 ?? ?? $Atk >= 20 ?? ?? $Atk >= @{AC} ?? ?? @{AC} >= [[1d20]] ?? Bugfix: USE_PLAYER_COLOR will not conflict/override USE_DEFAULT FORMAT By default, PowerCards will use a players chosen color (the little square next to their name at the bottom of the map) for the background of the title of all their powercards unless they use --bgcolor and --txcolor to change the colors. Setting USE_PLAYER_COLOR to true will force all powercards to use the player color regardless of any background or text color tags in their macro. Use of the --format tag however will allow you to change the colors as needed for situations like D&D 4e at-will, encounter, and daily powers while leaving saving throws and skill checks as the player color. Minor Update: Padding on right aligned text ( ~R ) has been removed... don't know why I put it there in the first place. Minor Update: Weight on top part of the horizontal rule (~~~) has been increased to 0.3... it looks better now. (Thanks GenKitty!) Power Cards 3 ~ LINK: gist.github.com/Sky-Captain-13/452330a3d926b32da49c 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} 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.